Fix provider_for for full Claude model IDs#143
Open
askhatsoltanov1984-lang wants to merge 1 commit into
Open
Conversation
ModelRegistry.provider_for previously matched only the short Claude aliases (opus / sonnet / haiku). Clients that pass canonical Claude model IDs such as claude-opus-4-7, claude-sonnet-4-6 or claude-haiku-4-5-20251001 fell through to the codex branch, breaking Claude routing. Match the claude- prefix in addition to the short aliases, and add a unit test covering both old aliases and the new full IDs.
3 tasks
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
ModelRegistry.provider_for(...)previously matched only the short Claudealiases (
opus/sonnet/haiku). Clients that pass canonical Claudemodel IDs such as:
claude-opus-4-7claude-sonnet-4-6claude-haiku-4-5-20251001fell through the Claude branch, then the Gemini branch (no prefix match),
and ended up classified as codex. Downstream this caused Claude-bound
sessions to be routed to the Codex CLI, which silently broke session
continuity for clients that pass the full model name.
Fix
Also match a
claude-prefix inprovider_for. Short aliases continueto work unchanged; non-Claude IDs (
gpt-*,gemini-*,o3, etc.) areuntouched.
Tests
Added
tests/test_provider_for_claude_full_ids.pycovering:claude-opus-4-7,claude-sonnet-4-6,claude-haiku-4-5-20251001) ->claudeopus,sonnet,haiku) -> stillclaudegpt-5.2-codex,gemini-2.5-pro) -> unchangedPure unit test — no network, no API calls. Runs in the existing pytest
suite.
Why merge
The patch is logic-only, additive, and matches the existing pattern
already used for Gemini (prefix check alongside a known-set check). The
short-alias path is unchanged so no in-tree behaviour regresses.