Skip to content

[dotnet-code] Consolidate compaction group predicates - #829

Open
Michelle Clayton (michelle-clayton-work) wants to merge 1 commit into
mainfrom
dotnet-code/compaction-group-predicates-8f07de7294789c4f
Open

[dotnet-code] Consolidate compaction group predicates#829
Michelle Clayton (michelle-clayton-work) wants to merge 1 commit into
mainfrom
dotnet-code/compaction-group-predicates-8f07de7294789c4f

Conversation

@michelle-clayton-work

Copy link
Copy Markdown
Contributor

Summary

Consolidated repeated compaction group predicates into unexported MessageGroup helpers. This keeps the Go MessageIndex aggregation paths closer to the .NET CompactionMessageIndex predicate shape while preserving existing behavior and avoiding public API changes.

.NET Reference

  • dotnet/src/Microsoft.Agents.AI/Compaction/CompactionMessageGroup.cs - group state such as IsExcluded and summary classification metadata.
  • dotnet/src/Microsoft.Agents.AI/Compaction/CompactionMessageIndex.cs - index aggregation predicates over included and raw/non-summary groups.

Public API and Behavior

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

Tests

  • go test ./agent/compaction

Notes

Rejected candidates from the random .NET sample:

  • dotnet/src/Microsoft.Agents.AI.Workflows/ProtocolBuilder.cs maps to public Go protocol builder behavior, so cleanup risked API-facing churn.
  • dotnet/src/Microsoft.Agents.AI.Workflows/Checkpointing/EdgeInfo.cs maps to public Go checkpoint edge metadata with different serialization constraints, so no safe tiny internal-only change was obvious.
  • dotnet/src/Microsoft.Agents.AI.Workflows/RequestInfoEvent.cs already has a minimal direct Go counterpart, so there was no meaningful structural cleanup to make.

Generated by .NET-to-Go Code Portability Refactoring Agent · gpt55 · 89.3 AIC · ⌖ 16.9 AIC · ⊞ 23.2K ·

Closes #821

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>

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 refactors the Go compaction MessageIndex aggregation logic by consolidating repeated compaction-group predicates into unexported MessageGroup helper methods, aligning the predicate “shape” more closely with the referenced .NET implementation while preserving existing behavior and avoiding public API changes.

Changes:

  • Added MessageGroup.isIncluded() and MessageGroup.isRaw() helper predicates.
  • Updated MessageIndex aggregation methods to use these helpers instead of repeating inline conditions.

Reviewed changes

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

File Description
agent/compaction/group.go Introduces unexported predicate helpers (isIncluded, isRaw) and refactors isIncludedNonSystem to reuse them.
agent/compaction/index.go Replaces repeated inline predicates with the new MessageGroup helper methods across included/raw aggregation paths.

💡 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 parity-approved Go API consistency review found no parity issues label Aug 12, 2026
@github-actions

Copy link
Copy Markdown
Contributor

Parity Review: ✅ No Issues

This PR consolidates repeated compaction group predicates into unexported helper methods (isIncluded(), isRaw()) on the internal MessageGroup type. No exported Go APIs changed, and no user-visible behavior was altered.

Scope assessment: Internal refactor only. Changed files:

  • agent/compaction/group.go — new unexported methods isIncluded() and isRaw()
  • agent/compaction/index.go — call sites updated to use new helpers (no logic change)

Cross-repo parity: The refactor is explicitly modeled after the .NET CompactionMessageGroup.IsExcluded / CompactionMessageIndex predicate patterns referenced in the PR description. The Go implementation remains semantically aligned with the upstream .NET counterparts. No Python equivalent of this low-level compaction index predicate is expected.

Label actions: parity-approved added. public-api-change not added (no exported API change).

Generated by Go API Consistency Review Agent for #829 · sonnet46 · 15.2 AIC · ⌖ 5.63 AIC · ⊞ 5.7K ·

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.

[dotnet-code] Consolidate compaction group predicates

2 participants