Repository navigation
Conversation
Kiro advertises 1M for the 5.x Claude models but the Q layer caps them at 600K; 4.7/4.8 are capped too. The registry advertised 1M while getContextWindowSize() returned 200K for any id without a `-1m` suffix, so: - reported input tokens were ~2.75x too low on 5.x (the context bar never approached the limit and auto-compaction never fired), and - even with correct token math, advertising 1M left ~400K of phantom headroom before `CONTENT_LENGTH_EXCEEDS_THRESHOLD`. Measured 2026-11-03 by growing a single generateAssistantResponse prompt until the service rejected it (2.4M chars / 533K tokens -> 96.7%; 2.7M chars / 600K tokens -> 400 Input is too long): sonnet-4.0, sonnet/haiku/opus-4-5 : 200K opus-4-6, sonnet-4-6 (+ -1m) : 1M opus-4-7/4-8, opus-5, sonnet-5, opus-5-5, sonnet-5-5, fable-5-1, auto : 600K context-windows.ts becomes the single source for both the advertised limit.context and the percentage->token conversion. Also expose claude-opus-4-6-1m / claude-sonnet-4-6-1m, the only ids that are really served at 1M today.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
The registry advertises
limit.context: 1_000_000for the newer Claude models, butgetContextWindowSize()returns200_000for every id without a-1msuffix. That split causes two different failures:200_000 * contextUsagePercentage / 100, i.e. ~2.75x too low. The context bar never approaches the limit, auto-compaction never fires, and the request eventually dies withInput is too long.claude-opus-4-6/claude-sonnet-4-6(no-1min the OpenCode-facing id), so their token counts are under-reported the same way.Reported in #128, where the
166,512plateau is200_000 * 0.833%— the plugin's own 200K denominator, not the backend window.Measurements
Method: grow a single
generateAssistantResponseprompt, read the streamedcontextUsagePercentage, keep growing until the service rejects it.The 2.7M-char / ~600K-token request fails with
CONTENT_LENGTH_EXCEEDS_THRESHOLD, confirming the 600K ceiling; 2.4M chars / ~533K tokens succeeds at 96.7%.Fix
src/plugin/context-windows.tsowns the measured table and is the single source for both the advertisedlimit.contextand the percentage → token conversion.getContextWindowSize()now delegates to it.MODEL_SPECSno longer carries alimit;buildModelRegistry()resolves it from the table, so the advertised window and the token math cannot drift again.claude-opus-4-6-1m/claude-sonnet-4-6-1m(with-thinkingcompanions): the only ids actually served at 1M today.claude-opus-5-5/sonnet-5-5/fable-5-1are already present so feat: add claude-opus-5.5, claude-sonnet-5.5 and claude-haiku-5.5 #136 gets the right caps once merged.Notes
ListAvailableModels(the approach in feat(models): discover context windows from Kiro catalog #121) returns403 Your subscription does not support this applicationon a Pro Max account, even with the exact headers that PR uses. Catalog discovery can only fall back to the heuristic there.claude-sonnet-5-1mandclaude-opus-4-7-1mare rejected withINVALID_MODEL_ID, so they are not advertised.bun test179 pass / 0 fail;tsc -p tsconfig.build.jsonclean.