fix(settings/routers): Enter adds the typed model id, never a lookalike
Typing the complete, valid id "qwen/qwen-2" and pressing Enter used to silently add "qwen/qwen-2.5-72b-instruct" instead - the catalog row that substring-matched the query. WHY THIS MATTERS This combobox is the write path for the router allowlist that the backend now enforces at request time, so what lands in it decides which models a user can run at all. An Enter that swaps the intended id for a lookalike writes the wrong model into that allowlist without the user noticing - the labels differ by a truncated suffix - and with per-token pricing varying by orders of magnitude between such neighbors, "close" is not good enough. WHAT AN IMPLICIT HIGHLIGHT IS - AND WHY IT'S GONE onChange used to point the active row at index 0 whenever anything matched, and Enter preferred the active row. That means merely TYPING claimed a highlight the user never asked for. Now the highlight only ever follows an explicit gesture - ArrowDown/ArrowUp or pointer hover - including when the list is opened from the chevron. HOW ENTER RESOLVES NOW 1. explicit highlight → add that catalog row (unchanged); 2. no highlight + id-shaped text → add the typed id verbatim (normalizeTypedModelId, sharing F1's slug-preserving rule); 3. no highlight + non-id text → silent no-op, so Enter mid-search never errors and never adds anything. The "Press Enter to add this model ID." hint now appears whenever the typed text is id-shaped - previously it only showed at zero matches, exactly the case where the trap couldn't fire. Tests: RouterSettingsSection.test.tsx - the exact qwen scenario (typed id added verbatim, no aria-activedescendant after typing, hint visible alongside matches) and the Enter-no-op case. Verified by stashing the fix: both fail on the ported code (the first adds the 72b lookalike). Arrow-key + Enter selection keeps its existing passing test. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
| Repository | open-legal-products/mike |
|---|---|
| Author | Amal <mamalanand3@gmail.com> |
| Authored | |
| Committed | |
| Parents | cf00ee86 |
| Stats | 2 files changed , +71 , -21 |
| Part of | Harden model-router selection and failure handling |
Capture this commit into my fork
Download a Markdown prompt that tells Claude how to port this
exact commit into your working tree. Run it via
claude -p < capture-commit-09757c44.md
from inside the repo you want the change in.