feat: on-demand context-window variants in the /model picker - #1
Conversation
Register each model once per context window it supports (1M and/or 200K) as a distinct, labeled picker entry, so the window is chosen on demand from OMP's native /model list instead of via a global config edit + reload. - models.ts: add parseVariantId; make claudeCodeModelId variant-aware (a "-1m"/"-200k" suffixed id forces that window; the unsuffixed id follows the config default). Replace applyLongContext with buildVariantModels: default-first ordering, "(1M)"/"(200K)" labels, and each entry's contextWindow set to its true window so the status bar and auto-compaction threshold stay accurate. - index.ts: register buildVariantModels(MODELS, longContextSettings). - provider.contextWindow (auto|1m|200k) now only picks which window is the unsuffixed default; it no longer hides models. Both windows stay in the picker wherever a runtime exists, so existing modelRoles / enabledModels ids keep working. - Rewrite the context-window unit tests (10/10) and README accordingly.
|
Warning Review limit reachedYou’ve reached a temporary PR review limit under our Fair Usage Limits Policy. Next review available in: 9 minutes Enable usage-based reviews in Billing to review now. Otherwise, wait until the next included review is available. How can I continue?After more reviews become available, a review can be triggered using the To avoid repeated limits, reduce automatic review volume by pausing incremental auto-reviews earlier, using label-based review opt-in, excluding WIP or generated PR titles, or requesting reviews manually when the PR is ready. If your team needs uninterrupted high-volume reviews, an organization admin can enable usage-based reviews. How do review limits work?CodeRabbit enforces per-developer PR review limits for each organization. Most developers receive the normal plan review availability. For paid Pro and Pro+ PR reviews, CodeRabbit uses adaptive limits for sustained high-volume activity. When a developer's recent PR review activity reaches the 95th percentile or higher among CodeRabbit users, additional reviews become available more gradually as earlier reviews age out of the rolling window. Please refer docs for additional details. Review details⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (5)
Comment |
There was a problem hiding this comment.
Pull request overview
This PR updates the model registration logic so each Claude model is registered once per supported context window (1M and/or 200K) as separate, labeled entries in OMP’s native /model picker. This makes the context window a per-selection choice (pick the other entry) rather than a global config + /reload toggle, while keeping the unsuffixed id aligned with the configured default.
Changes:
- Add variant-aware model-id parsing and runtime resolution so
-1m/-200kpicker ids force the requested window. - Replace single-entry long-context registration with variant expansion (default-first ordering, consistent
(1M)/(200K)labels, accuratecontextWindowper entry). - Update unit tests and documentation to reflect the new picker behavior and default-window semantics.
Reviewed changes
Copilot reviewed 5 out of 5 changed files in this pull request and generated 2 comments.
Show a summary per file
| File | Description |
|---|---|
tests/unit-context-window.mjs |
Rewrites tests to validate variant expansion, ordering, defaults/fallbacks, suffix parsing, and runtime id mapping. |
src/models.ts |
Introduces parseVariantId, makes claudeCodeModelId variant-aware, and replaces applyLongContext with buildVariantModels. |
src/index.ts |
Switches provider registration to use buildVariantModels(MODELS, longContextSettings). |
README.md |
Updates user-facing docs to explain variant entries in /model, default-window behavior, and the offered windows per model. |
documentation/completed/features/2026-07-06_on-demand-context-window-variants.md |
Adds an implementation/decision record describing the approach, risks, and verification steps. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
- claudeCodeModelId: report the actually-requested window in the "no runtime" error (the forced suffix when present, else the config mode) instead of always the config mode. - buildVariantModels: detect unknown model ids up front via MODEL_IDS_IN_ORDER, before probing the forced resolvers, so an unrecognized id no longer triggers their "hiding it" console.error logs for a model the fast-path actually keeps.
What
Register each Claude model once per context window it supports (1M and/or 200K) as a distinct, labeled entry in OMP's native
/modelpicker. The context window is now chosen on demand — pick the other entry — instead of via a global config edit +/reload.Example (config
contextWindow: "auto", Pro plan):claude-bridge/claude-opus-4-8claude-bridge/claude-opus-4-8-200kclaude-bridge/claude-fable-5claude-bridge/claude-fable-5-1mHow
src/models.tsparseVariantId(id)→{ baseId, forced?: "1m" | "200k" }(base ids never end in those suffixes, so the split is unambiguous).claudeCodeModelIdvariant-aware: a suffixed id forces its window regardless of config; the unsuffixed id follows the config default.applyLongContextwithbuildVariantModels: expands each model into one entry per available window, orders default-first, labels each(1M)/(200K), and sets each entry'scontextWindowto its true window so OMP's status bar and auto-compaction threshold stay accurate.src/index.ts— registerbuildVariantModels(MODELS, longContextSettings).provider.contextWindow(auto/1m/200k) now only decides which window is the unsuffixed default; it no longer hides models. Both windows stay pickable wherever a runtime exists, so existingmodelRoles/enabledModelsids keep resolving.Notes
CLAUDE_BRIDGE_DEBUG=1logs the served window.0.7.0is unreleased (no tags). A0.8.0bump is worth considering before publishing, since this changes the registered model set.Test plan
bun run typecheckcleanbun run test→ 10/10 (rewrittentests/unit-context-window.mjs: expansion, default-first ordering, auto/Max flip,200k/1mdefaults + fallbacks,parseVariantId,claudeCodeModelIdround-trips)/modelvisual check in a running OMP after/reload(can't drive the TUI from CI)