Commit Graph
2 Commits
Author SHA1 Message Date
yetone ce8b67de37 gui tests: a page's first load gets a minute, not a click's 5s (#4470)
claude-switch-only set page.setDefaultTimeout(5000) and then called
page.goto with no timeout of its own, so Playwright held the first load
of app.js, i18n.js and the plugins to the 5s bar meant for clicks. On a
busy box (a whole-suite run at load 130-160) that load took longer and
goto timed out. The same pattern is in 988 GUI test files (1174 pages):
every one of them now also sets setDefaultNavigationTimeout(60000) on
the same page, right after its default, so goto, reload and waitForURL
wait on the load itself with room, while clicks and waits keep their
short bar. group-from-model-add's own 20s navigation bar is raised to the
same minute. claude-switch-only also gives its first provider row (drawn
from the page's first reads) a minute before clicking it.

nav-timeout.test.cjs (no browser) reads every GUI test file and names
each page given a default under a minute without a navigation timeout of
at least a minute, so a new file can't bring the pattern back.

What was run (WSL magpie-desktop, Playwright 1.62.0, load 70-260 from
other sessions):
- node --check on every file in internal/gui/tests: all parse.
- nav-timeout.test.cjs against origin/main's test files: red (names the
  1174 pages); against this tree: its only reds were my own probe copies
  of the old files, since removed.
- By hand: claude-switch-only with app.js served 7s late (a busy box's
  first load), --test-name-pattern "1100 en": origin/main's file 4 of 4
  red with "page.goto: Timeout 5000ms exceeded"; this file 4 of 4 green.
- claude-switch-only.test.cjs, both engines, en/zh/ja/de, 1100 and 420:
  32 of 32. group-from-model-add, usage-access-key-card and i18n-keys:
  green. agent-plugin-agents: Chromium green; WebKit's de 420 subtest red
  on a 5s waitForFunction at line 115 (a wait after load, not the
  navigation), at load ~230.

Not tried: the whole GUI suite (about 1000 files; the change is one
mechanical line per page), Windows or mote (mote's browsers, #4125).
2026-10-31 02:09:18 +08:00
yetone d5f434f308 gateway, gui: an Image recognition or Image generation model picked in Settings that magpie can't find any more is no longer replaced in silence: Settings › Models marks it missing and says what describes or draws in its place, and the description's row in Routing names it beside the automatic model that described instead (found on #1287)
Before, if the picked model didn't resolve (its provider removed or turned off, or the model gone), seer() and drawer() quietly fell back to AutoVision/AutoDrawer. Settings still showed the gone id as the pick, and Routing showed only the automatic model. The turn still goes ahead with the automatic model, so nothing the user sends breaks. What changed is that magpie now says so:

- VisionMissing and DrawerMissing (pickedMissing) name the pick that doesn't resolve. /api/settings carries them as visionMissing and imageGenMissing.
- CallFor.Missing is set on every description (withDescribeFor). This covers the single-model and group paths and every protocol. routing.js tells that story first.
- With no automatic describer either, the 400 and 502 a turn is refused with name the missing pick and where to change it. So does a draw request that names no model.
- renderImages and renderImageGen show "<id> · missing" in the picker and a red line under the row. The line names what stands in, or says nothing does, and asks the user to pick another model.
- zh, zh-TW, ja and de are translated.

Verified:
- New internal/gateway/vision_missing_test.go. I took out the behaviour (Missing on the row, the notes, the draw message) but kept the helpers so it compiles. Both tests then FAIL:
  vision_missing_test.go:80: probe/text anthropic: the description's row is for {Agent:other Model:probe/text Unknown:false Missing:}, want it to name the missing gone/bigeye
  (the same on responses, codex and chat, and for group/mixed)
  vision_missing_test.go:116: probe/text with no describer: 400 ... "model \"probe/text\" does not support image input"
  vision_missing_test.go:135: no drawer: 400 ... "no model to draw with: pick one in magpie's Settings → Images → Image generation, or name one"
- New internal/gui/tests/images-missing.test.cjs checks Settings › Models in en and zh at 1000px and 360px: the picker text, the line inside its row, and no page overflow. A pick that is found shows as before. routing-vision-why.test.cjs gains the missing row. With app.js and routing.js from before this change (Chromium): pass 2, fail 7.
- node --test images-missing, routing-vision-why, routing-side-calls, settings-sections, gui-ja, gui-de, gui-zh-tw and i18n-keys in Chromium and WebKit: 42 pass, 0 fail.
- go vet -tags nogui ./internal/gateway ./internal/gui passes on darwin, GOOS=linux and GOOS=windows. go build -tags nogui ./... passes.
- HOME=<tmp> go test -tags nogui ./internal/gateway ./internal/gui: ok (208.5s, 36.9s).

Not verified: no real magpie instance with a provider actually removed. The gateway was exercised through Handler with fake upstreams, and the GUI with a faked /api/settings. Drawing's own Routing row still doesn't say its model fell back: drawing calls have no story in kindWhy. Only the Settings row and the refusal say it.
2026-10-08 19:08:09 +08:00