Skip to content

[dotnet-code] Align compaction equality helpers - #1090

Merged
Quim Muntal (qmuntal) merged 1 commit into
mainfrom
dotnet-code-compaction-equality-20260915223009-f396d162ede52596
Sep 16, 2026
Merged

Quim Muntal (qmuntal) merged 1 commit into
mainfrom
dotnet-code-compaction-equality-20260915223009-f396d162ede52596

Conversation

@michelle-clayton-work

Copy link
Copy Markdown
Contributor

Tip

Your pull request is ready to create! 🎉 ✅

Everything is OK—the changes have been pushed to branch dotnet-code-compaction-equality-20260915223009-f396d162ede52596. Please review the changes, including any protected files, before creating the pull request.

Create the pull request

The original pull request description is below.


Summary

Extracts unexported per-content comparison helpers from agent/compaction/equality.go. This keeps the existing compaction equality behavior while making the Go implementation structurally closer to .NET's ChatMessageContentEquality helper layout for future ports.

.NET Reference

  • dotnet/src/Microsoft.Agents.AI/Compaction/ChatMessageContentEquality.cs - defines per-content comparison helpers used by compaction message matching.

Public API and Behavior

No public Go API changed. No intentional behavior change was made.

Tests

  • go test ./agent/compaction

Notes

Rejected candidates:

  • dotnet/src/Microsoft.Agents.AI.Abstractions/AgentResponse.cs / AgentResponseUpdate.cs - comparable Go response assembly already had aligned behavior; changing update metadata handling would risk observable behavior changes.
  • dotnet/src/Microsoft.Agents.AI.Workflows/MessageMerger.cs - comparable Go workflow merging internals were close, but usage/raw representation parity questions were behavior-affecting rather than safe cleanup.
  • dotnet/src/Microsoft.Agents.AI/Skills/* - inspected as a sampled area from the upstream directory listing, but no safer small cleanup was found before the compaction equality candidate.

The direct upstream git fetch was blocked by the environment, so the .NET reference was inspected through the read-only GitHub bridge after checking local refs.

Closes #1080

Extract unexported content comparison helpers in compaction equality so the Go structure more closely mirrors the .NET ChatMessageContentEquality internals without changing behavior.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Copilot AI lite review requested due to automatic review settings September 16, 2026 18:44
@github-actions github-actions Bot added area:agent Changes files in the agent area size:medium At most 100 changed lines across at most 5 files labels Sep 16, 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.

🟢 Approval recommended

No unresolved issues were identified, and behavior remains unchanged.

Pull request overview

Refactors compaction content equality into focused unexported helpers while preserving behavior and API compatibility.

Changes:

  • Extracted per-content equality helpers.
  • Retained existing comparison logic and recursive behavior.
File summaries
File Description
agent/compaction/equality.go Adds per-content equality helpers used by compaction matching.
Review details
  • Files reviewed: 1/1 changed files
  • Comments generated: 0
  • Review effort level: Lite

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

@github-actions github-actions Bot added the kind:code Changes production behavior or code label Sep 16, 2026
@github-actions

Copy link
Copy Markdown
Contributor

Scope: internal-only

Changed Go contract: None. agent/compaction/equality.go extracts the existing inline per-content comparison logic from contentEqual into new unexported helper functions (textContentEqual, textReasoningContentEqual, dataContentEqual, uriContentEqual, errorContentEqual, functionCallContentEqual, functionResultContentEqual, hostedFileContentEqual). All extracted logic is byte-for-byte identical to the code it replaces; no exported identifiers, signatures, or comparison semantics changed.

Upstream evidence reviewed: dotnet/src/Microsoft.Agents.AI/Compaction/ChatMessageContentEquality.cs (cited in the PR description) uses per-content-type static comparison helpers analogous to the ones now extracted in Go. No behavior-affecting divergence was introduced by this restructuring, so no further upstream comparison was needed.

Result: aligned — this is a pure internal refactor (unexported helper extraction) with no observable behavior change and no public API surface change. No public-api-change label is warranted, and none is currently present. No parity-approved/public-api-change label cleanup was needed since neither is present on the PR.

Generated by Go API Consistency Review Agent for #1090 · copilot · auto · 26.2 AIC · ⌖ 7.49 AIC · ⊞ 9.6K ·

@qmuntal
Quim Muntal (qmuntal) added this pull request to the merge queue Sep 16, 2026
Merged via the queue into main with commit c9acdbc Sep 16, 2026
29 checks passed
@qmuntal
Quim Muntal (qmuntal) deleted the dotnet-code-compaction-equality-20260915223009-f396d162ede52596 branch September 16, 2026 20:45
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 kind:code Changes production behavior or code size:medium At most 100 changed lines across at most 5 files

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[dotnet-code] Align compaction equality helpers

3 participants