Repository navigation
fix(prompt): send an Anthropic model the version map does not hold under its own id - #2219
Open
Aleksei Priakhin (alexcmd) wants to merge 2 commits into
Open
Aleksei Priakhin (alexcmd) wants to merge 2 commits into
Aleksei Priakhin (alexcmd) wants to merge 2 commits into
Conversation
Aleksei Priakhin (alexcmd)
force-pushed
the
fix/anthropic-unknown-model
branch
from
August 17, 2026 19:58
f39f394 to
f908e1a
Compare
Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
This branch has not been deployed
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.
Narrowing the context window of a predefined model makes it unusable:
AnthropicClientSettings.modelVersionsMapis keyed by the wholeLLModelvalue, and the lookup atAnthropicLLMClient.kt:449throws when there is no entry. Change any field of a model the library ships and it stops being a model the library knows — the id is the same, the provider is the same, and the request never leaves the process.The same lookup refuses a model released after the library. The map that ships today ends at
claude-opus-4-7, so naming a newer model — which is the whole point ofLLModeltaking an id — fails with an argument error thrown from inside a client the caller did not think they were configuring.There is an escape hatch, and it does not reach this lookup:
AnthropicModels.addCustomModeladds tocustomModels, which feeds themodelslisting, whileDEFAULT_ANTHROPIC_MODEL_VERSIONS_MAPis a separate top-levelinternal valbuilt from the fixed set. A caller who follows the public API to register a custom model is still refused when they use it.The change. A model the map does not hold is sent under
model.id. A model the map does hold keeps its pinned dated snapshot, which is why the map exists and is unchanged:claude-sonnet-4-0still resolves toclaude-sonnet-4-20250514. Anthropic resolves an alias to its current snapshot itself, so a caller who wrote an alias gets what they asked for, and an id the API does not know now comes back as an error from the API naming the model.The provider check is kept — an OpenAI model handed to the Anthropic client is a caller mistake, and that half of the old refusal is worth keeping. It is now stated as such rather than as "unsupported model".
Four tests, written against
developfirst: two of them (testAModelTheMapDoesNotKnowIsSentUnderItsOwnId,testACopiedPredefinedModelIsStillSentUnderItsId) fail there and pass here, while the pinned-version and wrong-provider tests pass on both — so the pair that changed is exactly the pair intended../gradlew :prompt:prompt-executor:prompt-executor-clients:prompt-executor-anthropic-client:jvmTestpasses (50 tests), along with the openai-client and agents-core suites. Nothing in the repository referenced the old message.Same shape as #2212 for the OpenAI client: a hand-written model refused for a reason that is about the library's bookkeeping rather than about the model.