mirror of
https://github.com/paperclipai/paperclip.git
synced 2026-11-16 11:59:26 +01:00
## Thinking Path > - Paperclip is the open source app people use to manage AI agents for work > - When a run cannot resume, the server records a continuation for the task and delivers it later as a new run > - #21378 made a person's Retry deliver a recorded, undelivered continuation as the one run, with its workspace isolation > - #21373 added the `move_forward` Retry action, which does nothing when the observed run is not queued or running > - Together, a `move_forward` request before delivery returned "already moved on" and started no work > - That state can last a long time when the agent has a deep queue, and it is when a person wants to move the task forward > - This pull request accepts the request when the task has a recorded, undelivered continuation > - The benefit is one action that moves waiting work forward in each state, with one run and the recorded isolation ## Linked Issues or Issue Description **What happened?** A task has a continuation that is recorded but not delivered. The latest run is the failed source run. A Retry request with `retryAction: "move_forward"` returns `accepted: false, alreadyMovedOn: true`. No run starts. **Expected behavior** The request is accepted. Wake admission delivers the recorded continuation as the one run for the task. The run keeps the recorded isolation. A later delivery pass creates no second run. **Steps to reproduce** 1. Record a fresh continuation for a task and do not run the delivery pass. 2. Call `requestTaskRetry` with `observedRunId` set to the source run and `retryAction: "move_forward"`. 3. The receipt says `alreadyMovedOn: true`. Refs #21373, #21378, #21348. ## What Changed - `admitTaskRetry` in `server/src/services/task-retry.ts` does not return `alreadyMovedOn` when `undeliveredContinuation` finds a recorded, undelivered continuation for the task. The check runs under the task row lock. - A new test in `fresh-continuation-retry-delivery.test.ts` covers the three record kinds: `fresh_isolated_workspace`, `writer_ended` and native. - The presentation code is unchanged. The interface does not offer the action in this state yet. ## Verification - The new test failed before the change for the three kinds (`expected { requestId: null, … } to match object { accepted: true }`). - `npx vitest run src/services/fresh-continuation-retry-delivery.test.ts`: 15 of 15 passed. - `npx vitest run src/services/task-retry.test.ts`: 117 of 117 passed. - `npx vitest run src/__tests__/recovery-wake-herd.test.ts -t move`: 2 of 2 passed. The case where the run ended and no continuation is pending still returns `alreadyMovedOn`. - `npx tsc --noEmit -p .` in `server/`: no errors. ## Risks Low risk. The change adds one read under a lock that the function already holds. The read runs only for a `move_forward` request when the observed run is not queued or running. A request without a pending continuation behaves as before. ## Model Used Claude Fable 5.2 (`claude-fable-5-2`), in Claude Code, with tool use and code execution. ## 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 Fable 5.2 <noreply@anthropic.com>