fix(web): match model label to active provider when a stale slug is selected (#1982)#2203
fix(web): match model label to active provider when a stale slug is selected (#1982)#2203mvanhorn wants to merge 1 commit intopingdotgg:mainfrom
Conversation
…elected (pingdotgg#1982) When a provider the thread was using gets disabled (codex -> claudeAgent), the picker previously rendered the active provider's icon next to the raw stale model slug - e.g. Claude icon with "gpt-5-codex" text. The active provider's option list doesn't include the cross-provider slug, so the find() fell through to the slug itself. Fall back to the active provider's first model name before the raw slug, so the icon and the label always agree. Keeps the props.model fallback last for the edge case where a provider has no options at all. Fixes pingdotgg#1982
|
Important Review skippedAuto reviews are disabled on this repository. Please check the settings in the CodeRabbit UI or the ⚙️ Run configurationConfiguration used: Repository UI Review profile: CHILL Plan: Pro Run ID: You can disable this status message by setting the Use the checkbox below for a quick retry:
✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
ApprovabilityVerdict: Approved This is a straightforward UI bug fix that adds a fallback for displaying model labels when a stale model slug doesn't match the active provider. The change is limited to display text only (not selection logic), is well-documented with a test case, and has clear intent from the referenced issue #1982. You can customize Macroscope's approvability policy. Learn more. |
Summary
The model picker showed the active provider's icon next to a stale cross-provider model slug - reporter observed "Claude icon with 'GPT 5.4' text" after disabling codex and starting a new thread.
Root cause
In
ProviderModelPicker.tsx,selectedModelLabelusesselectedProviderOptions.find(o => o.slug === props.model)?.name ?? props.model. When a provider that the thread was using gets disabled (codex -> claudeAgent),activeProviderswitches butprops.modelis still a codex slug. That slug isn't in claudeAgent's option list (the codex slug only gets added to the provider whoseselectedProvidermatches it ingetCustomModelOptionsByProvider). Thefind()returns undefined and the fallback renders the raw slug alongside the Claude icon.Fix
Prefer the active provider's first model name before falling through to the raw slug. Icon and label agree. The
props.modelfallback stays last in case a provider legitimately has no options.Test
Added a browser test that mounts the picker with
provider="claudeAgent",model="gpt-5-codex", and amodelOptionsByProviderwhose claudeAgent list doesn't include the codex slug (the real-world state). Before the fix the trigger label wasgpt-5-codex; after, it readsClaude Opus 4.6(the active provider's first model).All 8
ProviderModelPicker.browser.tsxtests pass.Related open PRs
@Chrono-byte has an open redesign #2153 that touches the same two files. That PR replaces the whole picker UI; this one is a narrow stale-slug guard on the current implementation. Happy to rebase or fold into that effort if preferred.
Fixes #1982
This contribution was developed with AI assistance (Codex).
Note
Low Risk
Low risk UI bug fix that only changes how the trigger label is derived when the selected model slug isn’t in the active provider’s options, plus a targeted regression test.
Overview
Fixes
ProviderModelPickertrigger rendering when a thread’smodelslug belongs to a different (now-inactive/disabled) provider by falling back to the active provider’s first available model name before displaying the raw slug.Adds a browser regression test covering the stale cross-provider slug scenario to ensure the label no longer shows the dangling slug while the icon reflects the active provider.
Reviewed by Cursor Bugbot for commit 1d8206f. Bugbot is set up for automated code reviews on this repo. Configure here.
Note
Fix
ProviderModelPickerlabel to show active provider's first model when a stale slug is selectedWhen the
modelprop holds a slug that doesn't belong to the active provider (e.g. a previously selected Codex model while the provider is switched to Claude), the trigger button now displays the active provider's first model name instead of the raw foreign slug. The fix is in ProviderModelPicker.tsx, where theselectedModelLabelfallback chain now checks the active provider's first option before falling back toprops.model. A browser test in ProviderModelPicker.browser.tsx covers this case.Macroscope summarized 1d8206f.