Skip to content

Honor /compact summary when auto-summarization is disabled#318132

Draft
bhavyaus wants to merge 1 commit into
mainfrom
dev/bhavyau/compact-summary-when-summarization-disabled
Draft

Honor /compact summary when auto-summarization is disabled#318132
bhavyaus wants to merge 1 commit into
mainfrom
dev/bhavyau/compact-summary-when-summarization-disabled

Conversation

@bhavyaus
Copy link
Copy Markdown
Collaborator

Fixes #311503.

Problem

With github.copilot.chat.summarizeAgentConversationHistory.enabled: false, the agent renders conversation history via AgentConversationHistory, which replayed every turn's full tool-call history and never looked at round.summary. So after a manual /compact stored 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 (in chatParticipantRequestHandler.ts) and populates round.summary on historical rounds. Only the summarized renderer honored it.

AgentConversationHistory now:

  1. Finds the most recent summarized round across history.
  2. Drops the turns/rounds it supersedes.
  3. Emits the <conversation-summary> tag in place of that turn's user message.
  4. Replays only the rounds that follow the summary.

This applies an existing summary but never triggers new summarization — automatic summarization stays gated behind the setting.

Scope / risk

  • Single production file changed (agentConversationHistory.tsx); no new props, imports, or exports.
  • The common no-summary path is byte-for-byte unchanged (summaryTurnIndex === -1 short-circuits every new branch).
  • Distinct from Fix stale background compaction across model switches and /compact #317163, whose logic lives entirely behind summarizationEnabled === true and was therefore inert in this disabled-setting scenario.

Validation

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.
Copilot AI review requested due to automatic review settings May 23, 2026 23:06
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

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 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 AgentConversationHistory to 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 /compact summaries 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

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

GitHub Copilog github.copilot.chat.summarizeAgentConversationHistory.enabled: false fills context window in single round.

2 participants