models: keep a learned window on seed rows without losing the [1m] variant (split from #9513)

Open
#9,518 1 comment 0 reactions 0 assignees View on GitHub

Maintainers usually reply within 1 day

Nobody has claimed this yet.

Assessment

Difficulty
4/5
Estimated time
3-5 days
Newbie friendliness
53/100
Issue type
Bug
Clarity
Clearly specified
Activity status
Active
Tech stack
javascript

Research direction

Start with packages/server/src/models.js and trace createModelsRegistry().updateModels, the [1m] synthesis loop, and the contextWindowOverrides cache; then read sdk-session.js around updateContextWindow. Add tests for a learned 123,456 window surviving refresh, a 200,000 learned base retaining its [1m] variant, and an unchanged seed window when no learned value exists. Check whether the live-row case also loses the variant; done when all cases pass.

Written by the indexing model from the issue text.

Description

from-review server tech-debt

Context

Split from #9513 item 2, during the review of #9517 at ef0c2789a.

#9513 item 2 asked the static-seed union in createModelsRegistry().updateModels (packages/server/src/models.js) to prefer contextWindowOverrides.get(fullId). That way an in-use seed row would keep its learned context window across a refresh, instead of snapping back to the seed value until the session's next turn.

The round 1 review of #9517 found that this interacts with the [1m] synthesis gate. #9517 therefore ships without it.

The interaction

  • updateContextWindow learns a model's window from the SDK's result.modelUsage[<model>].contextWindow (sdk-session.js, about line 1735).
  • For a base Claude model that window is the base tier. The repo's own fixtures report claude-sonnet-4-6: { contextWindow: 200000 }, and the pricing table describes base rates as the ≤200K tier.
  • [1m] variants are synthesized only for a base row whose contextWindow >= 1_000_000 (models.js, the synthesis loop).
  • If the seed union prefers the learned base window, a turn on the base model (for example claude-sonnet-5-5, the new-session default) can set it to 200,000. The next refresh then stops synthesizing claude-sonnet-5-5[1m], and the "1M" choice leaves the picker unless a session is using it.
  • Today the refresh resets the seed row to its seed window (1,000,000), so the choice stays.
  • The reviewer reproduced the mechanism with a probe, a base learned below 1M then a refresh, which loses the variant. Whether the live SDK reports a sub-1M window for a 5.x base model is not verified.

What a fix needs

  1. Gate [1m] synthesis on the model's long-context capability: the declared or seed window, or provider metadata. Do not gate it on the base row's learned window, which can truthfully be the 200K tier while [1m] is available.
  2. Only then let the seed union prefer the learned window (the original #9513 item 2). Pin both with tests:
    • a seed row that learned 123,456 keeps it after a refresh, and the cache holds it;
    • a base seed row that learned 200,000 still yields its [1m] variant after a refresh;
    • a seed row with no learned window keeps the seed value.
  3. Live rows already prefer the override first (converted map). Check whether a live base row learned below 1M loses its [1m] chip at a refresh today. If it does, the same gate fixes it.

Impact today

Low. The context meter reads the per-session occupancy snapshot first. A reset seed window heals on the session's next turn. Only the picker's displayed window and the meter's fallback are affected.

Dominant language
JavaScript
Stars
7
Forks
1
Avg merge
2h 3m
Merged PRs (30d)
333

Getting set up

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from blamechris/chroxy

All issues in blamechris/chroxy

Similar issues

More JavaScript issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.