3.9 KiB
Bugfix plan — /model picker never asks its scope (gateway ids + silent passthrough)
Bug report (user, 2026-10-29): "quand je fais un /model ça change pas le fable 5.1 comme ça devrait". Repo /home/bchanot/Documents/claude, .claude/settings.local.json pins "model": "claude-fable-5-1[1m]"; bare /model, pick the "Opus 5.5" row (not Default, user-confirmed); native output "Set model to Opus 5.5 and saved as your default… settings.local.json pins Fable 5.1 — applies on restart"; no scope question (BDR-127 expects This project / This conversation / Everywhere).
Diagnosis
- PROVEN (transcript cdd27037, 2026-10-29T10:27, before a
/login): the picker listed a gateway (OpenAI: GPT-6 Astra,Anthropic: Claude Opus 5.5); after each pick the mod loggedmodel-router: anthropic/openai/gpt-6-astra unknown to the models table; no switchthen… anthropic/claude-opus-5.5 unknown …(unknownCall, register.ts:1351, via canonical() at :1393). Gateway ids are provider-prefixed with a dotted version.knownModel(register.ts:2134) andcanonical(:1086) only knowclaude-opus-5-5etc. (DEFAULT_CONFIG.models :270) →handlePicker(:2408) returnsnext(e)→ native, silent; the main decision also treats the session model as unknown (never switches). The first pick also wrote"model": "anthropic/claude-opus-5.5[1m]"into the tracked settings.json (native Everywhere). - NOT PROVEN (13:52, after
/login, labelOpus 5.5without provider): no deny, no log.handlePickerhas 4 silent passthrough exits:e.source !== 'picker',st.off, non-string or unknownrequested_model,surfaces().length === 0. None logs, so the cause cannot be read.
Prior: BDR-127 (picker scope; live test 2026-10-25 with native ids), LRN-231, BLK-036. None covers the gateway id form.
Fix plan
mods/model-router/hooks/register.ts: one normalizerbareId(id)used first bycanonical()andknownModel():- strip a leading
anthropic/(once); - if the rest starts with
claude-, dotted version digits → dashed (claude-opus-5.5→claude-opus-5-5,claude-haiku-5.5[1m]keeps[1m]handling as today); - anything else unchanged (
anthropic/openai/gpt-6-astra→openai/gpt-6-astra, still unknown → native, as today).fullId()keeps returning the token AS RECEIVED for a non-alias token (so settings.local.json and the sticky route carry the engine's own id: safest switch target on that account).
- strip a leading
handlePicker: whene.source === 'picker'and the hook passes through to native, onetryLoglinemodel-router: picker → native: <reason> (<requested_model|Default>), reason ∈ {off, unknown id, Default, no surface}. Not logged for source command/sdk/auto/resume (those have their own paths and would spam).mods/model-router/hooks/register.test.ts:- picker:
anthropic/claude-opus-5.5is denied at once and the deferred question comes (regression for cause 1); the question namesanthropic/claude-opus-5.5(as received); This project writes that id into settings.local.json; anthropic/openai/gpt-6-astrapasses through (non-Anthropic stays native) and logspicker → native: unknown id;- each existing PASSTHROUGH row with source picker now asserts its log line; source command/sdk rows assert NO picker log;
- canonical:
anthropic/claude-opus-5.5andanthropic/claude-opus-5.5[1m]rank likeopusin the main decision (no "unknown to the models table" line).
- picker:
- Proof after merge-ready: user runs
/reload-plugins,/model→ Opus 5.5 row: either the question appears, or the new log names the passthrough reason (cause 2 then gets its own bugfix).
Out of scope
Router-initiated switches on a gateway account (they send claude-opus-5-5; acceptance there unverified, named as a risk). The tracked settings.json model write by native Everywhere (BDR-131 policy handles it).
Tests
make test suite=lib/tests/mods.test.sh (runs claude plugin test on the mod) + full make test.