Skip to content

[dotnet-port-fixes] Align compaction summary marker handling #487

Description

@github-actions

Summary

Align Go compaction summary detection with the upstream .NET fix for _is_summary metadata by accepting both native bool values and raw JSON boolean tokens when grouping assistant messages. Added parity tests that keep missing, false, null, and string token values as assistant text while recognizing true in both native and raw-token forms.

Upstream reference:

Ported .NET PRs

Breaking Changes

No.

Tests and Examples

  • go test ./agent/compaction
  • Added TestMessageIndex_SummaryPropertyKeyIsRespected
  • No examples changed

Notes

Skipped broader recent upstream compaction/workflow changes because they were either already tracked in Go porting work or were larger than the narrow nightly PR target. This change is internal-only and does not modify exported Go symbols.

Generated by .NET to Go Fixes and Test Porting Agent · 939.3 AIC · ⌖ 31.2 AIC · ⊞ 21.7K ·


Note

This was originally intended as a pull request, but GitHub Actions is not permitted to create or approve pull requests in this repository.
The changes have been pushed to branch dotnet-port/compaction-summary-marker-67b325fede384a29.

Click here to create the pull request

To fix the permissions issue, go to SettingsActionsGeneral and enable Allow GitHub Actions to create and approve pull requests. See also: gh-aw FAQ

Show patch preview (104 of 104 lines)
From cb202eef1c53337e205d2995eb9716f5f5b2d472 Mon Sep 17 00:00:00 2001
From: "github-actions[bot]" <github-actions[bot]@users.noreply.github.com>
Date: Tue, 14 Jul 2026 03:39:56 +0000
Subject: [PATCH] [dotnet-port-fixes] Align compaction summary marker handling

Support raw JSON _is_summary values in compaction message grouping and add parity tests for bool and raw-token cases.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
---
 agent/compaction/compaction_test.go | 36 +++++++++++++++++++++++++++++
 agent/compaction/index.go           | 23 +++++++++++++++---
 2 files changed, 56 insertions(+), 3 deletions(-)

diff --git a/agent/compaction/compaction_test.go b/agent/compaction/compaction_test.go
index c98628543..b5cd613b1 100644
--- a/agent/compaction/compaction_test.go
+++ b/agent/compaction/compaction_test.go
@@ -67,6 +67,42 @@ func TestMessageIndex_GroupsToolCallsAtomically(t *testing.T) {
 	}
 }
 
+func TestMessageIndex_SummaryPropertyKeyIsRespected(t *testing.T) {
+	tests := []struct {
+		name     string
+		value    any
+		expected compaction.GroupKind
+	}{
+		{name: "missing", expected: compaction.GroupKindAssistantText},
+		{name: "bool false", value: false, expected: compaction.GroupKindAssistantText},
+		{name: "raw false", value: json.RawMessage(`false`), expected: compaction.GroupKindAssistantText},
+		{name: "raw null", value: json.RawMessage(`null`), expected: compaction.GroupKindAssistantText},
+		{name: "raw string", value: json.RawMessage(`"Unexpected string"`), expected: compaction.GroupKindAssistantText},
+		{name: "bool true", value: true, expected: compaction.GroupKindSummary},
+		{name: "raw true", value: json.RawMessage(`true`), expected: compaction.GroupKindSummary},
+	}
+
+	for _, tt := range tests {
+		t.Run(tt.name, func(t *testing.T) {
+			msg := textMessage(message.RoleAssistant, "Hello")
+			if tt.name != "missing" {
+				msg.AdditionalProperties = map[string]any{
+					"_is_summary": tt.value,
+				}
+			}
+
+			in
... (truncated)

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions