Skip to content

Surface AG-UI MESSAGES_SNAPSHOT events as metadata instead of dropping them - #725

Merged
George Adams (gdams) merged 1 commit into
microsoft:mainfrom
PratikDhanaveFork:surface-messages-snapshot-metadata
Jul 29, 2026
Merged

Surface AG-UI MESSAGES_SNAPSHOT events as metadata instead of dropping them#725
George Adams (gdams) merged 1 commit into
microsoft:mainfrom
PratikDhanaveFork:surface-messages-snapshot-metadata

Conversation

@PratikDhanave

Copy link
Copy Markdown
Contributor

What

onEvent in provider/aguiprovider/agui.go switched over StateSnapshotEvent and StateDeltaEvent and then hit default: return nil, nil. There was no case *aguiEvents.MessagesSnapshotEvent. The vendored AG-UI SDK decodes MESSAGES_SNAPSHOT into a distinct typed *MessagesSnapshotEvent{ *BaseEvent; Messages []Message } and feeds it to onEvent, so every MESSAGES_SNAPSHOT frame reached the default branch and was silently discarded.

This adds a case *aguiEvents.MessagesSnapshotEvent that emits a single assistant *agent.ResponseUpdate with CreatedAt: eventTime(evt) and the snapshot exposed under AdditionalProperties["agui_messages_snapshot"].

Why

MESSAGES_SNAPSHOT is a first-class AG-UI event that lets a server re-sync the full conversation history to the client. Dropping it means consumers lose that history-continuity signal entirely. The metadata-surfacing form is the lowest-risk mapping and matches how RunStarted metadata and the state snapshot/delta events are already surfaced instead of dropped, keeping consistent behavior across the provider's event handling. Surfacing the snapshot as provider-specific metadata (rather than fabricating message content) aligns with the .NET/Python AG-UI clients, which expose the snapshot to callers rather than discarding it.

Testing

Added TestAGUIAgentRun_SurfacesMessagesSnapshotEvent to agui_test.go (parallel to the existing state-snapshot test): it streams a NewMessagesSnapshotEvent with one message during a run and asserts a collected message carries AdditionalProperties["agui_messages_snapshot"] holding that message list. The test fails before the change (the frame yields no such update) and passes after. go build ./..., go vet ./provider/aguiprovider/..., and go test ./provider/aguiprovider/... all pass.

Copilot AI review requested due to automatic review settings July 24, 2026 03:20
@PratikDhanave
PratikDhanave (PratikDhanave) requested a review from a team as a code owner July 24, 2026 03:20

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

This PR updates the AG-UI provider’s event handling so MESSAGES_SNAPSHOT frames are no longer silently dropped, and instead are surfaced to consumers as provider-specific metadata on a streamed agent.ResponseUpdate.

Changes:

  • Handle *aguiEvents.MessagesSnapshotEvent in toolCallAccumulator.onEvent and emit an assistant ResponseUpdate containing AdditionalProperties["agui_messages_snapshot"].
  • Add a regression test that streams a NewMessagesSnapshotEvent and asserts the snapshot is present in collected message metadata.

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated no comments.

File Description
provider/aguiprovider/agui.go Adds a MessagesSnapshotEvent case that returns a metadata-only ResponseUpdate instead of falling through to the default drop path.
provider/aguiprovider/agui_test.go Adds a test ensuring agui_messages_snapshot metadata is preserved in the collected response when the event is streamed.

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

@github-actions

This comment has been minimized.

The AG-UI SSE decoder produces a typed *MessagesSnapshotEvent for
MESSAGES_SNAPSHOT frames, but onEvent had no case for it, so these
frames fell through to the default branch and were silently dropped.

Add a case that emits an assistant ResponseUpdate carrying the message
list under AdditionalProperties[agui_messages_snapshot], mirroring the
surface-instead-of-drop pattern already used for RunStarted metadata and
state snapshot/delta events.
@PratikDhanave
PratikDhanave (PratikDhanave) force-pushed the surface-messages-snapshot-metadata branch from 62a8f61 to cb26f02 Compare July 24, 2026 09:30
@github-actions

Copy link
Copy Markdown
Contributor

Parity Review: ✅ Approved

This PR fixes a silent event-discard bug in the AG-UI provider by handling MessagesSnapshotEvent that previously fell through to default: return nil, nil.

Scope check: Both changed files are in provider/aguiprovider/ — an internal implementation detail. No exported Go types, functions, methods, or option structs were added or changed. The fix surfaces data through the existing AdditionalProperties mechanism already used by RunStartedEvent, StateSnapshotEvent, and StateDeltaEvent handling in the same file.

Cross-repo parity: The upstream Python AG-UI package (python/packages/ag-ui/) is the producer of MESSAGES_SNAPSHOT events. The Go aguiprovider is a consumer. Surfacing the event as AdditionalProperties["agui_messages_snapshot"] rather than silently discarding it matches the intent: callers that care about history continuity can read it. This is consistent with the metadata-surfacing pattern the provider already uses for other AG-UI-specific events.

No public API change: The fix is confined to the unexported onEvent method on the unexported toolCallAccumulator type. No public-api-change label is warranted.

Verdict: The change preserves cross-repo semantic alignment and does not introduce divergence from .NET or Python behavior.

Warning

Firewall blocked 1 domain

The following domain was blocked by the firewall during workflow execution:

  • awmgmcpg

To allow these domains, add them to the network.allowed list in your workflow frontmatter:

network:
  allowed:
    - defaults
    - "awmgmcpg"

See Network Configuration for more information.

Generated by Go API Consistency Review Agent · 35.1 AIC · ⌖ 3.99 AIC · ⊞ 5.9K ·

@github-actions github-actions Bot added the parity-approved Go API consistency review found no parity issues label Jul 24, 2026
@gdams
George Adams (gdams) added this pull request to the merge queue Jul 29, 2026
Merged via the queue into microsoft:main with commit cdafa55 Jul 29, 2026
20 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

parity-approved Go API consistency review found no parity issues

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants