Skip to content

[dotnet-port] fix(agui): avoid tool result message ID collisions with streaming text messages - #193

Merged
qmuntal merged 1 commit into
mainfrom
dotnet-port/agui-tool-result-message-id-5800-8c6a7fe5d95d95b3
May 18, 2026
Merged

[dotnet-port] fix(agui): avoid tool result message ID collisions with streaming text messages#193
qmuntal merged 1 commit into
mainfrom
dotnet-port/agui-tool-result-message-id-5800-8c6a7fe5d95d95b3

Conversation

@qmuntal

@qmuntal qmuntal commented May 18, 2026

Copy link
Copy Markdown
Member

Port of microsoft/agent-framework#5800.

Tool result events (ToolCallResult) must not share the same message ID as the preceding streaming text/tool-call message. When an update contains FunctionResultContent, generate a fresh message ID for the tool result rather than reusing the update's msgID. This prevents AG-UI clients from incorrectly associating tool results with the wrong parent message.

…t messages

Port of microsoft/agent-framework#5800.

Tool result events (ToolCallResult) must not share the same message ID as
the preceding streaming text/tool-call message. When an update contains
FunctionResultContent, generate a fresh message ID for the tool result
rather than reusing the update's msgID. This prevents AG-UI clients from
incorrectly associating tool results with the wrong parent message.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Copilot AI review requested due to automatic review settings May 18, 2026 08:36
@qmuntal
qmuntal requested a review from a team as a code owner May 18, 2026 08:36

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Pull request overview

Ports a .NET fix (microsoft/agent-framework#5800) to ensure AG-UI tool result events get a distinct message ID from the preceding streaming text/tool-call message, preventing clients from associating tool results with the wrong parent message.

Changes:

  • Generate a fresh toolResultMsgID when an update contains FunctionResultContent and route only those content items through it.
  • Adds helper hasFunctionResultContent and a test verifying that TOOL_CALL_RESULT events use a different message ID than TEXT_MESSAGE_START.
Show a summary per file
File Description
agent/hosting/aguihosting/events.go Allocates a separate message ID for FunctionResultContent items within an update; adds hasFunctionResultContent helper.
agent/hosting/aguihosting/agui_test.go Adds test asserting tool result message ID differs from the streaming text message ID.

Copilot's findings

Tip

Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

  • Files reviewed: 2/2 changed files
  • Comments generated: 0

@qmuntal
qmuntal enabled auto-merge (squash) May 18, 2026 08:41
@qmuntal
qmuntal merged commit 233ab52 into main May 18, 2026
19 checks passed
@qmuntal
qmuntal deleted the dotnet-port/agui-tool-result-message-id-5800-8c6a7fe5d95d95b3 branch May 18, 2026 08:42
@github-actions

Copy link
Copy Markdown
Contributor

Cross-repo parity review ✅

This PR is a port of the .NET fix in microsoft/agent-framework#5800 and preserves semantic parity across all three SDK implementations:

  • .NET: The upstream fix generates a distinct fallback message ID for tool-result-only updates (merged in #5800).
  • Python (python/packages/ag-ui/agent_framework_ag_ui/_agent_run.py): ToolCallResultEvent already calls generate_event_id() for each tool result — inherently distinct from the assistant text/tool-call message ID.
  • Go (this PR): Mirrors the same behavior by calling aguiEvents.GenerateMessageID() whenever FunctionResultContent is present.

No parity issues found. The change is internal to the AG-UI hosting adapter and does not affect any exported public API surface.

Generated by Go API Consistency Review Agent for issue #193 · ● 696.7K ·

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.

[dotnet-port] fix(agui): avoid tool result message ID collisions with streaming text messages

3 participants