mirror of
https://github.com/paperclipai/paperclip.git
synced 2026-11-29 23:56:43 +01:00
feat(presentation): let a person move a waiting continuation forward without starting a second run (#21373)
## Thinking Path > - Paperclip is the open source app people use to manage AI agents for work > - When a run is interrupted, Paperclip records a fresh continuation and continues the task by itself. Since #21353 the task reads as continuing (`working`, no Retry) for as long as that continuation waits > - That is truthful, but a person has no control while it waits. On hosted staging one agent had 21 running and 209 queued runs, and continuations waited 30 to 110 minutes. Pacing (#21234, #21354) admits a waiting continuation into the agent's queue within minutes, so most of that wait is in the queue, behind other work > - #21353 removed Retry from this state because a Retry started its own run, which raced the continuation and could give the task two runs > - A Retry that observes the queued continuation run cannot start a run: admission sees a queued run and joins the Retry to it (`coalesced`, `runId` = that run). Under #21234's ranking, a queued run that a person joined starts ahead of system recovery and ordinary work > - This pull request keeps the continuing state and, once the queued continuation has waited 15 minutes, also offers Retry labelled "Move it forward now" > - The benefit is that a person can move a long-waiting task to the front of its agent's queue, and the click can never create a second run ## Linked Issues or Issue Description Refs #21353, #21348, #21234, #21354, #21264, #21320, #21200 **What happened?** On hosted staging, tasks with a recorded continuation waited 30 to 110 minutes behind a deep agent queue. The task showed "continuing" with no action. The person could only wait. **Expected behavior** The task still never shows "failed". After a long wait the person can move the waiting continuation forward. The click must not start a second run. ## Which states a Retry joins (established before building) I read #21348's fold (`foldWaitingRetriesIntoContinuation`) and its tests, and drove the real click path (`requestTaskRetry` followed by `resumeTaskRetry`, as the route does) in a probe against each record state: | Continuation state | What a Retry does today | Offer Retry? | |---|---|---| | Recorded, waiting for delivery (`continuationDelivery: "pending"`, no run yet) | The Retry is admitted at once as its own `task_retry` run, for every isolation (`fresh_isolated_workspace`, `writer_ended`, native). The delivery pass then marks the record delivered (superseded). #21348's fold never runs: it folds only a Retry that is still `deferred_issue_execution` when the continuation run is created, and only for `fresh_isolated_workspace`. Nothing keeps the Retry deferred, so the click races the delivery pass. | **No** (unchanged) | | Delivered, continuation run `queued` | `requestTaskRetry` sees the latest run is busy and records the Retry as `coalesced` into that run in the same transaction. No run is created; `resumeTaskRetry` acts only on deferred Retries. The run is now ranked as a person's (`joinedByUser` in `queue.ts`). | **Yes, after 15 minutes** | | Continuation run `running` | Same join, but the run already started, so there is nothing to move forward. | No | | Continuation ended | A Retry gets its own run (the existing failed-run path). | Existing behaviour | So the Retry offered here is joined by the existing busy-run admission in `requestTaskRetry`, not by #21348's fold. Its source run is the queued continuation itself (the run the presentation names as `observedRunId`), not the run the continuation was created for. ## What Changed - `server/src/services/task-interruption-presentation.ts`: for a task whose latest run is `queued`, created 15 minutes ago or more, and named as `continuationRunId` by a delivered fresh-continuation record, the projection returns `state: "working"`, `canRetry: true`, `retryAction: "move_forward"`, responsibility `system`, `observedRunId` = that queued run. It does not offer this when a person's wake already joined the run, when the run's agent is not the assignee, or when a person-owned wait applies (approval, reconnect, budget, pause and the others are checked first). Two small reads run only for queued runs older than 15 minutes. The existing restore-hold check that withdraws `canRetry` also withdraws `retryAction`. - `packages/shared/src/types/execution-projection.ts`: new optional `retryAction?: "move_forward"` on `TaskInterruptionPresentation`. It only changes the label; `canRetry` still decides whether Retry is offered. - `ui/src/components/ExecutionBlockerNotice.tsx`: a `working` presentation with `retryAction: "move_forward"` shows "Waiting for the agent to finish other work. Paperclip continues this task by itself." and a "Move it forward now" button that calls the same task Retry. Token-only classes; `pnpm check:token-gates` is clean. - One join-only action, `move_forward`, carried from the offer to admission (contracts kept in sync): - `packages/shared/src/validators/issue.ts`: `taskRetrySchema` accepts `retryAction: "move_forward"`. The route already passes the body to `requestTaskRetry`. - `server/src/services/task-retry.ts` (`admitTaskRetry`): right after the stale check, still under the task row lock and before any other Retry path, a `move_forward` Retry whose observed run is no longer `queued` or `running` returns `{ accepted: false, alreadyMovedOn: true, requestId: null }` and writes nothing. This block was cleared with the owner of Retry admission. The owner will later extend it so that "continuation recorded, not yet delivered" also counts as actionable, after their pending-delivery change lands (about two lines on their side). Until then this presentation never offers the button in that state, so the early return cannot misfire from our UI. - `ui/src/api/issues.ts` and `ui/src/hooks/useTaskRetry.ts`: the click sends `retryAction: "move_forward"` when the offer has it. `alreadyMovedOn` shows "The task already moved on, so nothing new was started. It now shows its current state." - What a click does at each timing: continuation `queued` → joined to that run (moves it forward); `running` → joined (nothing more to do); ended → "already moved on", nothing started. - A joined click cannot become a run later. The busy path writes it as `coalesced` with `runId` set to the continuation and `finishedAt` set (`task-retry.ts:456-461`). Promotion after a run ends (`heartbeat/run-control.ts:944` `releaseIssueExecutionAndPromote`; `modules/wake-queue/adapters/postgres.ts:89` `DEFERRED_WAKE_STATUS` and the selects near `:1358`), `resumeTaskRetry` (`run-control.ts:833-839`) and `resumeExecutionWaitComments` (`:876`) pick up only `deferred_issue_execution` wakes. - `ui/src/pages/Inbox.tsx`: the failed-run row does not show its Retry for this state. That row sends the failed run as the observed run, which is no longer the latest run, so its Retry would be refused as stale. - `doc/execution-semantics.md`: one paragraph on the offer, when it ends, and why there is none before delivery. ## Verification - Red (before the product change, new tests only), in `server/`: `pnpm exec vitest run src/__tests__/task-interruption-automatic-path.test.ts src/__tests__/recovery-wake-herd.test.ts`: 2 failed, 58 passed. Both failures are the missing offer (`canRetry: false`, no `retryAction`) for a continuation queued 15+ minutes. - Green after merging master8e41247b65, in `server/`: `pnpm exec vitest run src/__tests__/recovery-wake-herd.test.ts src/__tests__/task-interruption-automatic-path.test.ts src/services/task-retry.test.ts src/services/task-interruption-presentation.test.ts src/__tests__/task-interruption-query.test.ts`: 5 files, 279 tests pass. UI: `useTaskRetry.test.tsx` and `ExecutionBlockerNotice.test.tsx`: 35 tests pass. - New tests: - (b, integration, `recovery-wake-herd.test.ts`) A continuation delivered by the real delivery pass waits 16 minutes behind older ordinary work. The task offers "move forward". The click goes through the real `requestTaskRetry` and `resumeTaskRetry`. Result: the task has exactly one run after the source run, the continuation; the Retry wake is `coalesced` with `runId` = the continuation; the offer disappears; the next delivery pass adds nothing; the real dispatcher (`resumeQueuedRuns`) starts the continuation ahead of the older work; after it ends, still only that one run. - (Greptile P1, red then green) "starts nothing when the continuation ended between showing Move it forward now and the click": the continuation ends after the offer is read. Before the admission block the click was accepted (`accepted: true`, a new deferred Retry that becomes a turn). Now it returns `alreadyMovedOn`, the task has one run, and there is no `task_retry` wake. - "never turns a joined move-forward click into a new run after the continuation it joined ends": the click joins the queued continuation. The run is then cancelled through the real `cancelRun` release. Two rounds of `resumeExecutionWaitComments`, `resumeTaskRetry`, the delivery pass and `resumeQueuedRuns` follow. The joined wake stays `coalesced` on the ended run. No run comes from the click, and the task's later runs equal those of an identical task with no click (the system's own `issue_assignment_recovery`). - UI hook (`useTaskRetry.test.tsx`): the click sends `retryAction: "move_forward"`, and the `alreadyMovedOn` outcome shows the plain message. - (a) Under 15 minutes: no Retry. Control in the herd file: without a click the older work starts first. - (b, presentation) Queued 15, 45 and 110 minutes: `working`, `canRetry: true`, `retryAction: "move_forward"`. - (c) No Retry while the continuation waits for delivery (16, 45, 110 minutes), when it is running, when a person already joined it, for a queued run that is not a recorded continuation, and a paused agent still asks the person to resume. - UI (`ExecutionBlockerNotice.test.tsx`): plain wording with one "Move it forward now" button that calls Retry; no button for a read-only user; nothing shown for a plain `working` state. - (d) The #21200, #21264, #21320 and #21353 guard tests pass unchanged, including "follows the new run once a recorded continuation is delivered" (a just-queued continuation shows no Retry). - `node scripts/typecheck-layers.mjs` in `server/`, `tsc --noEmit` in `packages/shared`, `pnpm run typecheck` in `ui/`: clean. - Not related to this change: `src/services/fresh-continuation-fallback.test.ts` has one failure ("starts the continuation while the unreachable old lease is active", a deadlock in the `afterEach` truncate) that also fails on master18fb6ee571without this change. ## Risks - Moving a waiting continuation forward lets it start before other queued work of the same agent. That is the purpose, and it is the ranking #21234 already gives any run a person joined. - No Retry is offered while a continuation is still waiting for delivery. The delivery pacing admits a waiting continuation into the queue within minutes, and a fresh interruption at once (#21354), so the offer appears after the continuation reaches the queue. For the recovery owner (not changed here): offering Retry before delivery would need the Retry admission to hold or deliver the pending continuation itself under the task lock, instead of starting its own run beside it. - Admission changes only for a request that carries `retryAction: "move_forward"`. Every other Retry is unchanged. No schema, migration or dispatch change. > For core feature work, check [`ROADMAP.md`](ROADMAP.md) first and discuss it in `#dev` before opening the PR. Feature PRs that overlap with planned core work may need to be redirected — check the roadmap first. See `CONTRIBUTING.md`. ## Model Used - Claude Opus 5.5 (`claude-opus-5-5`), Anthropic, used through Claude Code with tool use (shell, file edits, local test runs). ## Checklist - [x] I have included a thinking path that traces from project context to this change - [x] I have specified the model used (with version and capability details) - [x] I have checked ROADMAP.md and confirmed this PR does not duplicate planned core work - [x] I have searched GitHub for duplicate or related PRs and linked them above - [x] I have either (a) linked existing issues with `Fixes: #` / `Closes #` / `Refs #` OR (b) described the issue in-PR following the relevant issue template - [x] I have not referenced internal/instance-local Paperclip issues or links (only public GitHub `#NNN` / `github.com/paperclipai/paperclip` URLs) - [x] My branch name describes the change (e.g. `docs/...`, `fix/...`) and contains no internal Paperclip ticket id or instance-derived details - [x] I have run tests locally and they pass - [x] I have added or updated tests where applicable - [x] I have updated relevant documentation to reflect my changes - [x] I have considered and documented any risks above - [ ] All Paperclip CI gates are green - [ ] Greptile is 5/5 with no open P2s, recommendations, or follow-ups - [x] I will address all Greptile and reviewer comments before requesting merge 🤖 Generated with [Claude Code](https://claude.com/claude-code) --------- Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
681af53fa6
commit
d9b42b50fd
14 files changed
+287
-7
No files matched your search
@@ -1648,6 +1648,8 @@ timeout retries still require a fresh allocation under the policy above.
|
||||
|
||||
A person's task Retry on a connected task first asks the chat retry owner to repeat the exact failed chat request. When the latest run is that person's own saved board turn that cannot be certified for replay, when no chat retry owner is available, or when that owner refuses (`chat_failed_run_retry_not_authorized`), the refusal and any writes it made are rolled back and the same Retry receipt becomes an ordinary board continuation: the clicking person is the responsible user, the run starts a fresh session from saved work, and no chat action, chat authority, or output replay is created. This is the same authority as a new message from that person. When the conversation still holds saved or unadmitted chat input for the task, Retry keeps the exact-replay path and its refusal, because that input continues through its own admission. Dispatch keeps every normal gate (current task access, executor containment, recovery holds, unadmitted chat input). Projection and the route therefore agree: a shown Retry on a connected task is accepted. Retry that Paperclip requests by itself on a person's behalf (restart recovery, provider limit reset) keeps the exact-replay requirement and still settles on the refusal. A budget resume continues the person's own Retry, so it takes the board continuation too. No migration is needed; tasks blocked by an earlier release become retryable at the next click.
|
||||
|
||||
A task whose run was interrupted and whose fresh continuation is recorded reads as continuing (`working`, no Retry) while the continuation waits to be delivered and while it waits in the agent's queue. Once the delivered continuation run has waited in the queue for 15 minutes, the task also offers Retry with `retryAction: "move_forward"`, labelled "Move it forward now". The Retry names that queued run as its observed run, so admission joins it to the run (`coalesced`) and starts no second run; a run that a person joined starts ahead of system recovery work. The offer ends once a person has joined the run or the run starts. While the continuation is still waiting to be delivered, no Retry is offered: a Retry there would start its own run beside the recorded continuation.
|
||||
|
||||
The exact replay can also be refused after the click is accepted. This happens when chat source authorization was deferred by a busy identity or endpoint lock, or when it later fails, so the chat retry action settles `failed` with no admitted run. The task Retry receipt is then not failed. If it is a person's Retry, its source run is still the latest run, its chat wake has no run, and no saved or unadmitted chat input remains, the same receipt drops its chat action and becomes the board continuation described above, recorded as `issue.retry_continued_from_saved_work`. Saved chat input whose source comment was written no later than the failed run's stop boundary (the user's recorded Stop request, otherwise `finishedAt`, the same boundary admission uses) does not block this: admission holds such input as `message_predates_stop`, so it can never start alone. The continuation adopts it (the input receipt is coalesced into the Retry receipt) and the task continues from saved work. Saved input that arrived after the stop keeps its own admission path, and the Retry still settles as failed. When the latest run is an admission that the recovery hold cancelled before dispatch (`execution_reconciliation_required`), the saved work that counts is the recovered work of the run whose recovery action held it. The deferred-receipt worker dispatches it with every normal gate. Retry that Paperclip requests by itself still settles as failed. When a failed run's saved work is recovered, the task's execution blocker offers Retry (also on a connected task) and says "Saved work recovered. Retry continues from it." A stopped (cancelled) run keeps "Send a message to continue."
|
||||
|
||||
### Saved chat Retry preparation
|
||||
|
||||
@@ -145,6 +145,7 @@ export interface TaskInterruptionPresentation {
|
||||
state: "working" | "retry_scheduled" | "failed" | "waiting_for_user" | "resolved";
|
||||
nextRetryAt: string | null;
|
||||
canRetry: boolean;
|
||||
retryAction?: "move_forward";
|
||||
userAction: "approval" | "reconnect" | "assign_agent" | "choose_model" | "resume" | "budget" | "project_access"
|
||||
/** Board confirms that a previous server, which can no longer report, stopped its workspace copyback. */
|
||||
| "confirm_owner_stop"
|
||||
|
||||
@@ -646,6 +646,7 @@ export const retryWorkspaceExportSchema = z.object({
|
||||
export const taskRetrySchema = z.object({
|
||||
idempotencyKey: z.string().guid(),
|
||||
observedRunId: z.string().guid().nullable(),
|
||||
retryAction: z.literal("move_forward").optional(),
|
||||
}).strict();
|
||||
|
||||
export const recoverWorkspaceSchema = z.object({
|
||||
|
||||
@@ -14,6 +14,7 @@ import { PENDING_CONTINUATION_BOUND_MS, assignedWorkSweep } from "../services/re
|
||||
import { evaluateAssignedWork } from "../services/recovery/assigned-work-invariant.js";
|
||||
import { taskInterruptionPresentation } from "../services/task-interruption-presentation.js";
|
||||
import { executionControlSchedule } from "../services/execution-control-work.js";
|
||||
import { requestTaskRetry } from "../services/task-retry.js";
|
||||
|
||||
const support = await getEmbeddedPostgresTestSupport();
|
||||
const suite = support.supported ? describe : describe.skip;
|
||||
@@ -702,4 +703,136 @@ suite("recovery wake herd", () => {
|
||||
await heartbeat.drainActiveRunExecutions();
|
||||
}
|
||||
}, 60_000);
|
||||
|
||||
async function continuationWaitingInQueue(agentId: string, queuedMinutesAgo: number) {
|
||||
const record = await pendingContinuation(agentId, queuedMinutesAgo + 2);
|
||||
const wake = fakeWake();
|
||||
await deliverReconciledExecutions(db, wake as never);
|
||||
expect(wake).toHaveBeenCalledTimes(1);
|
||||
const delivered = await wake.mock.results[0]!.value as typeof heartbeatRuns.$inferSelect;
|
||||
const [continuation] = await db.update(heartbeatRuns).set({ createdAt: new Date(Date.now() - queuedMinutesAgo * 60_000) })
|
||||
.where(eq(heartbeatRuns.id, delivered.id)).returning();
|
||||
const busy = await task(agentId);
|
||||
const [olderWork] = await db.insert(heartbeatRuns).values({ companyId, agentId, issueId: busy.id, invocationSource: "assignment",
|
||||
status: "queued", createdAt: new Date(Date.now() - (queuedMinutesAgo + 4) * 60_000),
|
||||
contextSnapshot: { issueId: busy.id, wakeReason: "issue_assigned" } }).returning();
|
||||
const [issueRow] = await db.select().from(issues).where(eq(issues.id, record.issue.id));
|
||||
return { ...record, continuation: continuation!, olderWork: olderWork!, issueRow: issueRow! };
|
||||
}
|
||||
|
||||
const runsOfTask = async (issueId: string, sourceRunId: string) => db.select().from(heartbeatRuns)
|
||||
.where(and(eq(heartbeatRuns.issueId, issueId), sql`${heartbeatRuns.id} <> ${sourceRunId}`));
|
||||
|
||||
it("moves a continuation that waited 15 minutes forward on a person's Retry, which joins it and starts no second run", async () => {
|
||||
const agentId = await seedCompany(1);
|
||||
const waiting = await continuationWaitingInQueue(agentId, 16);
|
||||
expect(await deliveryOf(waiting.action.id)).toBe("delivered");
|
||||
const shown = await taskInterruptionPresentation(db, waiting.issueRow);
|
||||
expect(shown).toMatchObject({ responsibility: "system", state: "working", canRetry: true, retryAction: "move_forward",
|
||||
observedRunId: waiting.continuation.id });
|
||||
const heartbeat = heartbeatService(db);
|
||||
try {
|
||||
const receipt = await requestTaskRetry({ db, companyId, issueId: waiting.issue.id, actorId: userId,
|
||||
observedRunId: shown!.observedRunId, retryAction: shown!.retryAction, idempotencyKey: randomUUID() });
|
||||
expect(receipt).toMatchObject({ accepted: true, stale: false });
|
||||
await heartbeat.resumeTaskRetry(companyId, receipt.requestId!);
|
||||
expect((await runsOfTask(waiting.issue.id, waiting.source.id)).map(run => run.id)).toEqual([waiting.continuation.id]);
|
||||
const [retryWake] = await db.select().from(agentWakeupRequests).where(eq(agentWakeupRequests.id, receipt.requestId!));
|
||||
expect(retryWake).toMatchObject({ status: "coalesced", runId: waiting.continuation.id, requestedByActorType: "user" });
|
||||
const after = await taskInterruptionPresentation(db, waiting.issueRow);
|
||||
expect(after).toMatchObject({ state: "working", canRetry: false });
|
||||
expect(after?.retryAction).toBeUndefined();
|
||||
|
||||
await deliverReconciledExecutions(db, fakeWake() as never);
|
||||
await heartbeat.resumeQueuedRuns();
|
||||
expect((await readRun(waiting.continuation.id)).startedAt).not.toBeNull();
|
||||
expect(await readRun(waiting.olderWork.id)).toMatchObject({ status: "queued", startedAt: null });
|
||||
} finally {
|
||||
await heartbeat.drainActiveRunExecutions();
|
||||
}
|
||||
await heartbeat.resumeQueuedRuns();
|
||||
await heartbeat.drainActiveRunExecutions();
|
||||
expect((await runsOfTask(waiting.issue.id, waiting.source.id)).map(run => run.id)).toEqual([waiting.continuation.id]);
|
||||
}, 120_000);
|
||||
|
||||
it("starts nothing when the continuation ended between showing Move it forward now and the click", async () => {
|
||||
const agentId = await seedCompany(1);
|
||||
const waiting = await continuationWaitingInQueue(agentId, 16);
|
||||
const shown = await taskInterruptionPresentation(db, waiting.issueRow);
|
||||
expect(shown).toMatchObject({ canRetry: true, retryAction: "move_forward", observedRunId: waiting.continuation.id });
|
||||
await db.update(heartbeatRuns).set({ status: "failed", errorCode: "adapter_failed", startedAt: new Date(), finishedAt: new Date() })
|
||||
.where(eq(heartbeatRuns.id, waiting.continuation.id));
|
||||
const heartbeat = heartbeatService(db);
|
||||
try {
|
||||
const receipt = await requestTaskRetry({ db, companyId, issueId: waiting.issue.id, actorId: userId,
|
||||
observedRunId: shown!.observedRunId, retryAction: shown!.retryAction, idempotencyKey: randomUUID() });
|
||||
expect(receipt).toMatchObject({ accepted: false, alreadyMovedOn: true, requestId: null });
|
||||
await heartbeat.resumeQueuedRuns();
|
||||
expect((await runsOfTask(waiting.issue.id, waiting.source.id)).map(run => run.id)).toEqual([waiting.continuation.id]);
|
||||
expect(await db.select().from(agentWakeupRequests).where(and(eq(agentWakeupRequests.reason, "task_retry"),
|
||||
sql`${agentWakeupRequests.payload}->>'issueId' = ${waiting.issue.id}`))).toEqual([]);
|
||||
} finally {
|
||||
await heartbeat.drainActiveRunExecutions();
|
||||
}
|
||||
}, 120_000);
|
||||
|
||||
async function endContinuationAndRunEveryPass(waiting: Awaited<ReturnType<typeof continuationWaitingInQueue>>,
|
||||
heartbeat: ReturnType<typeof heartbeatService>, retryRequestId?: string) {
|
||||
await heartbeat.cancelRun(waiting.continuation.id);
|
||||
expect(await readRun(waiting.continuation.id)).toMatchObject({ status: "cancelled" });
|
||||
for (let pass = 0; pass < 2; pass += 1) {
|
||||
await heartbeat.resumeExecutionWaitComments({ companyId });
|
||||
if (retryRequestId) await heartbeat.resumeTaskRetry(companyId, retryRequestId);
|
||||
await deliverReconciledExecutions(db, heartbeat.wakeup);
|
||||
await heartbeat.resumeQueuedRuns();
|
||||
}
|
||||
return (await runsOfTask(waiting.issue.id, waiting.source.id)).filter(run => run.id !== waiting.continuation.id)
|
||||
.map(run => run.contextSnapshot?.wakeReason);
|
||||
}
|
||||
|
||||
it("never turns a joined move-forward click into a new run after the continuation it joined ends", async () => {
|
||||
let withoutClick: unknown[] = [];
|
||||
{
|
||||
const agentId = await seedCompany(1);
|
||||
const control = await continuationWaitingInQueue(agentId, 16);
|
||||
const heartbeat = heartbeatService(db);
|
||||
try { withoutClick = await endContinuationAndRunEveryPass(control, heartbeat); }
|
||||
finally { await heartbeat.drainActiveRunExecutions(); }
|
||||
}
|
||||
const agentId = await seedCompany(1);
|
||||
const waiting = await continuationWaitingInQueue(agentId, 16);
|
||||
const shown = await taskInterruptionPresentation(db, waiting.issueRow);
|
||||
const heartbeat = heartbeatService(db);
|
||||
try {
|
||||
const receipt = await requestTaskRetry({ db, companyId, issueId: waiting.issue.id, actorId: userId,
|
||||
observedRunId: shown!.observedRunId, retryAction: shown!.retryAction, idempotencyKey: randomUUID() });
|
||||
expect(receipt).toMatchObject({ accepted: true });
|
||||
await heartbeat.resumeTaskRetry(companyId, receipt.requestId!);
|
||||
await endContinuationAndRunEveryPass(waiting, heartbeat, receipt.requestId!);
|
||||
const [retryWake] = await db.select().from(agentWakeupRequests).where(eq(agentWakeupRequests.id, receipt.requestId!));
|
||||
expect(retryWake).toMatchObject({ status: "coalesced", runId: waiting.continuation.id });
|
||||
const later = (await runsOfTask(waiting.issue.id, waiting.source.id)).filter(run => run.id !== waiting.continuation.id);
|
||||
expect(later.filter(run => run.wakeupRequestId === receipt.requestId || run.contextSnapshot?.wakeReason === "task_retry"
|
||||
|| run.contextSnapshot?.taskRetryRequestId)).toEqual([]);
|
||||
expect(later.map(run => run.contextSnapshot?.wakeReason)).toEqual(withoutClick);
|
||||
} finally {
|
||||
await heartbeat.drainActiveRunExecutions();
|
||||
}
|
||||
}, 120_000);
|
||||
|
||||
it("leaves a continuation that waited under 15 minutes in its place, with no Retry", async () => {
|
||||
const agentId = await seedCompany(1);
|
||||
const waiting = await continuationWaitingInQueue(agentId, 14);
|
||||
const shown = await taskInterruptionPresentation(db, waiting.issueRow);
|
||||
expect(shown).toMatchObject({ state: "working", canRetry: false });
|
||||
expect(shown?.retryAction).toBeUndefined();
|
||||
const heartbeat = heartbeatService(db);
|
||||
try {
|
||||
await heartbeat.resumeQueuedRuns();
|
||||
expect((await readRun(waiting.olderWork.id)).startedAt).not.toBeNull();
|
||||
expect(await readRun(waiting.continuation.id)).toMatchObject({ status: "queued", startedAt: null });
|
||||
} finally {
|
||||
await heartbeat.drainActiveRunExecutions();
|
||||
}
|
||||
}, 120_000);
|
||||
});
|
||||
@@ -144,6 +144,78 @@ describe.skipIf(!support.supported)("Retry is offered only when no automatic pat
|
||||
expect(await taskInterruptionPresentation(db, issue)).toMatchObject({ state: "failed", canRetry: true, observedRunId: nextRunId });
|
||||
});
|
||||
|
||||
async function seedQueuedContinuation(queuedMinutesAgo: number, status: "queued" | "running" = "queued") {
|
||||
const task = await seedRecordedContinuation(queuedMinutesAgo + 2);
|
||||
await db.update(heartbeatRuns).set({ createdAt: new Date(Date.now() - (queuedMinutesAgo + 4) * 60_000) })
|
||||
.where(eq(heartbeatRuns.id, task.runId));
|
||||
const nextRunId = randomUUID();
|
||||
await db.insert(heartbeatRuns).values({ id: nextRunId, companyId: task.companyId, agentId: task.agentId, nativeIssueId: task.issue.id,
|
||||
scopeKind: "issue", status, runtimeMode: "native", retryOfRunId: task.runId,
|
||||
createdAt: new Date(Date.now() - queuedMinutesAgo * 60_000),
|
||||
contextSnapshot: { issueId: task.issue.id, wakeReason: "issue_recovery_action_restored", previousRunId: task.runId,
|
||||
recoveryActionId: task.primary.id } });
|
||||
await db.update(issueRecoveryActions).set({ evidence: { ...task.primary.evidence, continuationDelivery: "delivered",
|
||||
continuationRunId: nextRunId } }).where(eq(issueRecoveryActions.id, task.primary.id));
|
||||
return { ...task, nextRunId };
|
||||
}
|
||||
|
||||
it("offers a person a way to move a continuation forward once it has waited 15 minutes to start, without calling it failed", async () => {
|
||||
for (const minutesAgo of [15, 45, 110]) {
|
||||
const { issue, nextRunId } = await seedQueuedContinuation(minutesAgo);
|
||||
expect(await taskInterruptionPresentation(db, issue)).toMatchObject({ responsibility: "system", state: "working",
|
||||
canRetry: true, retryAction: "move_forward", observedRunId: nextRunId });
|
||||
}
|
||||
});
|
||||
|
||||
it("keeps a continuation that has waited under 15 minutes as continuing with no Retry", async () => {
|
||||
const { issue, nextRunId } = await seedQueuedContinuation(14);
|
||||
const presentation = await taskInterruptionPresentation(db, issue);
|
||||
expect(presentation).toMatchObject({ state: "working", canRetry: false, observedRunId: nextRunId });
|
||||
expect(presentation?.retryAction).toBeUndefined();
|
||||
});
|
||||
|
||||
it("offers no Retry while a recorded continuation is still being delivered, however long it waits", async () => {
|
||||
for (const minutesAgo of [16, 45, 110]) {
|
||||
const { issue } = await seedRecordedContinuation(minutesAgo);
|
||||
const presentation = await taskInterruptionPresentation(db, issue);
|
||||
expect(presentation).toMatchObject({ state: "working", canRetry: false });
|
||||
expect(presentation?.retryAction).toBeUndefined();
|
||||
}
|
||||
});
|
||||
|
||||
it("offers no Retry for a continuation that is already running", async () => {
|
||||
const { issue } = await seedQueuedContinuation(45, "running");
|
||||
const presentation = await taskInterruptionPresentation(db, issue);
|
||||
expect(presentation).toMatchObject({ state: "working", canRetry: false });
|
||||
expect(presentation?.retryAction).toBeUndefined();
|
||||
});
|
||||
|
||||
it("offers no second Retry once a person already moved the waiting continuation forward", async () => {
|
||||
const { companyId, agentId, issue, nextRunId } = await seedQueuedContinuation(45);
|
||||
await db.insert(agentWakeupRequests).values({ companyId, agentId, source: "on_demand", triggerDetail: "manual",
|
||||
reason: "task_retry", status: "coalesced", requestedByActorType: "user", requestedByActorId: randomUUID(),
|
||||
runId: nextRunId, finishedAt: new Date(), payload: { issueId: issue.id } });
|
||||
const presentation = await taskInterruptionPresentation(db, issue);
|
||||
expect(presentation).toMatchObject({ state: "working", canRetry: false });
|
||||
expect(presentation?.retryAction).toBeUndefined();
|
||||
});
|
||||
|
||||
it("offers no Retry for queued work that is not a recorded continuation, however long it waits", async () => {
|
||||
const { companyId, agentId, issue } = await seedTask("todo");
|
||||
await db.insert(heartbeatRuns).values({ companyId, agentId, nativeIssueId: issue.id, scopeKind: "issue", status: "queued",
|
||||
runtimeMode: "native", createdAt: new Date(Date.now() - 45 * 60_000), contextSnapshot: { issueId: issue.id, wakeReason: "issue_assigned" } });
|
||||
const presentation = await taskInterruptionPresentation(db, issue);
|
||||
expect(presentation).toMatchObject({ state: "working", canRetry: false });
|
||||
expect(presentation?.retryAction).toBeUndefined();
|
||||
});
|
||||
|
||||
it("asks a person to resume a paused agent instead of offering to move its waiting continuation forward", async () => {
|
||||
const { agentId, issue } = await seedQueuedContinuation(45);
|
||||
await db.update(agents).set({ status: "paused", pauseReason: "manual" }).where(eq(agents.id, agentId));
|
||||
expect(await taskInterruptionPresentation(db, issue)).toMatchObject({ responsibility: "user", state: "waiting_for_user",
|
||||
userAction: "resume", canRetry: false });
|
||||
});
|
||||
|
||||
it("still offers Retry for a resolved recovery record that recorded no continuation", async () => {
|
||||
const { issue, hold } = await seedSwapEndedRun(new Date(Date.now() - 45 * 60_000));
|
||||
await db.update(issueRecoveryActions).set({ status: "resolved", outcome: "restored", resolvedAt: new Date(Date.now() - 40 * 60_000),
|
||||
|
||||
@@ -42,6 +42,7 @@ const NATIVE_RESUME_DISPATCH_GRACE_MS = 2 * 60_000;
|
||||
const QUEUED_INTERRUPT_HANDOFF_GRACE_MS = 5 * 60_000;
|
||||
const QUEUED_INPUT_DISPATCH_GRACE_MS = 2 * 60_000;
|
||||
const AUTOMATIC_DISPOSITION_GRACE_MS = 2 * 60_000;
|
||||
const WAITING_CONTINUATION_MOVE_FORWARD_MS = 15 * 60_000;
|
||||
|
||||
type ProjectionIssue = Pick<typeof issues.$inferSelect, "id" | "companyId" | "status" | "assigneeAgentId" | "projectId">;
|
||||
type ProjectionRun = Pick<typeof heartbeatRuns.$inferSelect,
|
||||
@@ -100,6 +101,7 @@ type ProjectionState = {
|
||||
* not yet started) or will check it again at `nextCheckAt`. */
|
||||
freshContinuation?: { state: "continuing" } | { state: "scheduled"; nextCheckAt: number };
|
||||
automaticDispositionAt?: number;
|
||||
waitingContinuation?: { queuedAt: number; personRequested: boolean };
|
||||
recoveryHandedToPerson?: boolean;
|
||||
};
|
||||
|
||||
@@ -275,6 +277,10 @@ function projectTaskInterruptionState(issue: ProjectionIssue, input: ProjectionS
|
||||
&& Number.isFinite(interruptAt) && now - interruptAt < QUEUED_INTERRUPT_HANDOFF_GRACE_MS
|
||||
&& !(retryWait?.sourceRunId === run.id && retryWait.preparationStatus) && system?.state !== "exhausted")
|
||||
return { ...base, intentId: interruptWait.id, state: "working" };
|
||||
const waiting = input.waitingContinuation;
|
||||
if (run.status === "queued" && waiting && !waiting.personRequested && run.agentId === issue.assigneeAgentId
|
||||
&& now - waiting.queuedAt >= WAITING_CONTINUATION_MOVE_FORWARD_MS)
|
||||
return { ...base, state: "working", canRetry: true, retryAction: "move_forward" };
|
||||
if (["running", "queued"].includes(run.status)) return { ...base, state: "working" };
|
||||
// Paperclip is continuing the task by itself: no failed attempt and no Retry.
|
||||
if (input.freshContinuation?.state === "continuing") return { ...base, state: "working", canRetry: false };
|
||||
@@ -642,6 +648,23 @@ export async function taskInterruptionPresentations(db: Db, companyId: string, i
|
||||
automaticDispositionAt.set(row.issueId, Math.max(automaticDispositionAt.get(row.issueId) ?? 0, row.updatedAt.getTime()));
|
||||
}
|
||||
}
|
||||
const queuedContinuationIds = runs.filter(run => run.status === "queued" && run.createdAt
|
||||
&& run.createdAt.getTime() <= Date.now() - WAITING_CONTINUATION_MOVE_FORWARD_MS).map(run => run.id);
|
||||
const [continuationRows, personRows] = queuedContinuationIds.length ? await Promise.all([
|
||||
db.select({ runId: sql<string>`${issueRecoveryActions.evidence}->>'continuationRunId'` }).from(issueRecoveryActions).where(and(
|
||||
eq(issueRecoveryActions.companyId, companyId), inArray(issueRecoveryActions.sourceIssueId, ids),
|
||||
sql`${issueRecoveryActions.evidence} ? 'freshContinuation'`,
|
||||
sql`${issueRecoveryActions.evidence}->>'continuationDelivery' = 'delivered'`,
|
||||
inArray(sql`${issueRecoveryActions.evidence}->>'continuationRunId'`, queuedContinuationIds))),
|
||||
db.select({ runId: agentWakeupRequests.runId }).from(agentWakeupRequests).where(and(
|
||||
eq(agentWakeupRequests.companyId, companyId), inArray(agentWakeupRequests.runId, queuedContinuationIds),
|
||||
eq(agentWakeupRequests.requestedByActorType, "user"))),
|
||||
]) : [[], []];
|
||||
const waitingContinuationRunIds = new Set(continuationRows.map(row => row.runId));
|
||||
const personRequestedRunIds = new Set(personRows.flatMap(row => row.runId ? [row.runId] : []));
|
||||
const waitingContinuationFor = (run: typeof runs[number] | undefined): ProjectionState["waitingContinuation"] =>
|
||||
run?.createdAt && waitingContinuationRunIds.has(run.id)
|
||||
? { queuedAt: run.createdAt.getTime(), personRequested: personRequestedRunIds.has(run.id) } : undefined;
|
||||
const ownerStops = runIds.length ? await db.select({ issueId: issueRecoveryActions.sourceIssueId,
|
||||
runId: sql<string>`${issueRecoveryActions.evidence}->>'runId'` }).from(issueRecoveryActions).where(and(
|
||||
eq(issueRecoveryActions.companyId, companyId), inArray(issueRecoveryActions.sourceIssueId, ids),
|
||||
@@ -755,6 +778,7 @@ export async function taskInterruptionPresentations(db: Db, companyId: string, i
|
||||
const presentation = projectTaskInterruption(issue, { ...facts,
|
||||
freshContinuation: freshContinuationFor(issue.id, facts.run?.id),
|
||||
automaticDispositionAt: automaticDispositionAt.get(issue.id),
|
||||
waitingContinuation: waitingContinuationFor(facts.run),
|
||||
recoveryHandedToPerson: handedToPerson.has(issue.id),
|
||||
interruptWait: interruptWaitFor(issue.id),
|
||||
projectAccessAllowed: denied?.length === 0,
|
||||
@@ -793,6 +817,7 @@ export async function taskInterruptionPresentations(db: Db, companyId: string, i
|
||||
const presentation = result.get(issueId);
|
||||
if (!presentation || !blocker || blocker.canRetry) continue;
|
||||
presentation.canRetry = false;
|
||||
delete presentation.retryAction;
|
||||
if (!presentation.retryWait && blocker.workspaceRecovery && blocker.workspaceRecovery.status !== "recovered")
|
||||
presentation.retryWait = { reason: "workspace_repair_required", message: retryWaitMessages.workspace_repair_required! };
|
||||
}
|
||||
|
||||
@@ -244,6 +244,7 @@ export async function retireTaskRetriesContinuedBy(db: Db, input: {
|
||||
type TaskRetryRequest = {
|
||||
db: Db; companyId: string; issueId: string; actorId: string;
|
||||
idempotencyKey: string; observedRunId: string | null; actorSource?: string;
|
||||
retryAction?: "move_forward";
|
||||
/** Paperclip requests the user's Retry itself: after a restart lost an
|
||||
* unstarted turn, or once a provider usage limit it waited on has reset. */
|
||||
initiatedBy?: "restart_recovery" | "provider_limit_reset";
|
||||
@@ -318,6 +319,8 @@ function admitTaskRetry(input: TaskRetryRequest) {
|
||||
latest.agentId !== issue.assigneeAgentId || input.observedRunId !== latest.id) {
|
||||
return { requestId: null, accepted: false, stale: true, observedRunId: latest?.id ?? null, chatActionId: undefined };
|
||||
}
|
||||
if (input.retryAction === "move_forward" && !["queued", "running"].includes(latest.status))
|
||||
return { requestId: null, accepted: false, stale: false, alreadyMovedOn: true, observedRunId: latest.id, chatActionId: undefined };
|
||||
let active = (await tx.select().from(agentWakeupRequests).where(and(
|
||||
eq(agentWakeupRequests.companyId, issue.companyId), eq(agentWakeupRequests.agentId, issue.assigneeAgentId),
|
||||
sql`${agentWakeupRequests.payload}->>'issueId' = ${issue.id}`,
|
||||
|
||||
@@ -395,7 +395,7 @@
|
||||
"packages/shared/src/types/email.ts": "556ff6a0dcefa01eb704d6d00d3b191de81ff4dc",
|
||||
"packages/shared/src/types/environment.ts": "a380b9ce9d2d1763011e9adaa58615a3ef1e56c5",
|
||||
"packages/shared/src/types/execution-continuation.ts": "5afe62afd227efa03ff847d8f73291c14707ab5b",
|
||||
"packages/shared/src/types/execution-projection.ts": "e72e641602b296f6d3e16d07700629df3039a7b1",
|
||||
"packages/shared/src/types/execution-projection.ts": "247fd3cc8e10fef3f2ebad65d6c1148e1d4c68ab",
|
||||
"packages/shared/src/types/external-object.ts": "7a225e0f5a6777d449019a30530c858b753eb4c1",
|
||||
"packages/shared/src/types/feedback.ts": "c5eb31545c7f67c04ad9afd9db45a6b4774bcb35",
|
||||
"packages/shared/src/types/finance.ts": "5c2208c7950020f1005aa0dd86a1680c54dd4354",
|
||||
@@ -488,7 +488,7 @@
|
||||
"packages/shared/src/validators/issue-chat-bootstrap.test.ts": "e1ebb9aa94da22c825bc3ddd32ce2cfc98bfe645",
|
||||
"packages/shared/src/validators/issue-tree-control.ts": "7144ef86a83e008ac0626e1d62a1d6164c46f438",
|
||||
"packages/shared/src/validators/issue.test.ts": "9a10bf1112d7c85f80cc1fd5db9920dda8974643",
|
||||
"packages/shared/src/validators/issue.ts": "307eb382514fdce6124f36cbf313df2c1cbd8c3a",
|
||||
"packages/shared/src/validators/issue.ts": "120ffa23b571374453a9777992b7e400d789403e",
|
||||
"packages/shared/src/validators/native-finalization.test.ts": "40c68bdd1d0e8a77cd70c4576fae53334fe5be0d",
|
||||
"packages/shared/src/validators/native-finalization.ts": "d4e674de6ac7d36385e6f6c2172fa16ffc9b1830",
|
||||
"packages/shared/src/validators/onboarding-seed.ts": "de302a8400d4199053f379d9ed853522a3ac6d32",
|
||||
|
||||
@@ -446,8 +446,8 @@ export const issuesApi = {
|
||||
api.post<{ runId: string; resultId: string | null; status: "queued" }>(`/issues/${id}/recovery-actions/resume-workspace-finalization`, data),
|
||||
retryWorkspaceExport: (id: string, data: { actionId: string; runId: string; repairNote: string }) =>
|
||||
api.post<{ runId: string; resultId: string; leaseId: string; status: "queued" }>(`/issues/${id}/recovery-actions/retry-workspace-export`, data),
|
||||
retryTask: (issueId: string, body: { idempotencyKey: string; observedRunId: string | null }) =>
|
||||
api.post<{ requestId: string | null; accepted: boolean; stale: boolean;
|
||||
retryTask: (issueId: string, body: { idempotencyKey: string; observedRunId: string | null; retryAction?: "move_forward" }) =>
|
||||
api.post<{ requestId: string | null; accepted: boolean; stale: boolean; alreadyMovedOn?: boolean;
|
||||
scheduledRetry?: { outcome: "promoted" | "already_promoted" | "gate_suppressed" | "waiting" | "no_scheduled_retry"; message: string };
|
||||
presentation: import("@paperclipai/shared").TaskInterruptionPresentation | null }>(`/issues/${issueId}/retry`, body),
|
||||
recoverWorkspace: (id: string, data: { actionId: string; runId: string; idempotencyKey: string }) =>
|
||||
|
||||
@@ -66,6 +66,26 @@ describe("ordinary task interruption", () => {
|
||||
it.each(["working", "resolved"] as const)("does not duplicate the thread indicator for %s", async state => {
|
||||
await render({ ...failed, state }); expect(container.textContent).toBe("");
|
||||
});
|
||||
it("offers to move a waiting continuation forward in plain words, without reporting a failure", async () => {
|
||||
await render({ ...failed, state: "working", retryAction: "move_forward" });
|
||||
expect(container.textContent).toContain("Paperclip continues this task by itself.");
|
||||
expect(container.textContent).not.toMatch(/Couldn’t finish|failed|continuation|queue|run\b/i);
|
||||
const button = container.querySelector<HTMLButtonElement>('[data-testid="task-execution-move-forward"]');
|
||||
expect(button?.textContent).toBe("Move it forward now");
|
||||
expect(container.querySelectorAll("button")).toHaveLength(1);
|
||||
await act(async () => button!.click());
|
||||
expect(retry).toHaveBeenCalledOnce();
|
||||
});
|
||||
|
||||
it("shows a waiting continuation without the button to a read-only user, or once the move was requested", async () => {
|
||||
await act(async () => root.render(<ExecutionBlockerNotice presentation={{ ...failed, state: "working", retryAction: "move_forward" }}
|
||||
canRetry={false} onRetry={retry} />));
|
||||
expect(container.textContent).toContain("Paperclip continues this task by itself.");
|
||||
expect(container.querySelector("button")).toBeNull();
|
||||
await render({ ...failed, state: "working", canRetry: false });
|
||||
expect(container.textContent).toBe("");
|
||||
});
|
||||
|
||||
it("names the admission hold a task that has not started waits for", async () => {
|
||||
await render({ ...failed, state: "working", canRetry: false, sourceRunIds: [], observedRunId: null,
|
||||
retryWait: { reason: "budget.blocked", message: "Waiting for the budget to allow new work. The task starts automatically when it does." } });
|
||||
|
||||
@@ -71,6 +71,11 @@ export function ExecutionBlockerNotice({ presentation, canRetry, onRetry, optimi
|
||||
}
|
||||
if (step && presentation?.state === "working") return <div role="status" aria-label="Task status"
|
||||
className={cn("text-sm text-muted-foreground", className)}>{`${step}…`}</div>;
|
||||
if (!optimistic && presentation?.state === "working" && presentation.retryAction === "move_forward" && presentation.canRetry)
|
||||
return <div role="status" aria-label="Task status" className={cn("flex items-center justify-between gap-3 text-sm text-muted-foreground", className)}>
|
||||
<span className="min-w-0 flex-1">Waiting for the agent to finish other work. Paperclip continues this task by itself.</span>
|
||||
{canRetry && <Button variant="outline" size="sm" className="shrink-0" onClick={onRetry} data-testid="task-execution-move-forward">Move it forward now</Button>}
|
||||
</div>;
|
||||
// A task that has not started yet names the admission hold it waits for.
|
||||
if (!optimistic && presentation?.state === "working" && presentation.retryWait) {
|
||||
const dependencies = presentation.retryWait.reason === "dependency_blocked" ? blockers ?? [] : [];
|
||||
|
||||
@@ -57,6 +57,19 @@ describe("optimistic task Retry", () => {
|
||||
await render({ ...waiting, interruption: { ...presentation, state: "working", canRetry: false } } as Issue);
|
||||
expect(container.querySelector('[role="alert"]')).toBeNull();
|
||||
});
|
||||
it("sends the move-forward intent from the offer and says plainly when the task already moved on", async () => {
|
||||
const presentation = { intentId: null, responsibility: "system" as const, state: "working" as const, canRetry: true,
|
||||
retryAction: "move_forward" as const, nextRetryAt: null, userAction: null, sourceRunIds: ["continuation"], observedRunId: "continuation" };
|
||||
vi.mocked(issuesApi.retryTask).mockResolvedValue({ requestId: null, accepted: false, stale: false, alreadyMovedOn: true,
|
||||
presentation: { ...presentation, canRetry: false, retryAction: undefined } } as Awaited<ReturnType<typeof issuesApi.retryTask>>);
|
||||
await render({ ...issue, interruption: presentation } as Issue);
|
||||
await act(async () => container.querySelector("button")!.click());
|
||||
expect(issuesApi.retryTask).toHaveBeenCalledExactlyOnceWith("task", {
|
||||
observedRunId: "continuation", retryAction: "move_forward", idempotencyKey: expect.any(String),
|
||||
});
|
||||
expect(container.querySelector('[role="alert"]')?.textContent).toContain("already moved on, so nothing new was started");
|
||||
});
|
||||
|
||||
it("shows nothing extra when Retry promoted the scheduled run", async () => {
|
||||
vi.mocked(issuesApi.retryTask).mockResolvedValue({ requestId: "retry", accepted: true, stale: false,
|
||||
scheduledRetry: { outcome: "promoted", message: "Retry promoted" }, presentation: null });
|
||||
|
||||
@@ -6,12 +6,16 @@ import { issuesApi } from "../api/issues";
|
||||
import { queryKeys } from "../lib/queryKeys";
|
||||
import { createUuid } from "../lib/uuid";
|
||||
|
||||
type RetryRequest = { issueId: string; identifier?: string | null; idempotencyKey: string; observedRunId: string | null };
|
||||
type RetryRequest = { issueId: string; identifier?: string | null; idempotencyKey: string; observedRunId: string | null;
|
||||
retryAction?: "move_forward" };
|
||||
type RetryResult = Awaited<ReturnType<typeof issuesApi.retryTask>>;
|
||||
|
||||
export const STALE_TASK_RETRY_MESSAGE = "This attempt was already replaced, so Retry did not start new work. The task now shows its current state.";
|
||||
|
||||
export const ALREADY_MOVED_ON_MESSAGE = "The task already moved on, so nothing new was started. It now shows its current state.";
|
||||
|
||||
export function taskRetryNotStartedReason(result: RetryResult): string | null {
|
||||
if (!result.accepted && result.alreadyMovedOn) return ALREADY_MOVED_ON_MESSAGE;
|
||||
if (!result.accepted) return STALE_TASK_RETRY_MESSAGE;
|
||||
const outcome = result.scheduledRetry?.outcome;
|
||||
if (outcome && outcome !== "promoted" && outcome !== "already_promoted") return result.scheduledRetry!.message;
|
||||
@@ -95,7 +99,8 @@ export function useTaskRetry(issue: Issue | undefined) {
|
||||
setNotStarted(null);
|
||||
mutation.reset();
|
||||
request.current ??= { issueId: issue.id, identifier: issue.identifier, idempotencyKey: createUuid(),
|
||||
observedRunId: issue.interruption?.observedRunId ?? issue.executionBlocker?.runId ?? null };
|
||||
observedRunId: issue.interruption?.observedRunId ?? issue.executionBlocker?.runId ?? null,
|
||||
...(issue.interruption?.retryAction === "move_forward" ? { retryAction: "move_forward" as const } : {}) };
|
||||
setOptimistic(true);
|
||||
setTakingLonger(false);
|
||||
mutation.mutate(request.current);
|
||||
|
||||
@@ -416,7 +416,7 @@ export function FailedRunInboxRow({
|
||||
confirm_owner_stop: "Confirm the previous server stopped",
|
||||
confirm_run_stopped: "Confirm the previous run stopped",
|
||||
}[interruption.userAction ?? "resume"]) : runFailureMessage(run);
|
||||
const retryAvailable = !interruption || interruption.canRetry;
|
||||
const retryAvailable = !interruption || (interruption.canRetry && interruption.retryAction !== "move_forward");
|
||||
const showUnreadSlot = unreadState !== null;
|
||||
const showUnreadDot = unreadState === "visible" || unreadState === "fading";
|
||||
|
||||
|
||||
Reference in new issue
Block a user