fix(display): render provider names correctly in Models views - #763
Conversation
Provider names rendered inconsistently: the CLI `models` report printed the raw provider id (e.g. "openai", "opencode", "google-vertex"), and the shared provider display mapper's fallback was a naive capitalize-first that produced "Google-vertex" / "Kimi-for-coding". - get_provider_display_name: add explicit brand-family handling (openai* -> OpenAI, kimi* -> Kimi, google-vertex/google_vertex -> Google Vertex) and replace the capitalize-first fallback with a word-splitting title-caser (splits on -/_/space, per-word acronym map: AI/GPT/API/LLM/xAI/Vertex), so unknown multi-word providers like `some-new-provider` -> "Some New Provider". - Route the 6 raw entry.provider cells in run_models_report through the mapper so the CLI matches the TUI (which already used it). Adds unit tests for all four reported cases (openai->OpenAI, kimi-for-coding->Kimi, google-vertex->Google Vertex, opencode->OpenCode) plus brand families, both google-vertex spellings, the smart fallback, acronym words, known regressions, and empty/separator-only edges. Confidence: high Scope-risk: narrow
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 3b544dd287
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| if lower.starts_with("openai") { | ||
| return "OpenAI".to_string(); |
There was a problem hiding this comment.
Split merged provider lists before display mapping
When a row merges multiple providers, aggregate_model_usage_entries stores them as a comma-separated string for every grouping except ClientProviderModel; this mapper now treats the whole string as one provider. In a real Models row such as the same model used via openai and openrouter, the sorted provider value becomes openai, openrouter, this prefix branch returns only OpenAI, and the Providers column silently drops openrouter. Split entry.provider on ", " and map each provider before joining, or make this helper list-aware.
Useful? React with 👍 / 👎.
fix(display): map each provider in merged Models rows
aggregate_model_usage_entries joins multiple providers for a row as a
", "-separated string (e.g. "openai, openrouter") for every grouping except
ClientProviderModel. get_provider_display_name treated the whole string as one
provider, so a brand prefix/contains branch (openai*/kimi*/*copilot*) matched
the first segment and silently dropped the rest ("openai, openrouter" rendered
as just "OpenAI").
Split on ", ", map each segment via a new map_single_provider helper, then
rejoin, so "openai, openrouter" -> "OpenAI, OpenRouter". Also adds an explicit
openrouter -> "OpenRouter" arm.
Addresses the P2 review note on #763.
Confidence: high
Scope-risk: narrow
ported from upstream junhoyeo#760 ported from upstream junhoyeo#762 ported from upstream junhoyeo#763 ported from upstream junhoyeo#764
…eo#763) fix(display): render provider names correctly across Models views Provider names rendered inconsistently: the CLI `models` report printed the raw provider id (e.g. "openai", "opencode", "google-vertex"), and the shared provider display mapper's fallback was a naive capitalize-first that produced "Google-vertex" / "Kimi-for-coding". - get_provider_display_name: add explicit brand-family handling (openai* -> OpenAI, kimi* -> Kimi, google-vertex/google_vertex -> Google Vertex) and replace the capitalize-first fallback with a word-splitting title-caser (splits on -/_/space, per-word acronym map: AI/GPT/API/LLM/xAI/Vertex), so unknown multi-word providers like `some-new-provider` -> "Some New Provider". - Route the 6 raw entry.provider cells in run_models_report through the mapper so the CLI matches the TUI (which already used it). Adds unit tests for all four reported cases (openai->OpenAI, kimi-for-coding->Kimi, google-vertex->Google Vertex, opencode->OpenCode) plus brand families, both google-vertex spellings, the smart fallback, acronym words, known regressions, and empty/separator-only edges. Confidence: high Scope-risk: narrow
) fix(display): map each provider in merged Models rows aggregate_model_usage_entries joins multiple providers for a row as a ", "-separated string (e.g. "openai, openrouter") for every grouping except ClientProviderModel. get_provider_display_name treated the whole string as one provider, so a brand prefix/contains branch (openai*/kimi*/*copilot*) matched the first segment and silently dropped the rest ("openai, openrouter" rendered as just "OpenAI"). Split on ", ", map each segment via a new map_single_provider helper, then rejoin, so "openai, openrouter" -> "OpenAI, OpenRouter". Also adds an explicit openrouter -> "OpenRouter" arm. Addresses the P2 review note on junhoyeo#763. Confidence: high Scope-risk: narrow
Fixes provider display names that rendered raw or mis-cased: openai → OpenAI, kimi-for-coding → Kimi, google-vertex → Google Vertex, opencode → OpenCode.
Root cause
Two layers:
modelsreport rendered the raw provider id (Cell::new(&entry.provider)) in 6 places — so you sawopenai/opencode/google-vertexverbatim.get_provider_display_namemapper's fallback was a naive capitalize-first, producingGoogle-vertex/Kimi-for-codingfor hyphenated ids.Fix
get_provider_display_name): brand-family prefixes (openai*→OpenAI,kimi*→Kimi, copilot→GitHub Copilot), explicitgoogle-vertex/google_vertex→"Google Vertex" (both spellings, sincecanonical_providerrewrites the hyphen to an underscore), and a smart title-case fallback that splits on-/_/space with a per-word acronym map (AI, GPT, API, LLM, xAI, Vertex). Unknown multi-word providers likesome-new-providernow render "Some New Provider".run_models_reportthrough the mapper, so the CLI matches the TUI (which already used it). Confirmed no other raw-provider cell renders remain.Tests (all green)
8 new unit tests covering the four reported cases, openai/kimi families, both google-vertex spellings, the smart multi-word fallback, per-word acronyms, known-brand regressions (Anthropic/xAI/DeepSeek/GitHub Copilot/…), and empty/separator-only edges.
cargo build/test/clippy/fmt --checkall pass (730 + 122 tests).Summary by cubic
Fixes provider names across Models views so brands render correctly and consistently (e.g., openai → OpenAI, kimi-for-coding → Kimi, google-vertex → Google Vertex). The CLI now matches the TUI, and unknown ids get clean title-casing.
entry.providercells in themodelsreport throughget_provider_display_name.get_provider_display_namewith brand-family rules (openai*,kimi*, Copilot variants) and explicitgoogle-vertex/google_vertex→ Google Vertex.Written for commit 3b544dd. Summary will update on new commits.