Skip to content

fix(tui): disambiguate /model picker rows when provider display names collide#12306

Merged
OutThisLife merged 1 commit into
mainfrom
bb/tui-model-picker-dedupe-names
Apr 18, 2026
Merged

fix(tui): disambiguate /model picker rows when provider display names collide#12306
OutThisLife merged 1 commit into
mainfrom
bb/tui-model-picker-dedupe-names

Conversation

@OutThisLife

Copy link
Copy Markdown
Collaborator

What does this PR do?

Defensive UX fix in the TS Ink /model picker: when two providers render with the same display name (e.g. kimi-coding and kimi-coding-cn both → "Kimi For Coding"), both rows now get their slug appended — Kimi For Coding (kimi-coding) vs Kimi For Coding (kimi-coding-cn) — so users can actually distinguish them. Same disambiguation is applied to the header of the "Select Model" stage so the selected provider label stays unambiguous. No-op when names are already unique.

The Python backend already dedupes Kimi-style aliases by skipping one (#10599 landed that for #10526), but that's "first-with-credentials wins" — a user with both sets of credentials only sees one. User-defined providers from config.yaml, CANONICAL_PROVIDERS overlays, and any future backend regression can still surface as two rows with identical labels. This is a tiny client-side safety net that makes the picker resilient instead of trusting the gateway to be perfect.

Related Issue

Refs #10526

Type of Change

  • 🐛 Bug fix (non-breaking change that fixes an issue)
  • ✨ New feature (non-breaking change that adds functionality)
  • 🔒 Security fix
  • 📝 Documentation update
  • ✅ Tests (adding or improving test coverage)
  • ♻️ Refactor (no behavior change)
  • 🎯 New skill (bundled or hub)

Changes Made

  • ui-tui/src/domain/providers.ts — new pure helper providerDisplayNames(providers). Single pass to count name occurrences, second pass to append (slug) to members of any group with count > 1. Falls back to the plain name when slug is empty or equal to the display name.
  • ui-tui/src/components/modelPicker.tsx — compute disambiguated names once via useMemo, use them for both the provider-list rows and the selected-provider header on the model-selection stage.
  • ui-tui/src/__tests__/providers.test.ts — 7 unit tests: unique names untouched, collisions disambiguated symmetrically, non-colliding groups unaffected, empty-slug fallback, slug-equals-name edge case, empty input, order preservation.

How to Test

  1. cd ui-tui && npm install && npm run test — 80 tests pass (7 new).
  2. npm run type-check — clean.
  3. npm run lint — no new errors on touched files.
  4. Manual: if you have credentials for both kimi-coding and kimi-coding-cn configured, run /model and confirm the picker shows Kimi For Coding (kimi-coding) and Kimi For Coding (kimi-coding-cn) instead of two identical rows. With only one set of credentials, the backend dedupe still wins and the single row shows just Kimi For Coding (no slug suffix since there's no collision).

Tested on: Ubuntu 24.04 (WSL2), Node v22.22.2.

Checklist

Code

  • I've read the Contributing Guide
  • My commit messages follow Conventional Commits (fix(scope):, feat(scope):, etc.)
  • I searched for existing PRs to make sure this isn't a duplicate
  • My PR contains only changes related to this fix/feature (no unrelated commits)
  • I've run pytest tests/ -q — N/A, TS-only change; npm run test in ui-tui/ passes (80/80)
  • I've added tests for my changes
  • I've tested on my platform: Ubuntu 24.04 (WSL2)

Documentation & Housekeeping

  • I've updated relevant documentation — N/A (internal TUI render helper)
  • I've updated cli-config.yaml.example — N/A
  • I've updated CONTRIBUTING.md or AGENTS.md — N/A
  • I've considered cross-platform impact — pure string logic, no platform-specific code
  • I've updated tool descriptions/schemas — N/A

Screenshots / Logs

Before (per #10526):

╭─ ⚙ Model Picker — Select Provider ─────────────╮
│                                                │
│ * Kimi For Coding · 6 models                   │
│   Kimi For Coding · 4 models                   │
│                                                │
╰────────────────────────────────────────────────╯

After:

╭─ ⚙ Model Picker — Select Provider ─────────────╮
│                                                │
│ * Kimi For Coding (kimi-coding) · 6 models     │
│   Kimi For Coding (kimi-coding-cn) · 4 models  │
│                                                │
╰────────────────────────────────────────────────╯

… collide

If the gateway returns two providers that resolve to the same display name
(e.g. `kimi-coding` and `kimi-coding-cn` both → "Kimi For Coding"), the
picker now appends the slug so users can tell them apart, in both the
provider list and the selected-provider header. No-op when names are
already unique.

Refs #10526 — the Python backend dedupe from #10599 skips one alias, but
user-defined providers, canonical overlays, and future regressions can
still surface as indistinguishable rows in the picker. This is a
client-side safety net on top of that.
@OutThisLife OutThisLife merged commit c0edcf2 into main Apr 18, 2026
2 of 4 checks passed
@OutThisLife OutThisLife deleted the bb/tui-model-picker-dedupe-names branch April 18, 2026 22:27
man209111-cpu pushed a commit to man209111-cpu/hermes-agent that referenced this pull request Apr 18, 2026
…picker-dedupe-names

fix(tui): disambiguate /model picker rows when provider display names collide
ulasbilgen pushed a commit to ulasbilgen/hermes-adhd-agent that referenced this pull request May 1, 2026
…picker-dedupe-names

fix(tui): disambiguate /model picker rows when provider display names collide
aj-nt pushed a commit to aj-nt/hermes-agent that referenced this pull request May 1, 2026
…picker-dedupe-names

fix(tui): disambiguate /model picker rows when provider display names collide
02356abc pushed a commit to 02356abc/hermes-agent that referenced this pull request May 14, 2026
…picker-dedupe-names

fix(tui): disambiguate /model picker rows when provider display names collide
gweeteve pushed a commit to gweeteve/hermes-agent that referenced this pull request Jun 2, 2026
…picker-dedupe-names

fix(tui): disambiguate /model picker rows when provider display names collide
Egavasyug pushed a commit to Egavasyug/hermes-agent that referenced this pull request Jun 10, 2026
…picker-dedupe-names

fix(tui): disambiguate /model picker rows when provider display names collide
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