Repository navigation
docs(unstable-v2): let cancelled cover a child its parent cancels - #2943
Merged
Merged
Conversation
The stop reason rules reserved `cancelled` for a stop the user or Client chose and sent every other Agent-initiated stop to `error`. The subagents page says the Agent can cancel delegated work at any time and gave no stop reason for that case, which is neither a user choice nor a failure. A child session now also reports `cancelled` when its parent cancels its work. The Client cleanup rules on the subagents page are already keyed on a child's `cancelled` idle update.
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
The stop reason rules reserve
cancelledfor a stop the user or Client chose, and send every other stop the Agent makes toerror, which means "something failed". The Subagents page says the Agent can cancel work it delegated at any time, and gives no stop reason for that case. A parent that stops a child on its own, for example a model that calls a stop tool, is neither a user choice nor a failure.A child session now also reports
cancelledwhen its parent cancels its work.Why
cancelledstoppedorkilledtask tostopReason: "cancelled"(src/v2/tasks.tsata4f0f78). The Codex adapter maps aninterruptedturn tocancelled(src/subagents/StandardSubagentEventRouter.tsate49d438). Neither provider reports who asked for the stop. Both were checked on 2026-11-20.idleupdate withstopReason: "cancelled".errorwould misreport the child. It carries anerrorobject and reads as a failure, so a Client would show a child that was stopped on purpose as failed.Changes
StopReason::Cancelleddescription in the v2 schema, with the schema and the schema reference pages regenerated.No keyword is added. The existing rule "Agents MUST report this stop reason on an idle
state_updatewhen cancellation ends active foreground work" now covers this case. The Subagent Sessions RFD already says a child confirms cancellation withcancelled, so it needs no change.v1
Unchanged.
For implementers
cancelledfor a child its parent stopped needs no change. One that reportserrorfor it should switch.error.Checks
cargo fmt, Prettier and the spell check pass.