mirror of
https://github.com/paperclipai/paperclip.git
synced 2026-12-04 04:29:01 +01:00
## Thinking Path
> - Paperclip is the open source app people use to manage AI agents for
work
> - A native agent keeps a warm session between the turns of a task
> - After the warm session leaves memory, the server recovers it from
saved state
> - That recovery required the task status to be `in_progress`
> - Some runs start on a task that is not `in_progress`, by design
> - Those runs lost their session, although the saved session was intact
> - Run dispatch already decides which tasks a run may start on
> - This pull request removes the status check from recovery
> - The benefit is that a comment on a task in review continues the same
conversation
## Linked Issues or Issue Description
Refs #16451 (added this recovery), #21001 (separated the two kinds of
refusal).
**What happened?**
A task was in review. The warm session was no longer in memory. A
comment started a run. The run failed with `native_session_interrupted`
and `warm_recovery_refused=current_run_not_admitted`. The task then
continued in a fresh session.
A comment soon after the previous run did resume the session. That path
uses the session in memory and does not read the task status.
**Expected behavior**
The run must resume the saved session. Automatic checkout leaves a task
in review on purpose. The agent skill tells the agent to check out the
task after it reads the comment. The agent cannot do that before its
session resumes.
**Steps to reproduce**
1. Run a task on a remote environment with a warm session.
2. Let the agent move the task to review.
3. Wait until the warm session leaves memory.
4. Add a comment to the task.
I saw this failure once on a live task. An API call had set that task to
review. The new test shows the cause. I did not repeat steps 1 to 4 on a
task that an agent moved to review.
**Paperclip version or commit**
The check is on `master` at 4db307d53c.
## What Changed
- Warm session recovery no longer checks the task status.
- The status check did not stop the run. It only lost the saved session.
On a closed task the automatic fresh continuation does not apply, so the
run failed.
- The ownership, cancellation, agent and lease checks do not change.
- Automatic checkout does not change.
## Verification
- `npx vitest run
src/services/native-runtime/remote-warm-session-recovery.test.ts` in
`server`: 11 tests pass on an embedded PostgreSQL database.
- The file tests every task status, and each ownership and cancellation
refusal.
- The tests replace only the parser of the saved execution input and the
saved checkpoint. The suite setup reads the same database settings as
the suite gate.
- I ran the same tests against the previous check. The cases for a
status other than `in_progress` failed. The other cases passed.
- `npx tsc --noEmit` in `server` has no errors. CI runs the other test
suites.
## Risks
- A run can now resume on a task whose status changed while the run
started. The path that uses the session in memory already allows this.
- A person who closes a task, and any actor who cancels one, also stops
its run. The run checks then refuse recovery. If an agent marks the task
done while the run starts, the run continues and keeps its session.
- Saved state does not change. A session saved by the previous release
resumes as before, or resumes where it was refused.
- Other failures of the current run can still end in a fresh session.
This pull request does not change that policy.
> 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`) by Anthropic, in Claude Code, with
tool use (shell, file editing, code search) and extended thinking.
## 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
- [x] All Paperclip CI gates are green
- [x] 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>