Skip to content

fix(core): keep Claude Agent models from falling back to 200k context - #64107

Merged
Tarquinen merged 1 commit into
devfrom
claude-agent-windows
Nov 15, 2026
Merged

Tarquinen merged 1 commit into
devfrom
claude-agent-windows

Conversation

@Tarquinen

@Tarquinen Tarquinen commented Nov 15, 2026 •

Copy link
Copy Markdown
Member

Issue for this PR

Closes #61020

Type of change

  • Bug fix
  • New feature
  • Refactor / code improvement
  • Documentation

What does this PR do?

Claude Agent only learns context windows from its full login check, which runs on connect or when no model list is saved. A chat's startup report has no windows, so when Claude Code adds or renames a model (for example Fable's id changing), the saved list keeps that model without a window and it falls back to the 200K default until the user reconnects.

Now a chat's report that includes a model with no known window starts one full check. Each model id is sent to a check at most once per process, so a model Claude Code can't measure doesn't keep re-triggering it. Full checks themselves never trigger another one.

How did you verify your code works?

  • Changed the existing chat test, which already saves only haiku while the chat reports sonnet, to expect sonnet to get its 1M window. It fails on dev and passes with this change.
  • Claude Agent tests pass with --rerun-each 10, and bun typecheck passes.

Screenshots / recordings

Not a UI change.

Checklist

  • I have tested my changes locally
  • I have not included unrelated changes in this PR

@opencodejr opencodejr Bot 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.

I tested this change and it fixes the problem. I used the fake Claude Code setup (no real login here) with a version of the #61020 reproduction, on the base and on this PR.

  • Saved models with no window, then a chat starts: on the base the model and the saved list stay at 200K. With this PR, the chat's report starts a full check, and the model and the saved list both get 1M.
  • A stale server whose in-memory list has no window: on the base, a chat start erases the window another server saved. With this PR it is still erased at first, but the follow-up check writes it back.
  • Your new test: it fails on the base and passes here. All Claude Agent tests pass, plugin.test.ts passes 5 runs in a row, and typecheck:tsc in packages/core passes.

One case is still open, which I take to be intended: with no chat, startup still runs no check, so a saved list without windows shows 200K until the first chat in the process. Compaction only happens during chats, and the first chat starts the check, so in practice it should rarely matter.

Public API: unchanged. fromChat is an optional field on an internal status type.

No concerns that would block a merge.

@Tarquinen
Tarquinen force-pushed the claude-agent-windows branch 2 times, most recently from 9e1ca39 to 3e60819 Compare November 15, 2026 17:53
@Tarquinen Tarquinen changed the title fix(core): check Claude context windows for models a chat reports without one fix(core): keep Claude Agent models from falling back to 200k context Nov 15, 2026
@Tarquinen
Tarquinen force-pushed the claude-agent-windows branch from 3e60819 to 7ff9fb7 Compare November 15, 2026 17:56
@Tarquinen
Tarquinen enabled auto-merge (squash) November 15, 2026 17:57
@Tarquinen
Tarquinen merged commit 6c5ef96 into dev Nov 15, 2026
10 checks passed
@Tarquinen
Tarquinen deleted the claude-agent-windows branch November 15, 2026 18:01
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.

claude-agent: saved model catalog loses context windows, models fall back to 200K and compaction triggers early

1 participant