fix(bedrock): resolve context limits for every vendor prefix, not just anthropic - #12921
Merged
diegosouzapw merged 2 commits intoSep 10, 2026
Conversation
…t anthropic getBedrockKnownModelLimits() peeled the cross-region profile prefix and then only "anthropic.", so a spec lookup for "global.openai.gpt-5.6-sol" was tried as "openai.gpt-5.6-sol" and missed. Imported openai.* models therefore stored no inputTokenLimit, the pre-flight context check fell back to the 200k default, and 1M-context models were rejected locally before the request reached AWS. Peel the two leading qualifiers a Bedrock id can carry (profile and vendor) and keep the first candidate a spec knows. The model name itself contains dots, so the peel stops at two segments rather than splitting the whole id. Closes diegosouzapw#12915
diegosouzapw
merged commit Sep 10, 2026
5df94f8
into
diegosouzapw:release/v3.8.51
8 of 16 checks passed
muhamadgalihsaputra
pushed a commit
to niyatna/NiyatnaRoute
that referenced
this pull request
Sep 27, 2026
…t anthropic (diegosouzapw#12921) Boarded with 13 sibling PRs into one worktree off release/v3.8.51 and validated as a set: 132 focused tests pass across all 15 test files in the batch, typecheck:core is clean, check-changelog-integrity reports no lost base bullets, and check-file-size is green. Your PR merged without conflict against its siblings. Thank you — the write-up made this reviewable: measuring the behaviour on the release tip and showing the before/after table meant the defect could be confirmed rather than taken on faith.
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.
What
getBedrockKnownModelLimits()normalizes a Bedrock model id before looking upMODEL_SPECS:The vendor peel is hardcoded to
anthropic., soglobal.openai.gpt-5.6-solisonly ever tried as
openai.gpt-5.6-sol— which no spec matches. Every importedopenai.*model is stored with noinputTokenLimit, the pre-flight contextcheck falls back to the 200k default, and a 1M-context model is rejected locally
before the request reaches AWS:
This PR peels the two leading qualifiers a Bedrock id can carry (cross-region
profile, then vendor) and keeps the first candidate a spec knows.
Verifying the report first (#12915)
Measured on the tip through
getBedrockKnownModelLimits():global.openai.gpt-5.6-solnull{inputTokenLimit: 1050000, outputTokenLimit: 128000}global.openai.gpt-5.6-terranull{inputTokenLimit: 1050000, outputTokenLimit: 128000}global.anthropic.claude-opus-4-6-v1{1000000, 128000}us.anthropic.claude-sonnet-4-5-v1:0{200000, 64000}So the report's root cause is confirmed, and its scope is wider than stated —
meta.*,amazon.*,mistral.*,deepseek.*hit the same gate.One correction to the expected values. The report expects 1M;
MODEL_SPECSputs
gpt-5.6-solat 1_050_000, so that is what the import now stores. TheinputTokenLimit: nullsymptom is fixed either way.What this does not fix. After the vendor gate is gone, coverage is whatever
MODEL_SPECSknows. I checked 14 non-anthropic ids (meta.llama4-maverick-…,amazon.nova-pro-v1:0,cohere.command-r-plus-v1:0,mistral.mistral-large-…,deepseek.r1-v1:0,qwen.*,ai21.*,writer.*,stability.*,twelvelabs.*,luma.*): all still resolve tonull, because no spec carries those names. Theyare also unchanged from today's behaviour — none of them regress, and none of them
matched a wrong spec through the wider peel, which was the risk worth checking.
Populating those families is a catalog-data change, not this lookup.
Why the peel stops at two segments
A Bedrock model name contains dots of its own (
gpt-5.6-sol), so splitting thewhole id and peeling greedily would eventually try
6-sol. An id carries at mosttwo leading qualifiers —
<profile>.<vendor>.<model>— so the candidate list is[id, unqualified, drop-1, drop-2]and the first spec hit wins.Test
tests/unit/bedrock-vendor-context-limits-12915.test.tsdrivesdiscoverBedrockNativeModels()with a stub fetcher returning amodelSummariespayload — the real import entry point, not the lookup helper — and asserts the
openai.*model comes back withinputTokenLimit: 1_050_000while theanthropic.*model keeps1_000_000. The two numbers differ, so a lookup thatanswered with the neighbouring model's limit would fail both assertions.
Mutation
anthropic.-only peel (shipped code)actual: undefined, expected: 1050000...(getBedrockKnownModelLimits(model.id) || {})fromwithKnownBedrockLimits(the call site)actual: undefinedThe second mutation is the point: the test fails when the wiring is removed,
not only when the helper's logic changes.
Regression
tests/unit/executor-bedrock.test.ts,tests/unit/bedrock-image-log-redaction-7297.test.tsand the new file:15 pass, 0 fail.
Closes #12915