Repository navigation
fix(a2a): cancel streams registered after call cleanup - #4418
Open
CryoThrust wants to merge 1 commit into
Open
CryoThrust wants to merge 1 commit into
CryoThrust wants to merge 1 commit into
Conversation
Preview approval requiredThis pull request comes from a fork, so Mintlify won't build a preview until someone with write access approves commit |
This branch has not been deployed
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.
AgentScope-Java Version
2.1.0-SNAPSHOT (
main@5a315a9af)Description
Fixes #4416.
The default A2A call owns a fresh
StreamTrackingHttpClient, andendCalldrains its tracked futures. If cleanup happens while the delegate is still returning an SSE future, that future is registered after the drain and remains open. Closing the JSON-RPC transport alone does not close its event stream.Retain a terminal cancellation flag before draining the queue and recheck it after registering each future. This closes both already tracked and late-registered streams without adding a lock around delegate calls or callbacks. The wrapper remains package-private and per-call; remote task cancellation and custom client transports are unchanged.
Tests cover a deterministic reentrant cleanup boundary, late GET registration, completed-future preservation, repeated cleanup, latch-controlled concurrent POST registration, the existing real HTTP disconnect and normal request delegation. English and Chinese documentation distinguish local stream cleanup from confirmation that remote work stopped.
Verification
The new late-registration regression fails on the unchanged base; the five tracking-client cases pass after the fix without skips. The HTTP disconnect case uses a local server, not a remote model provider.
On Java 17:
The seven-module clean verification passed in 1:47: 3,932 tests, zero failures/errors, 11 skipped. Both A2A client (175 cases) and server (228 cases) ran with no skips. This is scoped module/dependency verification, not a whole-repository claim. Selecting only the A2A parent POM does not run its children; that initial aggregator-only command is not counted as test verification.
Documentation checks passed from
docs/:npm test,npm run validate,npm run broken-links.Checklist