Skip to content

fix(kiro): stop discovery from stamping a fake 200k context window - #15413

Merged
diegosouzapw merged 1 commit into
diegosouzapw:release/v3.8.52from
QuangBlue:fix/kiro-discovery-context-window
Oct 6, 2026
Merged

diegosouzapw merged 1 commit into
diegosouzapw:release/v3.8.52from
QuangBlue:fix/kiro-discovery-context-window

Conversation

@QuangBlue

Copy link
Copy Markdown
Contributor

Symptom

A Kiro model whose ListAvailableModels entry lacks tokenLimits.maxInputTokens is advertised with a 200k window, even when the registry or models.dev knows a larger one (claude-sonnet-5 is 1M).

Root cause

fetchKiroAvailableModels expands each upstream model into variants with contextLength: Number(tokenLimits.maxInputTokens) || 200000. modelDiscovery persists contextLength as the discovered inputTokenLimit, and the Feature 5004 reconciler pins any discovered window that differs from the catalog as an auto:discovery override. The invented 200k therefore beats the real window.

Fix

Only carry the upstream maxInputTokens. When it is missing, the variant has no contextLength, so the catalog decides. KiroModel.contextLength is already optional, and the executor's usage-percentage budget reads the registry, not discovery, so it is unaffected.

Tests

  • tests/unit/kiro-available-models.test.ts: a model without tokenLimits has no contextLength, and a declared maxInputTokens is kept. It fails on the base and passes with the fix.
  • Kiro suites (kiro-available-models, kiro-claude-sonnet-5-2267, provider-models-config, executor-kiro) pass (50).

⚠️ base-red inherited: #15306

Kiro ListAvailableModels can omit tokenLimits.maxInputTokens. The variant
expander filled in 200000, which modelDiscovery persists as inputTokenLimit
and the Feature 5004 reconciler then pins as an auto:discovery override
over the registry / models.dev window (claude-sonnet-5 is 1M). Only carry
the upstream number; models without one stay unadvertised so the catalog
decides.
@QuangBlue
QuangBlue force-pushed the fix/kiro-discovery-context-window branch from ba92af4 to 6af6dd2 Compare October 3, 2026 05:28
@diegosouzapw
diegosouzapw merged commit 204de62 into diegosouzapw:release/v3.8.52 Oct 6, 2026
44 of 51 checks passed
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.

2 participants