Repository navigation
fix(server): ACP restart continuations no longer reopen a cut turn in a second session - #166
chrisohearn wants to merge 3 commits into
Conversation
… a second session When a restart continuation's session/load fails on an agent that can restore sessions (canResumeAfterRestart, set only by the ACP adapter), the old turn may still be running agent-side and the load error cannot tell busy from gone. The continuation now fails with a message saying so instead of replacing the native session; the next message the user sends falls back as before. Agents that cannot reload sessions, and other providers, keep the fresh-session fallback. Refs pingdotgg#37287 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> (cherry picked from commit f948195)
Codex Review Summary: ✅ CompletedThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 9140db553a
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
…ttempt A restart continuation whose native session lost the kept turns (a rolled-back turn on an agent that cannot truncate) gets a synthetic resume failure without calling resumeThread. The guard treated it as an ambiguous load error and blocked the intended fresh-session recovery. It now fires only when the resume was actually attempted. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 9d3b245122
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
…keeps actionable refusals A restart continuation that only delivers a restart note has no cut turn to repeat, so it keeps the fresh-session recovery. A resume refusal with a known remedy (for example an unaccepted model) now reaches the user as is instead of the generic restart message; neither case opens a second session. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
Holding this as a draft after testing it against Hermes (Local ACP) on a dev server built from this branch. On Linux hosts where T3 runs agents in systemd scopes, a restarted server stops the previous server's agent slice ( So on those hosts the guard can't prevent a duplicate turn; it can only turn a recoverable load failure into a failed run. It only protects hosts without scope reaping (macOS, Windows, or Linux without user systemd). Before merging, gate it on reaping being unavailable, or leave it unmerged. The real gap on this host is earlier: after a T3 crash, the old agent keeps working, unseen, until the restarted server spawns its first agent. This guard can't close that window. |
After a backend restart, a restart continuation calls
session/loadon the ACP agent. When that load fails, the fork falls back tosession/new. Agents like Hermes keep the cut turn running agent-side, so the fallback can start the same work in a second native session that T3 can't see or cancel (NousResearch/hermes-agent#156173, pingdotgg#37287 part B).This ports upstream's guard f948195 from the upstream branch
factory/issue-37287. That commit is on neither upstreammainnor this integration branch. When a restart continuation's resume fails on an agent that can restore sessions (canResumeAfterRestart, set only by the ACP adapter), the run now fails with a message saying the last turn may still be running there, instead of opening a fresh session. Agents that can't reload sessions, and other providers, keep the fresh-session fallback.Scope note: this is not full containment. The next message the user sends still falls back to a fresh session as before, and an orphaned agent-side turn keeps running until the agent stops it. Agent-side containment is tracked separately.
Proof: the new paired test in
ProviderTurnStartService.test.tsfails without the guard and passes with it (the file's suite: 114/114).vp run check:changed: format, lint, knip, typecheck (43 packages) and react compiler pass. Its 184-file test sweep hit the local 900 s timeout, so CI runs the full suite.🤖 Generated with Claude Code