fix: skip missing and embedding models when auto-starting the selected model - #244
fix: skip missing and embedding models when auto-starting the selected model#244Ayush7614 wants to merge 1 commit into
Conversation
…d model getModelToStart's selected-model path returned the selection verbatim, ignoring the missing flag and the embedding model, while both the findFirstLocalModel fallback and the last-used-model path already guard against them. A deleted-weights model could therefore be re-selected on restart and crash at load. The selected-model path now mirrors those guards and falls through to a healthy local model. Adds a 9-case test suite.
|
Thanks @Ayush7614 — the reasoning here is right. The selected-model branch was the one path that didn't check the model was actually loadable, so a broken-link selection could crash the auto-start while a perfectly good model sat one line below in The change needs a rebase before I can take it, and there are two collisions worth calling out explicitly, because resolving them casually would lose something. 1.
|
What
getModelToStart(used on app start and byensureModelForServer,claude-code.tsx,hermes-agent.tsx) returned the selected model verbatim, ignoring themissingflag and the embedding model:findFirstLocalModeland the last-used-model path both guard against broken-link (missing: true) and embedding models — loading them only crashes (see the comment in the same file).Fix
The selected-model path now skips a
missingor embedding selected model and falls through tofindFirstLocalModel, matching the guards used by the other two selection paths.Verification
web-app/src/utils/getModelToStart.test.ts, 9 tests) covering healthy/missing/embedding selections, no-usable-model, last-used preference, and last-used-missing fallback.tsc -bclean,eslint0 errors, all 9 tests pass.