Fix Coalesce godoc: call-ID results merge regardless of position - #1147
PratikDhanave (PratikDhanave) wants to merge 1 commit into
Conversation
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.
There was a problem hiding this comment.
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
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.Coalescebehavior. - Clarifies delegated
agent.Response.Coalescebehavior. - 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.
|
|
||
| // 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). |
| // 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 |
|
Scope: internal-only (docs/comments) 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
|

Both
message.Contents.Coalesceandagent.Response.Coalesce(which delegates to it) documented combining only adjacent compatible content elements. That is accurate for the generic text/reasoning/data runs, butcoalesceImageGenerationToolResultsandcoalesceWebSearchToolCallskey byCallID(indexByCallID) and fold matching results anywhere in the slice — not only when adjacent.Comment-only fix clarifying the actual behavior.