Skip to content

fix(agui): emit frontend tool args from fragment deltas - #2874

Merged
jujn merged 3 commits into
agentscope-ai:mainfrom
dragondyt:fix/agui-frontend-tool-fragment-args
Aug 30, 2026
Merged

fix(agui): emit frontend tool args from fragment deltas#2874
jujn merged 3 commits into
agentscope-ai:mainfrom
dragondyt:fix/agui-frontend-tool-fragment-args

Conversation

@dragondyt

Copy link
Copy Markdown
Contributor

Related issues

Summary

  • Record the real tool name on ToolCallStart and match frontend tools by toolCallId.
  • Emit TOOL_CALL_ARGS for frontend tools even when streamed deltas use __fragment__.
  • Keep backend tool args hidden when emitToolCallArgs is false.
  • Add unit coverage for frontend and backend fragment deltas.

Breaking Changes

None.

…i#2873)

Streaming tool-call chunks use a placeholder name, so frontend-tool matching must use the real name recorded on ToolCallStart.
@codecov

codecov Bot commented Aug 28, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 92.00000% with 2 lines in your changes missing coverage. Please review.

Files with missing lines Patch % Lines
.../core/agui/adapter/strategy/AguiStreamContext.java 88.23% 0 Missing and 2 partials ⚠️

📢 Thoughts on this report? Let us know!

@dragondyt

Copy link
Copy Markdown
Contributor Author

CI失败与本次提交无关

@Aias00 Aias00 left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Matches #2873 exactly: the real tool name is captured on ToolCallStart and the frontend-tool decision is made from toolCallId instead of the __fragment__ placeholder, so frontend tools keep receiving TOOL_CALL_ARGS while backend tools stay hidden under emitToolCallArgs=false.

Deliberate details I checked and like:

  • The raw (pre-normalisation) name is stored, so matching is against what the client actually declared in RunAgentInput.tools.
  • Collectors.toSet() rather than toUnmodifiableSet() — the latter would NPE on a null AguiTool.name.
  • isFrontendToolCall degrades to false when the start event was never seen, so the previous opt-in behaviour is preserved.

Tests cover both directions (frontend emits, backend does not) with the exact placeholder-name stream from the issue.

Note on CI: the build (windows-latest) failure is unrelated — it is SessionEventLogCrossProcessTest.subscribeAfterCursorSkipsEarlierEvents in service-common failing with a Reactor OverflowException from interval backpressure, a known Windows timing flake.

One non-blocking nit inline about pruning the new map. Approving.

@jujn
jujn merged commit 0dbb043 into agentscope-ai:main Aug 30, 2026
6 checks passed
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.

[Bug]: AG-UI frontend tools miss TOOL_CALL_ARGS when streamed name is __fragment__

3 participants