Thread the live model into the picker instead of inferring it - #367
Conversation
The picker marks "(current)" on recents[0], which only moves on an explicit /model pick. A session that never switches models, with recents naming a different model, gets no marker on its real model and a wrong one on a stale recent.
recentModels[0] only updates on an explicit /model pick, so a session running on defaultProvider from settings, having never switched via the picker, got the wrong row marked "(current)" (or none at all) whenever recents pointed elsewhere. Runner.ts now passes the session's live provider+model down through RunnerHostDeps.activeModel and ProductHostConfig.activeModelId, read fresh on every picker open. The recents-based guess is gone.
The picker no longer infers "(current)" from recents[0]; the test now supplies activeModel explicitly, matching how runner.ts wires it.
Independent review — ready to mergeVerified by running, not by reading. Held open for human review, not merged. The stale-recents bug is fixed. A real rendered frame with recents holding Degrades sanely when the live model is absent from the catalog. No test covered this, so the reviewer wrote one: an One path, not two. The optional config degrades to no marker, not to the old behavior. A host omitting The threaded values are genuinely live. Red/green is real. Typecheck and build clean. 4038 pass / 0 fail, identical under One trivial note, deliberately not sent back to the author: |
Summary
The model picker marked "(current)" on
recentModels[0]— the modelmost recently switched to via
/model— instead of the model thesession was actually running. A session that starts on
defaultProviderfrom settings and never opens the picker getsmislabeled whenever a previous session's recents point elsewhere: the
wrong row reads
(current), and the real model gets no marker at all.Fixes CL-5597 by threading the live
provider/modeldown throughRunnerHostDeps.activeModel→ProductHostConfig.activeModelId, readfresh on every picker open. The recents-based guess in
product-host.tsis deleted, not kept alongside the real value.Net diff: +63/-6 lines, mostly test coverage (two new/updated tests);
production code (
product-host.ts,runner-host.ts,runner.ts) isnet smaller than before — it deletes the inference helper and adds one
line of live wiring.
Verification
bun run typecheck— passesbun run build— passesbun run test— 4038 pass, 0 failbun test ./src ./tests ./evals --randomize --seed 42— 4038 pass, 0 failConfirmed red: with the fix's
activeModelIdwiring reverted, the newproduct-host.test.tscase fails (xai/thegreataxios / grok-4.5 (current)shown instead of the live
codex/abk-labs), then passes after restoringthe fix.
Rendered a real frame: recents hold
xai/thegreataxios / grok-4.5from aprior session; this session runs
codex/abk-labs / gpt-5.5and neveropened
/model. The picker now marks the live model, not the stalerecent:
Closes CL-5597