Skip to content

[dotnet-port-api] Add compaction-backed history provider #1053

Description

@github-actions

Tip

Your pull request is ready to create! 🎉 ✅

Everything is OK—the changes have been pushed to branch copilot/dotnet-port-api-compaction-history-provider-fdbbd9f2ce32e8b7. 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

Add a compaction-backed history provider in agent/compaction so Go agents can apply reducer-triggered history compaction directly on the history-provider surface instead of only through a separate context provider. The change adds the new provider, covers compacted persistence and summary replay in tests, updates the additional-context sample to use the new API, and refreshes the parity doc to reflect the reduced .NET chat-history gap.

Ported .NET PRs

Breaking Changes

No.

Tests and Examples

  • go test ./agent ./agent/compaction ./examples/02-agents/agents/step17_additional_ai_context
  • Added agent/compaction/historyprovider_test.go
  • Updated examples/02-agents/agents/step17_additional_ai_context/main.go

Notes

  • The live upstream-agent-framework/main fetch was blocked in this environment, so this PR ports the documented chat-history parity gap as a narrow Go realignment instead of tying the change to a freshly inspected upstream PR.
  • Other broader chat-history/storage parity gaps remain out of scope for this PR.

Note

GitHub Actions is not permitted to create or approve pull requests in this repository.

The changes have been pushed to branch copilot/dotnet-port-api-compaction-history-provider-fdbbd9f2ce32e8b7 and are ready to review.

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 (49 of 382 lines)
From 1681aba4204460f1c46f2bd66efdd44915c5e54b Mon Sep 17 00:00:00 2001
X-GH-AW-Base-Commit: de821aaf3899669a99a730f66f25ebad31cba62c
From: "github-actions[bot]" <github-actions[bot]@users.noreply.github.com>
Date: Fri, 11 Sep 2026 05:37:42 +0000
Subject: [PATCH] [dotnet-port-api] Add compaction-backed history provider

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
---
 agent/compaction/doc.go                       |   6 +-
 agent/compaction/historyprovider.go           | 188 ++++++++++++++++++
 agent/compaction/historyprovider_test.go      | 103 ++++++++++
 docs/dotnet-go-sdk-feature-comparison.md      |   2 +-
 .../step17_additional_ai_context/main.go      |  11 +-
 5 files changed, 305 insertions(+), 5 deletions(-)
 create mode 100644 agent/compaction/historyprovider.go
 create mode 100644 agent/compaction/historyprovider_test.go

diff --git a/agent/compaction/doc.go b/agent/compaction/doc.go
index d4280fe..6b4abab 100644
--- a/agent/compaction/doc.go
+++ b/agent/compaction/doc.go
@@ -1,7 +1,7 @@
 // Copyright (c) Microsoft. All rights reserved.
 
 // Package compaction reduces conversation history to fit a model's context
-// window. It provides a context provider and composable strategies — sliding
-// window, truncation, summarization, tool-result eviction, and context-window
-// sizing — selected by triggers evaluated over a message index.
+// window. It provides history and context providers plus composable strategies
+// — sliding window, truncation, summarization, tool-result eviction, and
+// context-window sizing — selected by triggers evaluated over a message index.
 package compaction
diff --git a/agent/compaction/historyprovider.go b/agent/compaction/historyprovider.go
new file mode 100644
index 0000000..7fcc9db
--- /dev/null
+++ b/agent/compaction/historyprovider.go
@@ -0,0 +1,188 @@
+// Copyright (c) Microsoft. All rights reserved.
+
+package compaction
+
+import (
+	"cmp"
+	"context"
+	"log/slog"
+	"runtime"
+	"slices"
+	"sync
... (truncated)

Warning

Firewall blocked 1 domain

The following domain was blocked by the firewall during workflow execution:

  • github.com

To allow these domains, add them to the network.allowed list in your workflow frontmatter:

network:
  allowed:
    - defaults
    - "github.com"

See Network Configuration for more information.

Generated by .NET to Go API Porting Agent · copilot · gpt54 · 187.4 AIC · ⌖ 10.6 AIC · ⊞ 19K ·

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions