Repository navigation
fix(chat): end background-subagent turns and correlate completions - #98
Merged
Merged
Conversation
The Stop hook blocked every turn end while a background subagent was alive and told the model to wait on TaskOutput, a tool qodercli never exposed. Turns that launched background work looped on the same explanation until interrupted, and interrupts left the state behind, so the session stayed unusable. The CLI already feeds completion notifications back into the model's context on its own; drop the hook and let turns end normally. The notification's task_id comes from the CLI's task registry and shares no id space with the agentId parsed out of the Agent tool result, so the block was never released and stayed on Running for the rest of the conversation. Correlate by the notification's tool_use_id — the launching Agent call, which is already our key — keeping the agentId lookup as a fallback and letting a notification claim a block whose agentId was never parsed. Co-authored-by: QoderAI (Qwen 3.8 Max) <qoder_ai@qoder.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
TaskOutput, which qodercli never exposed. Turns that launched background work looped on the same explanation until interrupted, and interrupts left the state behind, so the session stayed unusable (only a new conversation helped). The CLI already feeds completion notifications back into the model's context on its own and runs a follow-up turn; removing the hook lets turns end normally. Removessubagent-hooks.tsand all wiring (buildHooks,setSubagentStateSource,SubagentRuntimeState,hasRunningSubagents).tool_use_id. The CLI reports completion with atask_idfrom its own registry, which shares no id space with theagentIdparsed out of the Agent tool result that the block is keyed by — so the block was never released and stayed on "Running" for the rest of the conversation (and was falsely marked orphaned on switch). The notification'stool_use_idis the launching Agent call, which is already our key; prefer it, keep theagentIdlookup as a fallback, and let a notification claim a block whoseagentIdwas never parsed.Verification
npm run typechecknpm run lintnpm run test(3611 passed)npm run build(renderer-safe-unref patch applied; no bareheartbeatWatchdog.unref())npm run release:checknpm run audit:prod(0 vulnerabilities)TaskOutputmentions), the card transitions Running → completed with the result, and the CLI's follow-up turn delivers it. Session jsonl confirms the notification'stool-use-idmatches the launching Agent call whiletask-iddiffers.Safety
CHANGELOG.md