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).
A window shown again hears visibilitychange and focus together, and each
called load(true): two reads of /api/state (every agent's config), with
loadCLIs, loadInstalls, the providers and the Usage refresh after each.
Under focus-follows-mouse every pointer crossing into the window was one
more. loadBack now joins a return to the read asked under a second ago;
a return while an older read is still out gets one read after it, however
many came meanwhile.
Numbers (sandbox HOME, 16 agents, 1230 catalog models, dev build):
/api/state is 2.28 MB and ~55 ms of CPU per read (20 reads: 1.11 s).
Reads per window return: before 2, after 1.
The core's scripts were 1,446,845 bytes, 155 under their budget; loadBack
adds 523. Every page needs it, so it is the core's own: coreScriptBudget
goes to the new total, 1,447,368, plus 1.5% (1,469,000), as the budget's
own rule says.
Test: internal/gui/tests/window-back-once.test.cjs counts /api/state
reads for a return, a later return, and returns during a held read.
On the old app.js: 8 of 8 red, "shown again ... actual 2, expected 1".
Run at this head (load average ~500, nine sessions' suites at once):
node --test window-back-once.test.cjs, Chromium and WebKit, en and zh,
window and panel: 8 of 8 ok. TestCoreScriptBudget ok.
GUI files that fire focus or visibility (15 files, both engines): 194 of
196 ok. claude-usage-asked webkit en passes 9 of 9 alone.
tray-cell-click webkit zh is red alone 3 of 3, on 1a3b92688's own app.js
too: #2686, output added there.
go test -p 4 ./... -timeout 45m (HOME a sandbox): 59 packages ok, and:
- internal/gui: TestCoreScriptBudget red, fixed here (budget above);
TestSetAnswersWhileDevinAndProvidersHang red (13.8s sets), ok alone
(12.6s) and the whole package ok alone (391s): #1375, output added.
- internal/plugin: TestGatewayHookMixedPiPackage red ("starting plugins:
context deadline exceeded"), ok alone (110.8s): #2865, output added.
- internal/agent, internal/library, internal/gateway: timed out at 45m.
agent timed out alone too (2701.5s): #2544, output added. library is
#2853 and gateway #2870. Neither was rerun alone, to keep load off
the machine.
go vet on darwin, linux (nogui) and windows: clean. gofmt -l: clean.