Avoid messages for response-only updates - #1127
Kirill (llirik0) wants to merge 1 commit into
Conversation
This comment has been minimized.
This comment has been minimized.
@microsoft-github-policy-service agree |
There was a problem hiding this comment.
Copilot review overview
🟡 Changes recommended
Message-only metadata can be lost during response round trips.
Get a fresh assessment by requesting another Copilot review.
Review effort: Lite
Findings: 1
What changed in this PR
Prevents response-only metadata updates from creating empty assistant messages during response round trips.
Changes:
- Gates message mutation on message-related update fields.
- Adds metadata round-trip tests.
| File | Description |
|---|---|
agent/response.go |
Updates response aggregation behavior. |
agent/response_test.go |
Tests metadata-only round trips. |
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
|
Scope: user-visible behavior Changed Go contract: Upstream evidence reviewed:
Result: aligned. Go's new guard in
|
There was a problem hiding this comment.
Copilot review overview
🟡 Changes recommended
Metadata-only updates can still produce empty assistant messages during collection; the agent-level path needs correction and regression coverage.
Get a fresh assessment by requesting another Copilot review.
Review effort: Lite
Findings: 1
Resolved since last review (1)
|
Reviewed this closely since it touches the same Composition with #1133 (worth the maintainers knowing before merge order is decided). #1133 scopes
So they dont conflict, but whichever merges second will want a trivial rebase in the same block. No action needed here beyond awareness. Question — Question — the Nothing blocking from my perspective — the direction is correct and well-tested. 👍 |
2c0b680 to
fd164b1
Compare
fd164b1 to
8669b06
Compare

Summary
Prevent response-level metadata updates from creating empty assistant messages when updates are collected into a
Response.Agent.setAuthornow decorates only updates that are already message-bearing. AG-UI, A2A, and OpenAI lifecycle updates no longer assign a message role when they contain no message ID or content.Response.Updatealso treats raw-only provider events as response metadata rather than messages. Raw payloads remain available on the response and are still copied to genuine message updates identified by message ID, role, author, or content.Response.ToUpdatescontinues to preserve metadata-onlyMessageobjects, including messages containing only additional properties, timestamps, or a raw representation.Regression coverage exercises the real agent collection path plus OpenAI background polling and streaming, AG-UI lifecycle/message-snapshot metadata, A2A task/status lifecycle events, raw-only lifecycle updates, and metadata-only message round trips.
Interaction with #1133
These changes are complementary, but both PRs modify
Response.Update. When resolving the merge order, message-scoped additional properties must use the same message-bearing discriminator rather thanMessageIDalone; otherwise metadata-only messages and AG-UI message snapshots would lose their message-scoped properties.Testing
go test ./...go test -race ./...go vet ./...go run github.com/golangci/golangci-lint/v2/cmd/golangci-lint@latest run(0 issues)git diff --check upstream/main