Commit Graph
3 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 6915c8cdea agents: a model list's button says its ticks: all, one or two by name, or how many of how many (NG_shiyu on X)
NG_shiyu on X: the closed model field reads 「路由组,模型+数字」 on one
row and just 「路由」 on another, while the menu opened shows every
model either way.

Why: two different controls stand in that place. An agent whose own
model menu is the list picked here (ZCode, Claude Desktop, Cursor
Private Inference, WorkBuddy, T3 Code, ...: listsMenu) has a
multi-select list, and menuSaid named its first two ticked models and
"+N". Routing groups are listed first, so with every model on it read
"Never stuck, DeepSeek Pro +2": like a pick of one group and one
model. Every other agent's start picker names the one model or group
it starts on, e.g. a group named 路由. Neither said "all".

Decided: the list's button (and the panel row's words) says what its
ticks are, as the open checklist shows them and as the Models entry
already words it (fillModelsEntry):
- every model ticked: "All N models";
- one or two ticked: their names (蓝猫's few-picked case, 03421f9f4);
- more: "Showing x / N models";
- none: "No models".
The start pickers keep naming the one model the agent starts on: that
is a single choice and its open menu ticks exactly that one. No new
strings; all four are translated already.

Run:
- agent-menu-label.test.cjs (new): a ZCode list of 4 with the routing
  group first, window and panel (360px), en zh zh-TW ja de, Chromium
  and WebKit: all pass. It ticks all -> 3 -> 2 -> 1 -> none -> all
  back and checks the button, its aria-label and the panel's words, no
  "+N", no <select>, no overflow. On the old app.js it fails:
  expected 'All 4 models', actual 'Never stuck, DeepSeek Pro +2'.
- zcode-models, cursor-local-models, desktop-model-menu updated from
  the old "X, Y +1" to "All 3 models" (ZCode, 3 of 3) and "Showing
  3 / 4 models" (Cursor, Desktop: 3 of 4 on): 16/16 and 8/8 in both
  engines; agent-row-disclose, click-scroll, agent-expand-steady pass.

All of the above ran at base 841bcf8da, where the i18n-keys red was
touches connectRow, expandLink, menuSaid or the three updated tests
(click-scroll changed). At c1660481c on mote, Chromium:
agent-expand-steady 2/2, agent-menu-label 9/10 (ja window: page.goto
timed out at 5s); WebKit's launch timed out at 180s there. mote was at
load ~280 under four full suites and then stopped answering ssh, so
the rest of the run at this head, and the whole GUI suite, were not
run before the push.
2026-10-29 15:08:30 +08:00
yetone ede1e32aec agent, gui: ZCode's row picks which of magpie's models its picker lists, as Pencil's, T3 Code's, WorkBuddy's and Copilot in JetBrains' do now (#1508, NovaTrailX)
settings.hiddenModels had no "zcode", and ZCode's ~/.zcode/v2/config.json
and provider_config.json listed every model. The files magpie writes for
ZCode already leave out what is hidden for it (magpieModels(id) reads
provider.CatalogFor), but its row had no list to hide one in: ZCode's only
field puts magpie in its own picker, with no option among the catalog, and
the Agents page gives a models line and menu only to an agent that has
one (takesCatalog) or ListsModels (Cursor Private Inference).

Audit of every agent row: each agent with a field among the catalog
(viaMagpie) already had the list. Those whose only field puts magpie's
models in their own picker had none: zcode, pencil, t3code, workbuddy,
workbuddy-ai and copilot-jetbrains. They now set ListsModels; Claude
Desktop's tier pickers list the catalog once connected, and cursor-local
had it already.

- agent: ListsModels on those six, its doc says when it applies.
- gui/api.go: the row's JSON says menu (ListsModels), so app.js gives it
  the models button as it does Claude Desktop's and Cursor's, rather than
  a hard-coded set of ids.

Tests:
- TestEveryPickerOfMagpiesModelsCanBeNarrowed: any built-in agent that
  puts magpie in a picker with no option among the catalog and no
  ListsModels fails, so a new agent can't miss it.
- TestZCodeListsOnlyThePicked: from a config the user edited by hand (own
  providers, theme, rules, a manual rule for one of magpie's models, ui
  lang), hiding one model takes it out of both files at the next sync and
  showing it puts it back; the user's entries stay at every step.
- TestZCodeModelList: through the GUI handlers: connect, the row has
  menu and 2/2, hide one, settings.hiddenModels.zcode is set, the row
  reads 1/2, and after SyncCatalog both files list only the other.
- tests/zcode-models.test.cjs: ZCode's row in en, zh, zh-TW, ja, de, in
  the window (1100px) and the tray panel (420px), Chromium and WebKit:
  the line, the menu button, unticking one posts it and the count drops,
  ticking it back; no scroll, no <select>, no overflow. 20/20.
Without ZCode's ListsModels, the first and third fail (tried); without
a.menu in app.js, all 20 GUI cases fail (tried). All in a sandbox HOME;
the live ~/.zcode was never touched.

Run: go test -tags nogui ./internal/agent ./internal/gui; gofmt -l;
GOOS=linux and GOOS=windows go vet -tags nogui ./internal/agent
./internal/gui; node --test on zcode-models, agent-model*, agent-models-*,
agent-notice-lang, click-scroll, cursor-local-*, gui-de/ja/zh-tw and
i18n-keys, both engines: all pass (three load timeouts under a machine
load of ~140 passed rerun alone).

go test -tags nogui -timeout 40m ./... on the rebased tree: every package
ok but internal/gateway, whose TestQueuedStreamKeptAliveForTheMinute hit
its 1.5s read deadline at a machine load of ~130; it passes -count=3 run
alone, and this change touches nothing it runs.
2026-10-11 02:34:30 +08:00