Skip to content

fix(tool): scope internal emitter callbacks to agent calls - #3066

Draft
CryoThrust wants to merge 1 commit into
agentscope-ai:mainfrom
CryoThrust:fix/call-scoped-tool-emitter-callback
Draft

fix(tool): scope internal emitter callbacks to agent calls#3066
CryoThrust wants to merge 1 commit into
agentscope-ai:mainfrom
CryoThrust:fix/call-scoped-tool-emitter-callback

Conversation

@CryoThrust

Copy link
Copy Markdown
Contributor

Summary\n\nFixes #3065.\n\nThe framework-internal ToolEmitter callback was stored as mutable state on a shared Toolkit/ToolExecutor. Concurrent ReActAgent calls could therefore route progress from one tool invocation to another request.\n\nThis draft keeps the existing public ToolEmitter API and carries the internal callback through the call-scoped ToolCallParam:\n\n- ReActAgent creates one callback per event stream.\n- Toolkit/ToolExecutor pass it through each tool execution.\n- DefaultToolEmitter captures the callback when the invocation starts.\n- The legacy setInternalChunkCallback path remains available for compatibility.\n\n## Regression coverage\n\nAdded a deterministic barrier-based test with two concurrent calls sharing one Toolkit. Each callback receives only its own tool ID and progress payload.\n\nVerification:\n\n- [INFO] Scanning for projects...

[ERROR] [ERROR] Could not find the selected project in the reactor: agentscope-core @
[ERROR] Could not find the selected project in the reactor: agentscope-core -> [Help 1]
[ERROR]
[ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch.
[ERROR] Re-run Maven using the -X switch to enable full debug logging.
[ERROR]
[ERROR] For more information about the errors and possible solutions, please read the following articles:
[ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/MavenExecutionException\n- [INFO] Scanning for projects...
[ERROR] [ERROR] Could not find the selected project in the reactor: agentscope-core @
[ERROR] Could not find the selected project in the reactor: agentscope-core -> [Help 1]
[ERROR]
[ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch.
[ERROR] Re-run Maven using the -X switch to enable full debug logging.
[ERROR]
[ERROR] For more information about the errors and possible solutions, please read the following articles:
[ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/MavenExecutionException\n- 28 existing ToolCallParam/ToolEmitter tests plus the new concurrency case pass.\n\nThis is a draft because the five-argument Toolkit.callTools overload is an internal API shape for maintainer review. I can adapt it to another internal execution-context mechanism if preferred.

Signed-off-by: Yohanes <CryoThrust@users.noreply.github.com>
@CryoThrust
CryoThrust force-pushed the fix/call-scoped-tool-emitter-callback branch from 8b13987 to 851f165 Compare September 9, 2026 10:21
@CryoThrust

Copy link
Copy Markdown
Contributor Author

Rebased the draft onto the latest upstream main (d20ebbe0) and removed unrelated historical commits from the PR branch. The head is now mergeable. Re-ran Spotless and the focused core tests on the rebased head: 29 tests passed (0 failures, 0 errors). The implementation remains intentionally draft until maintainers confirm the preferred internal execution-context API.

@codecov

codecov Bot commented Sep 9, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 73.07692% with 14 lines in your changes missing coverage. Please review.

Files with missing lines Patch % Lines
...e/src/main/java/io/agentscope/core/ReActAgent.java 67.64% 8 Missing and 3 partials ⚠️
...ain/java/io/agentscope/core/tool/ToolExecutor.java 72.72% 2 Missing and 1 partial ⚠️

📢 Thoughts on this report? Let us know!

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