Repository navigation
fix(server): Claude completion notices preserve queued tools - #15653
StiensWout wants to merge 2 commits into
Conversation
…ol calls When an async delegated task finished, T3 steered the completion notice into the running Claude turn with SDK priority "now". Claude ends the turn to deliver a "now" message, so tool calls it had issued but not started came back as "The user doesn't want to take this action right now. STOP". The agent read that as an instruction from the user and stopped. The Claude adapter now sends a server-created delegated completion with priority "next". Claude reads it at the turn's next tool boundary and every issued call still runs. A notice that lands during the final reply gets a native turn of its own afterwards, which reaches the thread through the existing continuation run. User steers, runtime-question answers and agent-to-agent steers keep "now". The steer input now carries the persisted message's delegatedCompletion so the adapter can tell a notice from other steers. Only a "now" steer marks the turn as expecting an abort result, so an abort after a notice still ends the turn. Fixes pingdotgg#15351 Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
…laude turn A "next" completion notice that lands during the final reply is answered by Claude in a turn of its own after the result. That turn echoed no prompt uuid, so when T3 had already started a queued run, the adapter took the notice's result for that run's own. The run ended on the notice's reply and its real reply showed up on a continuation run. The Claude adapter now stamps a "next" steer with a uuid derived from the steered message. Claude echoes it on the notice's turn, so the existing prompt-echo gate sends that output to a continuation run and leaves the queued run to end on its own result. "now" steers stay unstamped. Refs pingdotgg#15351 Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
ApprovabilityVerdict: Not approved Macroscope's review found this PR not approvable — This server-side fix changes Claude turn scheduling and reply attribution by propagating delegated-completion metadata into the adapter, affecting queued tool execution and continuation runs. The focused tests are extensive, but the runtime pipeline change is substantial enough to warrant human review. You can add or adjust custom eligibility rules. Learn more. |
|
Navigate logical layers of code changes, visualize relationships, and explore their blast radius. 🧰 Additional context used📚 Code guidelines (1)No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configuration
📒 Files selected for processing (5)
Included review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 9 remain after this review. 📝 WalkthroughWalkthroughSteering messages now carry delegated-completion metadata to the Claude adapter. The adapter uses that metadata to steer server-created completion notices with ChangesClaude steering flow
Priority: ➖ Normal Estimated code review effort: 3 (Moderate) | ~25 minutes Change: Bug fix · Severity of issue fixed: Medium Sequence Diagram(s)sequenceDiagram
participant ProviderTurnControlService
participant ClaudeAdapterV2
participant ClaudeAgentSDK
ProviderTurnControlService->>ClaudeAdapterV2: Pass delegatedCompletion when defined
ClaudeAdapterV2->>ClaudeAgentSDK: Send delegated notice with next priority and UUID
ClaudeAdapterV2->>ClaudeAgentSDK: Send other steer with now priority
Suggested reviewers: Merge Risk: ⚪ Minimal · up to Delegated-completion notices follow the queued steering path while user steering remains immediate. No identified issue prevents merging after normal checks. Security Architecture ReviewSecurity architecture risk: 🔵 Low · up to The change is narrowly scoped to completion-notice scheduling and reply attribution. Existing ownership checks and Stop controls remain in place, and no new privilege escalation path was identified. Delivery-failure behavior and compatibility across runtime versions remain partially verified. Retained concerns Security review detailsSecurity Blast Radius
Trust Boundaries and Controls
Resilience and Maintainability Implications
🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✨ Finishing Touches🧪 Generate unit tests (beta)
Comment |
|
The docstring-coverage warning is not actionable for this fix. The changed scheduling rule is already explained immediately above
|
|
Note Grok responding on behalf of Julius. Thanks for this, Wout. #15351 was fixed by #15892, which just merged to |
Problem
An async delegated-task completion notice interrupts Claude with
nowpriority, cancelling queued tool calls and producing a misleading user refusal.Change
Carry the existing delegated-completion metadata into the Claude adapter and use
nextpriority only for agent/server completion notices. User steering remains immediate, with the existing abort bookkeeping and Stop behavior preserved. Stamp the queued notice with its own prompt UUID so a late final reply stays attributed to the completion notice when a user turn is already queued.Scope and approval
Fixes #15351. This is the server-only fix requested by Wout for that issue; there are no client or other-provider behavior changes.
Verification
The implementer passed 177 focused tests, six steering replay cases, targeted lint, formatting, and server typecheck. Both independent validators passed this exact commit; each reran the Claude adapter and steering integration tests, with 152 tests passing.
Live SDK/CLI checks on Claude Code 2.1.289 reproduced cancellation with
nowand verified thatnextpreserves queued tools and the final reply. The stamped notice kept completion and queued-user replies separate, and Stop still worked. Live coverage is limited to that CLI version and direct SDK/Bash runs; MCP-specific behavior and older CLI versions were not verified.Implemented for Wout by
claude-opus-5-5in Claude Code through T3 Code. PR prepared bygpt-6.1-solin Codex through T3 Code.