fix(models): prefer vision-capable variant over provider order for ambiguous ids - #444
Merged
Merged
Conversation
…biguous ids When a bare model id (e.g. claude-opus-4-8) matches both a text-only and a vision-capable provider variant, resolution picked the variant purely by configured provider order, so gjc could resolve a vision-capable model to its text-only namesake and treat it as non-vision. Add a vision-capability preference ranked above provider order in both ambiguous-id resolvers (ModelRegistry.#resolveCanonicalVariant and pickPreferredModel). Explicit provider/id qualification is unchanged.
|
You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard. |
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
A custom model that supports vision could be reported/treated as not supporting vision when referenced by a bare id.
When a
models.ymldeclares the same model id under two providers — e.g.claude-opus-4-8under a text-onlyopenai-completionsproxy and a vision-capableanthropic-messagesproxy — resolving the bare id (model carousel,/model claude-opus-4-8, or any non-qualified reference) chose the variant purely by configured provider order. If the text-only provider was declared first, gjc resolved to the text-only namesake and treated the model as non-vision, even though a vision-capable variant of the same id was available.Fix
Add a vision-capability preference ranked above configured provider order in both ambiguous-id resolvers:
ModelRegistry.#resolveCanonicalVariant(packages/coding-agent/src/config/model-registry.ts)pickPreferredModel(packages/coding-agent/src/config/model-resolver.ts)An ambiguous id now resolves to a vision-capable variant whenever one exists. Explicit
provider/idqualification (e.g.layofflabs/claude-opus-4-8) is unchanged and still routes exactly as written.Verification
claude-opus-4-8→ vision variant (["text","image"]); explicitlayofflabs/claude-opus-4-8→ still text-only.model-registry.test.tsandmodel-resolver.test.tspass; biome clean on changed files.