fix(acp): propagate request cancellation to peers - #158
Open
YoungSx wants to merge 6 commits into
Open
Conversation
ACP lists -32800 (Request cancelled) alongside the JSON-RPC standard codes and the ACP extension codes, but it belongs to neither: IsStandardErrorCode covers -32700..-32603 and IsAcpErrorCode covers -32099..-32000, so a peer's compliant cancellation response fell through GetErrorMessage's switch and rendered as "Unknown error (code: -32800)" — indistinguishable from a real failure. Give it a dedicated constant, region and predicate rather than widening either band, which would also reclassify every unassigned code in between. Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
…chema ACP RequestId permits null, numbers, and strings. Add a public union that preserves all three forms and keeps raw numeric token text so cancellation notifications echo the exact request identity a peer can correlate. Add CancelRequestParams for the protocol-level $/cancel_request notification, register it in the source-generated serialization context, update the public surface baseline, and lock null/number/string plus invalid-token behavior with round-trip contract tests. Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
Once an ACP request has been dispatched, caller cancellation now sends the protocol-level $/cancel_request notification with the original JSON-RPC id. The cancelled local await returns promptly while its correlation entry stays alive until the peer's required terminal response arrives, including -32800. Delivery is best effort: peers may ignore $/ notifications and a disconnect or failed notification cannot become a second user-facing failure. Tests assert the actual wire frame and matching request id, not local state. Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
|
You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard. |
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
A compliant agent may settle an original request with JSON-RPC -32800 after receiving $/cancel_request. Treat that as cancellation at the presentation boundary: prompts enter the existing cancelled turn phase, activation and hydration avoid fault callouts, and session operations/recovery skip their persistent failure messages. Also add a real stdio child-process test that captures ACP frames on the actual pipe and proves $/cancel_request carries the original request id. Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
…tion An in-flight transport send may have already placed bytes on the peer's pipe or socket when its cancellation token trips. Treat entry into SendMessageAsync as potentially dispatched and send $/cancel_request after the caller cancels, while retaining the pre-send token check so a request cancelled before writing still emits nothing. The test holds a send in progress, cancels it, and proves the notification is still emitted after releasing the write. Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
YoungSx
force-pushed
the
implement-cancel-request-protocol
branch
from
September 2, 2026 02:37
d1ff88d to
10607c4
Compare
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
Validation
platform analyzer cannot infer from Assert.SkipWhen; reproduced and cleared
locally with the same
dotnet format --verify-no-changesthe gate runsTarget branch: develop. Branch is rebased onto the latest origin/develop with a
linear, single-parent history, so it rebase-merges cleanly.