Repository navigation
Conversation
The session machine drained pending permission requests on Stop and on process close, but not on TurnEnded. A request still unanswered when the turn ended stayed on screen, kept the task as "needs action" and kept the chat busy. Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Confidence Score: 5/5
[Medium impact] The PR appears safe to merge; the previous finding is fixed and no new actionable issues were found. SummaryTracks who owns each pending permission and cancels requests when their activity ends.
Diagram%%{init: {'theme': 'neutral'}}%%
flowchart TD
Request[Permission request] --> Idle{Conversation idle or closed?}
Idle -->|Yes| Cancel[Reply cancelled]
Idle -->|No| Pending[Keep request with its owner]
Pending --> Answer[User answers]
Pending --> End{Owner activity ends?}
End -->|Parent turn ends; child still runs| Pending
End -->|Child ends or no activity remains| Cancel
Pending --> Stop[Stop or process close]
Stop --> Cancel
Reviews (3) · Last reviewed commit: "fix(acp): cancel a child's requests howe..." · Reviewed by Greptile |
|
Thanks for picking up #3623. I reviewed What works: for a request that arrives before the parent turn ends (normal end, Stop, a turn error, a quick hand-off to a queued turn), the request is cleared, the agent is answered with a One regression, which blocks merging: The issue is only partly fixed: a stale request can still be left behind on four other paths, and the model test's invariant T7 is still marked
A counterexample from the model: |
A turn end no longer cancels the requests of child sessions, which stay answerable until the child goes idle. Requests that arrive in an idle session, or outlive a replay or sessionless background agents, are cancelled. The agent's own turn stays open while it waits for an answer. Fixes generalaction#3623 Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
|
Thanks, you were right on both points. Fixed in a new commit. Regression: each request now records its owner when it is routed in (the conversation's own session, or the child session that sent it). A parent turn end no longer cancels a child's request; it stays answerable until that child reports The other four paths: a request arriving in an idle session is answered One choice for you: for Limits:
Verified: ACP suites (718 pass, 1 skipped), Not verified: the running app or a real agent. The whole (Written with Claude Code, AI.) |
|
Thanks for the quick turnaround. I re-reviewed Direction: yes. Recording an owner per request is the right model. A child's request now survives the parent's turn end, replay is handled, and T7 passes without Three cases still go wrong. All three are reproduced, not read from the code.
On the model:
Tests and gates on this head pass (ACP suite 720/720, desktop ACP and conversations 342/342, format, lint, typecheck). The new tests fail on If you want to take another round, these three plus the two model points are the whole list. If you would rather hand it over, say so and I will finish it on your branch. |
- A launched child that has its own session no longer counts as a possible asker of requests on the conversation's session. - An idle session takes no request, a child's included, and a turn or replay that ends with no agent left cancels what is pending. An agent turn now lasts while any request is unanswered. - When the last background agent is done, an unattributed request is cancelled even if the agent's own turn is open, and the quiet period starts over. - The model generates child requests and checks that an open agent turn always has something that can end it. Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
|
Thanks for the reproductions. All three are fixed in a new commit.
Model: it now generates child requests (and the end of the child that asked). On the sources of T6: the Trade-offs:
Verified: Not verified: the running app or a real agent, desktop database tests ( (Written with Claude Code, AI.) |
|
@greptile review |
A child's request that outlived the parent turn was left pending when its agent ended through a `subagent` event, through an event naming only the launching call, or because the end of a replay settled it. Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
|
@greptile review |
|
Merged. Thanks for staying with this through four rounds; the per-request owner model is a real improvement over the first version. What the final checks showed on
Two things for a follow-up, if you want one; neither blocked the merge:
|
Description
The ACP session machine cleared pending permission requests on Stop and on process close, but not when whoever was waiting for the answer was done, so a dead request kept the permission band up, the task at "needs action" and the chat busy.
The session cell now records who owns each request, and the machine cancels it (the agent gets a
cancelledoutcome) when nobody can be waiting for it:idle, or its agent completes or fails (also when the event names only the launching call, or the end of a replay settles it).Behaviour changes to check:
runningupdate is taken only while something else is active. In a fully idle conversation it getscancelled.Known limits (from reading the code, not tested): a request on the conversation's session made between a launch call and the child's announcement stays while that child runs; a nested child that its parent child shows only as a tool call is not counted as running, so its request is cancelled if nothing else runs.
ACP state machine change (high-risk area). No wire schema change: the owner stays inside the runtime.
Related issues
Fixes #3623
Testing
machine.test.ts,cell.test.tsandpermission-ownership.test.ts(throughAcpRuntimeand the session router). With the sources ofd9c79a0d90, 10 tests fail (4 inpermission-ownership.test.ts, 3 exhaustive model runs, 3SessionCellproperty runs); all pass now.it.fails. The model sends requests of the conversation and of child sessions, also while idle and during a replay, and theSessionCellproperty test checks T7 too.cell.test.tsnow start a turn before asking, because an idle session cancels the request.AcpRuntimeinpermission-ownership.test.tsfail without its source change and pass with it.npx vitest run src/runtimes/acpinpackages/core(52 files, 730 pass, 1 skipped)nodeproject tests matchingacp conversation(46 files, 347 pass; run before the last commit). Themain-dbones do not run here (better-sqlite3is not installed); browser tests not run.npx tsgo --noEmit -p tsconfig.jsoninpackages/coreoxlintandoxfmt --checkon the changed files,tooling/oxlint/scripts/check-allowlists.mjspackages/coresuite was not run for the last commit. On an earlier head it did not pass on my Windows machine (97 files fail, none underruntimes/acp; among the errors are a missingbetter-sqlite3and "Path must be Windows drive or UNC absolute"); I did not compare that run withmain.Written with Claude Code (AI); tested locally with the commands above.
Checklist
messages and, when possible, the PR title
🤖 Generated with Claude Code
Open in [code]smith · Need help on this PR? Tag
@codesmith-botwith what you need.