Skip to content

Use max output context for output buffer#322648

Merged
pwang347 merged 20 commits into
mainfrom
pawang/reservedContext
Jun 24, 2026
Merged

Use max output context for output buffer#322648
pwang347 merged 20 commits into
mainfrom
pawang/reservedContext

Conversation

@pwang347

Copy link
Copy Markdown
Member
image

@pwang347 pwang347 requested a review from lramos15 June 24, 2026 00:20
@pwang347 pwang347 marked this pull request as ready for review June 24, 2026 00:21
@lramos15

Copy link
Copy Markdown
Member

Trying to think this through. If the model is a 64k context model and the max output tokens is 32k then if we have a prompt of 40k the buffer should only be rendered as 24k not 32k as otherwise the buffer would exceed max context. If that makes sense?

@pwang347

Copy link
Copy Markdown
Member Author

Trying to think this through. If the model is a 64k context model and the max output tokens is 32k then if we have a prompt of 40k the buffer should only be rendered as 24k not 32k as otherwise the buffer would exceed max context. If that makes sense?

To my knowledge the clamping already happens in

Let me see if I can reproduce it though!

lramos15
lramos15 previously approved these changes Jun 24, 2026
@pwang347

Copy link
Copy Markdown
Member Author
image Looks like this

Base automatically changed from pawang/ahpContext to main June 24, 2026 21:00
@pwang347 pwang347 dismissed lramos15’s stale review June 24, 2026 21:00

The base branch was changed.

Copilot AI review requested due to automatic review settings June 24, 2026 21:09

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

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 updates the chat context-usage UI to compute the “reserved for response” band from the currently selected model’s max output tokens (instead of last-response usage data), and adds instrumentation to help diagnose model-configuration restore behavior during session reloads.

Changes:

  • Derive the output reserve band in the context usage widget from the selected model’s maxOutputTokens.
  • Add ILogService plumbing and troubleshooting logs around restoreModelConfiguration.
  • Thread ILogService into ChatModelConfigurationStore construction from ChatInputPart.
Show a summary per file
File Description
src/vs/workbench/contrib/chat/browser/widgetHosts/viewPane/chatContextUsageWidget.ts Uses selected model metadata (maxOutputTokens) to compute remaining reserved output band.
src/vs/workbench/contrib/chat/browser/widget/input/chatModelConfigurationStore.ts Adds ILogService dependency and logs to diagnose schema availability/filtering during configuration restore.
src/vs/workbench/contrib/chat/browser/widget/input/chatInputPart.ts Passes ILogService into ChatModelConfigurationStore.

Copilot's findings

  • Files reviewed: 3/3 changed files
  • Comments generated: 2

Comment thread src/vs/workbench/contrib/chat/browser/widget/input/chatModelConfigurationStore.ts Outdated
@pwang347 pwang347 enabled auto-merge (squash) June 24, 2026 21:44
@pwang347 pwang347 merged commit fb234de into main Jun 24, 2026
28 checks passed
@pwang347 pwang347 deleted the pawang/reservedContext branch June 24, 2026 21:59
@vs-code-engineering vs-code-engineering Bot added this to the 1.127.0 milestone Jun 24, 2026
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