Repository navigation
Conversation
Codecov Report❌ Patch coverage is
📢 Thoughts on this report? Let us know! |
|
CLA Not Signed The Contributor License Agreement (CLA) check is currently pending on this PR ( @breezeFur please sign the CLA via the CLA assistant badge in the comment above, or visit https://cla-assistant.io/agentscope-ai/agentscope-java. Once signed, the Automated check by github-manager-bot |
oss-maintainer
left a comment
There was a problem hiding this comment.
Summary
First review of this PR. The diagnosis is correct and the fix is placed at the right boundary: AsyncToolMiddleware subscribes next.apply(input) inside Flux.create via a bare .subscribe(), which detaches from the caller chain and drops the Reactor Context, so AgentEventEmitter.fromContext(...) inside a tool has nothing to resolve. contextWrite(context -> context.putAll(sink.contextView())) is also exactly the idiom already used for the same problem elsewhere in this codebase (StaticLongTermMemoryHook.java:237), and runToolBatch in ReActAgent carries a comment describing the same failure mode for AgentSpawnTool — so this brings the acting middleware in line with existing practice rather than inventing a new mechanism. Read the code with the red/green evidence in the description and both new tests, and the per-subscription isolation claim holds.
Findings
- [Warning]
AsyncToolMiddleware.java:101-104— the new DEBUG message is the only non-ASCII log string insrc/mainofagentscope-core/agentscope-harness; every neighbouring message is English. Its arguments are also evaluated on every subscription regardless of level. - [Warning]
AsyncToolMiddleware.java:111—putAllcopies the entire caller context into a subscription that can outlive the foreground stream (the offload path completes the sink while the tool keeps running with a live emitter handle). Needs a sentence confirming the post-offload delivery contract, sincedeliverBackgroundResultalso pushes the same result via the inbox. - [Info]
AsyncToolMiddlewareTest.java:131— the offload test decides on a 50 ms wall-clock race;StepVerifier.withVirtualTimeor an injectedSchedulerwould make it deterministic. - [Info]
AsyncToolMiddlewareTest.java:147— the error channel of the detached subscription (asyncToolRegistry.fail(...), which itself does not inherit the context) is untested.
Two of these are questions about intent rather than defects, so I have not requested changes.
CI: all green on d76faa9e (build (ubuntu-latest), build (windows-latest), Check License, Check Module Sync, codecov/patch).
Cannot approve yet: license/cla is pending ("Contributor License Agreement is not signed yet."), so per this repo's contribution process the PR cannot be merged regardless of review outcome. @breezeFur please sign the CLA via the CLA assistant badge in the comment above — the code side looks close to ready.
Thanks for the thorough PR description, the explicit "red first" reproduction, and for scoping this to the remaining context-propagation gap in #2681 instead of the whole issue. That made the review much easier.
Automated review by github-manager-bot
|
Review follow-up is complete in 8482945. All four review threads have individual replies. Local Windows validation: 83 related regression tests passed, Spotless reactor check passed, the 6 focused tests passed on both JDK 21 and JDK 17, and the 3 virtual-time background cases passed in 5 consecutive runs. For this exact commit, GitHub now reports SUCCESS for Ubuntu/Windows builds, codecov/patch, license, module sync, and license/cla. The PR has been marked Ready for review. Review threads remain open for maintainer confirmation; no merge or protection bypass was performed. |
oss-maintainer
left a comment
There was a problem hiding this comment.
Summary
Re-review of 84829453. All four points from the previous round are properly addressed — the diagnostic is now English and isDebugEnabled()-guarded (with the contextView read hoisted out of the argument position, so nothing is materialised when DEBUG is off), the detached messageBus/asyncToolRegistry subscribes now go through one subscribeWithContext(...) helper that forwards the parent context (this is exactly the recurrence I was worried about, and covering register/complete/fail/inboxPush/enqueueWakeup in one place is the right shape), the wall-clock race in the offload test is replaced by StepVerifier.withVirtualTime, and the error channel is now pinned by a parameterised test that also asserts the original message survives. The context-propagation fix itself is unchanged and correct, and the two Info notes below are follow-ups, not blockers.
license/cla is signed and CI on this head is green (build ubuntu-latest, build windows-latest, Check License, Check Module Sync, codecov/patch), which also clears the previous flakiness concern on the Windows job.
LGTM.
Note on the delivery semantics
I read the new comment beside putAll(callerContext) and accept the reasoning for keeping the emitter identity as-is in this PR — silently re-routing post-offload events would be a wider behavioural change than a context fix should carry. My only ask is that the at-least-once question gets tracked outside the comment (inline note below), because the test now asserts the behaviour rather than merely documenting it.
Author checklist
Heads-up on the PR description rather than the code: it still says the PR is kept Draft and that the account owner has not signed off, but the PR is currently marked ready for review on GitHub. Worth reconciling the two before a maintainer picks this up, since my approval is only a code-level signal and not the independent human sign-off #2485 asks for.
Automated review by github-manager-bot
oss-maintainer
left a comment
There was a problem hiding this comment.
Re-review of ca6b591 (previous approval was on 8482945)
The follow-up refactor threads the captured callerContext into emitPlaceholderAndComplete(...) instead of re-reading the subscriber context off the FluxSink. That is behaviour-preserving inside Flux.create (sink.contextView() and the captured context are the same view), and it removes the last place where the async path depended on the sink being alive.
Verified against the sources: AgentEventEmitter.fromContext / fromForwardingContext, MessageBus.inboxPush / enqueueWakeup and the AsyncToolRegistry signatures all match what the commit uses, and the existing tests still cover the downstream, background-completion and background-failure context paths. No correctness, compatibility or performance concerns.
LGTM.
Automated review by github-manager-bot
|
Synchronized the branch with current Validation on this head:
The prior automated approval was on |
AgentScope-Java Version
2.1.0-SNAPSHOT, synchronized with
mainat9cfeaad4b.Description
Related to #2681 — only the remaining Reactor Context propagation gap, not a claim to resolve every post-timeout event-routing concern in that issue.
AsyncToolMiddlewareinvokesnext.apply(input).subscribe(...)insideFlux.create. That detached subscription does not inherit the caller's Reactor subscriber Context. This PR captures the subscriber context once at the subscription boundary and forwards it to detached tool execution and background operations withcontextWrite.Current
mainalready recovers anAgentEventEmitterinReActAgent's tool execution path, and the existing child-event integration test passes with that workaround. This patch fixes the earlier middleware boundary itself, including arbitrary caller context entries and forwarding-emitter identity; it does not remove or change the existing recovery.Changes
asyncToolRegistry.register/complete/fail,messageBus.inboxPush, andmessageBus.enqueueWakeup.Merge conflict resolution
The branch was synchronized with
mainafter#4530changed the same middleware. Merge commit185e4ac1eb5c440f5b7bf69eb5b58ecac3cf5f12combines both contracts:SUPPRESS_COMPLETION_CALLBACK, quiet-completion handling, andisSubagentCallbehavior remain intact.The PR diff against current
mainis still limited toAsyncToolMiddleware.javaand its test.Reproduction and validation
Environment: Windows, Microsoft JDK 21.0.10, Maven 3.9.6; repository Java release remains 17. No model service, Docker, database, or cloud credentials are needed.
Red: applying only the first regression to unmodified production code runs 1 test and fails with
NoSuchElementExceptionatAgentEventEmitter.fromContext(context).orElseThrow(). It is not a build/dependency failure or a zero-test run.For merge head
185e4ac1e:spotless:apply, reactorspotless:check, andgit diff --check: passed;46784999432: Ubuntu build (16m18s), Windows build (13m58s), Check License, Check Module Sync, andlicense/claall passed;mergeable=MERGEABLEandmergeStateStatus=CLEAN.Scope / review status
oss-maintainerapprovedca6b5913before this merge commit. The code diff is unchanged by the synchronization, but the latest merge head still benefits from maintainer re-confirmation.Checklist
185e4ac1emainresolved