Skip to content

docs(unstable-v2): scope cancellation to the foreground work it stops - #2929

Merged
benbrandt merged 1 commit into
mainfrom
docs/v2-foreground-cancellation
Nov 20, 2026
Merged

benbrandt merged 1 commit into
mainfrom
docs/v2-foreground-cancellation

Conversation

@benbrandt

Copy link
Copy Markdown
Member

session/cancel stops the named session's foreground work, not its update stream. The spec previously required content and tool-call updates after the notification to precede idle(cancelled), even though a listed background tool can still be running when that idle update is sent.

This change makes the ordering explicit:

  • Send the cancelled foreground work's pending updates, then idle(cancelled), before starting new foreground work in that session. Listed background work can keep reporting progress and its final status afterward.
  • A new prompt received after the notification is not cancelled by it. The Agent can insert and acknowledge the prompt during cleanup or hold it with its response pending. Its execution, not its insertion receipt, waits for idle(cancelled).
  • Cancelling a child's foreground work does not stop a terminal in that child's background list. Use the item's advertised cancel control, or close the root to stop the whole tree.

The baseline and Draft guides, migration guide, RFDs, and generated references agree on both races. No wire fields, method names, or v1 behavior change.

Validation: npm run generate, npm run check, baseline-v2 schema generator and cancellation tests, and Mintlify validation and link checks for the changed pages. Five focused Claude adapter tests also passed.

Downstream follow-up: With foreground work blocked on permission, I sent a held prompt, session/cancel, and then a distinct new prompt back-to-back over stdio to the TypeScript example at 91fb159. It returned -32800 for both prompts; only the first was covered. The RFD records this trace and the surviving-background-tool trace for conformance tests. This PR does not change either the SDK or the external TCK.

@benbrandt
benbrandt requested a review from a team as a code owner November 20, 2026 11:15
@benbrandt
benbrandt enabled auto-merge (squash) November 20, 2026 11:18
@benbrandt
benbrandt merged commit 333f537 into main Nov 20, 2026
13 checks passed
@benbrandt
benbrandt deleted the docs/v2-foreground-cancellation branch November 20, 2026 11:20
@acp-release-bot acp-release-bot Bot mentioned this pull request Nov 20, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant