Skip to content

Copilot Chat local models do not populate Context Window usage even when backend usage and model limits are available #313458

Description

Copilot Chat version

0.47.2026042905

VS Code version

1.119.0-insider

OS

Windows 11 Pro 25H2

Regression?

Unknown

Problem description

GitHub Copilot Chat in Visual Studio Code (VS Code) can successfully use local models through the built-in ollama and customoai providers, but the Context Window usage area stays empty.

The visible behavior is:

  • chat requests succeed
  • the local model replies normally
  • the model limit is shown in the Context Window area
  • but the used-context ring/graph stays gray and the tooltip remains at 0 / <max tokens>

On my machine, one tested example showed 0 / 294K tokens for a working local chat session.

Why I believe this is a real product bug and not just a backend quirk

I am routing the model through a local compatibility proxy so I can control the transport behavior precisely.

That proxy can emit final streamed usage in an OpenAI-compatible shape, including:

  • prompt_tokens
  • completion_tokens
  • total_tokens

The local model configuration also provides token-window metadata such as:

  • maxInputTokens
  • maxOutputTokens

So the backend-side ingredients appear to exist, and the user interface (UI) already knows the maximum context size. The missing part seems to be the path that should carry usage into the chat response model that drives the Context Window widget.

Reproduction steps

  1. Configure a local model for Copilot Chat using either:
    • the built-in customoai provider with an OpenAI-compatible endpoint, or
    • the built-in ollama provider backed by a local server or proxy.
  2. Make sure the configured model has valid context-window metadata such as maxInputTokens and maxOutputTokens.
  3. Start a new Copilot Chat session with that local model.
  4. Send a prompt that clearly consumes non-trivial context.
  5. Open or inspect the Context Window usage area.

Expected behavior

The Context Window usage area should show non-zero usage for the request, similar to hosted models, once a reply has completed and usage information is available.

Actual behavior

The Context Window usage area remains empty / gray, and the tooltip stays at 0 / <max tokens> even though the chat response completed successfully.

Additional technical notes

I looked through the public source and found a few things that may help narrow the issue:

  • the widget appears to render from chat response usage plus model token limits
  • local models do appear to have model-limit metadata available
  • the transport side can produce final usage information
  • the likely gap appears to be in how local language-model-provider results flow into the chat response usage model

I also tried a machine-local unsupported experiment patching the installed runtime to preserve provider result metadata through both worker-based and node-based language-model bridges. That did not make the widget light up, which suggests the missing seam may be deeper than a single dropped completion result, or that the active local-model response object still never receives the usage payload expected by the widget.

I am not asking maintainers to support local patching. I am including that note only because it may help narrow where the missing usage handoff is.

Notes

I can provide a minimal local endpoint setup if needed, but this seems reproducible in principle with any local model path where:

  • chat works
  • model token limits are known
  • backend usage is available

The problem is specifically that the Context Window usage UI never reflects that usage.

Metadata

Metadata

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions