Honor /compact summary when auto-summarization is disabled#318132
Draft
bhavyaus wants to merge 1 commit into
Draft
Honor /compact summary when auto-summarization is disabled#318132bhavyaus wants to merge 1 commit into
bhavyaus wants to merge 1 commit into
Conversation
Fixes #311503. With chat.summarizeAgentConversationHistory.enabled=false the agent renders history via AgentConversationHistory, which replayed every turn's full tool-call history and ignored round.summary. After a manual /compact, the next turn rebuilt the entire pre-compaction context and the context window immediately refilled. AgentConversationHistory now finds the most recent summarized round (populated by normalizeSummariesOnRounds), drops the history it supersedes, emits the <conversation-summary> tag in place of that turn's user message, and replays only the rounds after the summary. This applies an existing summary but never triggers new summarization, which stays gated behind the setting. The no-summary path is unchanged.
Contributor
There was a problem hiding this comment.
Pull request overview
This PR fixes a regression where manual /compact summaries were ignored when github.copilot.chat.summarizeAgentConversationHistory.enabled is disabled, causing the full pre-compaction tool-call history to be replayed and the context meter to immediately refill. It updates the non-summarizing history renderer to honor existing round.summary values (populated by normalizeSummariesOnRounds) by dropping superseded history and replaying only the rounds that follow the summary.
Changes:
- Update
AgentConversationHistoryto detect the most recent summarized round, omit superseded turns/rounds, and render a<conversation-summary>tag in the prompt. - Add a regression test ensuring manual
/compactsummaries are applied even when automatic summarization is disabled.
Show a summary per file
| File | Description |
|---|---|
extensions/copilot/src/extension/prompts/node/agent/agentConversationHistory.tsx |
Honors existing round.summary when rendering history with summarization disabled by dropping superseded history and emitting a <conversation-summary> tag. |
extensions/copilot/src/extension/prompts/node/agent/test/summarization.spec.tsx |
Adds a regression test covering the “manual /compact summary honored when summarization is disabled” scenario (#311503). |
Copilot's findings
- Files reviewed: 2/2 changed files
- Comments generated: 0
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #311503.
Problem
With
github.copilot.chat.summarizeAgentConversationHistory.enabled: false, the agent renders conversation history viaAgentConversationHistory, which replayed every turn's full tool-call history and never looked atround.summary. So after a manual/compactstored a summary, the next turn rebuilt the entire pre-compaction context and the context window meter immediately went red again.Repro: disable the setting → fill the context →
/compact(meter empties) → send another prompt → meter full again.Fix
The summary data is already available:
normalizeSummariesOnRounds()runs on every request (inchatParticipantRequestHandler.ts) and populatesround.summaryon historical rounds. Only the summarized renderer honored it.AgentConversationHistorynow:<conversation-summary>tag in place of that turn's user message.This applies an existing summary but never triggers new summarization — automatic summarization stays gated behind the setting.
Scope / risk
agentConversationHistory.tsx); no new props, imports, or exports.summaryTurnIndex === -1short-circuits every new branch).summarizationEnabled === trueand was therefore inert in this disabled-setting scenario.Validation
chatSessions/errors).summarization.spec.tsx: 35/35 pass, including a new regression test for GitHub Copiloggithub.copilot.chat.summarizeAgentConversationHistory.enabled: falsefills context window in single round. #311503.agentPrompt.spec.tsx: 165/165 pass.