Skip to content

fix(display): preserve all providers in merged Models rows - #764

Merged
junhoyeo merged 1 commit into
mainfrom
fix/provider-display-merged-list
Jun 22, 2026
Merged

fix(display): preserve all providers in merged Models rows#764
junhoyeo merged 1 commit into
mainfrom
fix/provider-display-merged-list

Conversation

@junhoyeo

@junhoyeo junhoyeo commented Jun 22, 2026

Copy link
Copy Markdown
Owner

Follow-up to #763, addressing a P2 review note.

The bug

aggregate_model_usage_entries joins multiple providers for a merged row as a ", "-separated string (e.g. a model used via both openai and openrouter → "openai, openrouter") for every grouping except ClientProviderModel. The display mapper introduced in #763 matched a brand prefix/contains branch (openai*, kimi*, *copilot*) against the whole joined string and returned a single brand — silently dropping the other providers:

  • "openai, openrouter""OpenAI" (openrouter gone)
  • "kimi, anthropic""Kimi" (anthropic gone)

(Ironically the old exact-match mapper didn't hit this; the new prefix matching did — a regression from #763.)

The fix

Make the mapper list-aware: split entry.provider on ", ", map each segment via a new map_single_provider helper, and rejoin. So "openai, openrouter""OpenAI, OpenRouter". Also added an explicit openrouter → "OpenRouter" arm.

Tests

New provider_display_name_merged_list_maps_each_segment covers openai, openrouterOpenAI, OpenRouter, kimi, anthropicKimi, Anthropic, the copilot-contains case (anthropic, copilotAnthropic, GitHub Copilot), and order preservation. build/test/clippy/fmt --check all green.


Summary by cubic

Fix provider display in merged Models rows by mapping each provider in comma-joined strings, preserving all providers (e.g., "openai, openrouter" → "OpenAI, OpenRouter"). Adds a helper for single-provider mapping and an explicit "OpenRouter" display name.

  • Bug Fixes
    • Split on ", " and map each segment via map_single_provider, then rejoin.
    • Added explicit openrouter → "OpenRouter" mapping.
    • Added tests for merged lists, *copilot* contains case, and order preservation.

Written for commit e300409. Summary will update on new commits.

Review in cubic

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
@vercel

vercel Bot commented Jun 22, 2026

Copy link
Copy Markdown
Contributor

The latest updates on your projects. Learn more about Vercel for GitHub.

1 Skipped Deployment
Project Deployment Actions Updated (UTC)
tokscale Ignored Ignored Preview Jun 22, 2026 10:06am

Request Review

@junhoyeo
junhoyeo merged commit ce27522 into main Jun 22, 2026
13 of 14 checks passed
@junhoyeo
junhoyeo deleted the fix/provider-display-merged-list branch June 22, 2026 10:06
makoMakoGo added a commit to makoMakoGo/tokscale that referenced this pull request Jun 23, 2026
ported from upstream junhoyeo#760
ported from upstream junhoyeo#762
ported from upstream junhoyeo#763
ported from upstream junhoyeo#764
t1000040 pushed a commit to tmobi-internal/tokscale that referenced this pull request Jun 30, 2026
)

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
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant