Skip to content

Fix Coalesce godoc: call-ID results merge regardless of position - #1147

Open
PratikDhanave (PratikDhanave) wants to merge 1 commit into
microsoft:mainfrom
PratikDhanaveFork:fix/godoc-coalesce-not-adjacent-only
Open

PratikDhanave (PratikDhanave) wants to merge 1 commit into
microsoft:mainfrom
PratikDhanaveFork:fix/godoc-coalesce-not-adjacent-only

Conversation

@PratikDhanave

Copy link
Copy Markdown
Contributor

Both message.Contents.Coalesce and agent.Response.Coalesce (which delegates to it) documented combining only adjacent compatible content elements. That is accurate for the generic text/reasoning/data runs, but coalesceImageGenerationToolResults and coalesceWebSearchToolCalls key by CallID (indexByCallID) and fold matching results anywhere in the slice — not only when adjacent.

Comment-only fix clarifying the actual behavior.

Contents.Coalesce (and Response.Coalesce, which delegates to it) documented
combining only "adjacent" compatible elements, but the image-generation and
web-search coalescers key by call ID and fold matching results anywhere in the
slice, not just adjacent ones. Clarify the wording.
Copilot AI lite review requested due to automatic review settings September 22, 2026 03:12
@github-actions github-actions Bot added area:agent Changes files in the agent area area:message Changes files in the message area size:small At most 30 changed lines across at most 2 files labels Sep 22, 2026

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.

Copilot review overview

🟡 Changes recommended

Address the terminology nits in both godoc comments.

Get a fresh assessment by requesting another Copilot review.

Review effort: Lite
Findings: 2 Low severity

Open (2)
What changed in this PR

Updates Coalesce godoc to accurately describe adjacent merging and call-ID-based merging across positions.

Changes:

  • Clarifies message.Contents.Coalesce behavior.
  • Clarifies delegated agent.Response.Coalesce behavior.
  • Distinguishes web-search calls from image-generation results.
File Summary
message/​content.go Documents adjacent and call-ID-based coalescing; clarifies web-search call terminology.
agent/​response.go Updates delegated coalescing documentation and distinguishes web-search calls from image-generation results.

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

Comment thread agent/response.go

// Coalesce merges adjacent compatible content items within each message.
// Coalesce merges compatible content items within each message (adjacent
// text/reasoning/data runs, and call-ID-keyed results regardless of position).
Comment thread message/content.go
// resulting slice. It may reuse and modify the receiver's backing array.
// Coalesce combines compatible content elements and returns the resulting
// slice: adjacent runs of text, reasoning, and data content, plus
// image-generation and web-search results that share a call ID regardless of
@github-actions

Copy link
Copy Markdown
Contributor

Scope: internal-only (docs/comments)
Changed Go contract: None — no exported API, signature, or runtime behavior changed; only godoc comments on message.Contents.Coalesce and agent.Response.Coalesce were reworded to accurately describe existing merge behavior (call-ID-keyed folding is position-independent, unlike the adjacent-only text/reasoning/data runs).
Upstream evidence reviewed: Not applicable — this is a Go-only documentation correction of already-existing behavior; no new capability or semantic change was introduced to compare against dotnet/src/Microsoft.Agents.AI/ or python/packages/core/agent_framework/.
Result: out of scope

This PR only clarifies comment wording to match pre-existing, unchanged behavior. Per review guidelines, comment-wording-only changes with no exported API or observable behavior change are explicitly out of scope for parity review, and no public-api-change label is warranted.

Generated by Go API Consistency Review Agent · copilot · auto · 16.2 AIC · ⌖ 5.99 AIC · ⊞ 9.2K ·

@github-actions github-actions Bot added the kind:docs Changes documentation or comments label Sep 22, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area:agent Changes files in the agent area area:message Changes files in the message area kind:docs Changes documentation or comments size:small At most 30 changed lines across at most 2 files

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants