Skip to content

Fix enableThinking mismatch causing inline summarization cache misses#311851

Merged
bhavyaus merged 1 commit intomainfrom
dev/bhavyau/fix-inline-summarization-thinking-cache
Apr 22, 2026
Merged

Fix enableThinking mismatch causing inline summarization cache misses#311851
bhavyaus merged 1 commit intomainfrom
dev/bhavyau/fix-inline-summarization-thinking-cache

Conversation

@bhavyaus
Copy link
Copy Markdown
Collaborator

@bhavyaus bhavyaus commented Apr 22, 2026

The inline summarization path computed enableThinking differently from the main agent loop (toolCallingLoop.ts). For Anthropic on non-continuation turns, the old logic (!isAnthropicFamily || messagesContainThinking) would set enableThinking=false when no thinking blocks existed yet, while the main agent always kept it true. Per Anthropic docs, changing thinking parameters invalidates the message cache — causing 0% cache hits on summarization requests.

Fix: mirror the main loop's shouldDisableThinking = isContinuation && isAnthropicFamily && !messagesContainThinking logic exactly.

cc: @kevin-m-kent who tracked down this issue! 🙏

The inline summarization path computed enableThinking differently from
the main agent loop in toolCallingLoop.ts. For Anthropic on non-continuation
turns without thinking blocks yet, the old logic set enableThinking=false
while the main agent kept it true. This thinking parameter mismatch
invalidated the Anthropic message cache, causing 0% cache hit rate on
inline summarization requests.

Align with the main loop: only disable thinking on continuation turns
for Anthropic when no thinking blocks exist in messages.
Copilot AI review requested due to automatic review settings April 22, 2026 06:36
@bhavyaus bhavyaus enabled auto-merge (squash) April 22, 2026 06:37
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 prompt-cache miss issue in the inline/background summarization path by aligning Anthropic enableThinking computation with the main agent tool-calling loop, preventing “thinking parameter” changes that invalidate Anthropic’s message cache.

Changes:

  • Introduce shouldDisableThinking in the inline summarization capability-caching path.
  • Set enableThinking to !shouldDisableThinking, matching ToolCallingLoop.runOne() behavior (disable only on Anthropic continuation turns when no thinking blocks exist yet).
Show a summary per file
File Description
extensions/copilot/src/extension/intents/node/agentIntent.ts Mirrors ToolCallingLoop.runOne() thinking enablement logic when caching model capabilities for inline/background summarization to preserve Anthropic prompt-cache parity.

Copilot's findings

  • Files reviewed: 1/1 changed files
  • Comments generated: 0

@github-actions
Copy link
Copy Markdown
Contributor

Screenshot Changes

Base: bbae0cb3 Current: 90025703

Changed (4)

chat/aiCustomizations/aiCustomizationManagementEditor/McpBrowseMode/Dark
Before After
before after
chat/aiCustomizations/aiCustomizationManagementEditor/McpBrowseMode/Light
Before After
before after
agentSessionsViewer/CompletedUnread/Dark
Before After
before after
agentSessionsViewer/CompletedUnread/Light
Before After
before after

@bhavyaus bhavyaus merged commit 1bca40e into main Apr 22, 2026
30 checks passed
@bhavyaus bhavyaus deleted the dev/bhavyau/fix-inline-summarization-thinking-cache branch April 22, 2026 06:58
@vs-code-engineering vs-code-engineering Bot added this to the 1.118.0 milestone Apr 22, 2026
@isidorn
Copy link
Copy Markdown
Collaborator

isidorn commented Apr 22, 2026

@bhavyaus thank you very much for fixing this one 🙏 Super impactful!

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.

4 participants