Skip to content

fix(web): match model label to active provider when a stale slug is selected (#1982)#2203

Closed
mvanhorn wants to merge 1 commit intopingdotgg:mainfrom
mvanhorn:fix/1982-model-icon-mismatch
Closed

fix(web): match model label to active provider when a stale slug is selected (#1982)#2203
mvanhorn wants to merge 1 commit intopingdotgg:mainfrom
mvanhorn:fix/1982-model-icon-mismatch

Conversation

@mvanhorn
Copy link
Copy Markdown
Contributor

@mvanhorn mvanhorn commented Apr 19, 2026

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, selectedModelLabel uses selectedProviderOptions.find(o => o.slug === props.model)?.name ?? props.model. When a provider that the thread was using gets disabled (codex -> claudeAgent), activeProvider switches but props.model is still a codex slug. That slug isn't in claudeAgent's option list (the codex slug only gets added to the provider whose selectedProvider matches it in getCustomModelOptionsByProvider). The find() 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.model fallback stays last in case a provider legitimately has no options.

 const selectedModelLabel =
-  selectedProviderOptions.find((option) => option.slug === props.model)?.name ?? props.model;
+  selectedProviderOptions.find((option) => option.slug === props.model)?.name ??
+  selectedProviderOptions[0]?.name ??
+  props.model;

Test

Added a browser test that mounts the picker with provider="claudeAgent", model="gpt-5-codex", and a modelOptionsByProvider whose claudeAgent list doesn't include the codex slug (the real-world state). Before the fix the trigger label was gpt-5-codex; after, it reads Claude Opus 4.6 (the active provider's first model).

All 8 ProviderModelPicker.browser.tsx tests 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 ProviderModelPicker trigger rendering when a thread’s model slug 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 ProviderModelPicker label to show active provider's first model when a stale slug is selected

When the model prop 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 the selectedModelLabel fallback chain now checks the active provider's first option before falling back to props.model. A browser test in ProviderModelPicker.browser.tsx covers this case.

Macroscope summarized 1d8206f.

…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
@coderabbitai
Copy link
Copy Markdown

coderabbitai bot commented Apr 19, 2026

Important

Review skipped

Auto reviews are disabled on this repository. Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

⚙️ Run configuration

Configuration used: Repository UI

Review profile: CHILL

Plan: Pro

Run ID: e8623123-53bd-436a-b795-a09974c0a47b

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • 🔍 Trigger review
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

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.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@github-actions github-actions bot added size:XS 0-9 changed lines (additions + deletions). vouch:unvouched PR author is not yet trusted in the VOUCHED list. labels Apr 19, 2026
@macroscopeapp
Copy link
Copy Markdown
Contributor

macroscopeapp bot commented Apr 19, 2026

Approvability

Verdict: 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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

size:XS 0-9 changed lines (additions + deletions). vouch:unvouched PR author is not yet trusted in the VOUCHED list.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Bug]: Mismatched icon + model on model select

2 participants