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).
Since 46176fc14 (v0.1.1320) settings rows are ~12px taller, and the
test's own wheel loop stopped once the currency row's top was 60px down,
which left it under the window's foot at times: Playwright's click then
scrolled to it, and "the currency click moved nothing" read 240 for 180
under load (full GUI run at load ~150; base 2 of 2 green). It now
reach()es the row, as the alert clicks above it already do.
Run: usage-alert.test.cjs (chromium + webkit, every language) 9 of 9
green after the change at load 90-180, 1 red before it of 3.
Not changed: side-effort's chromium de 420 moved 1px once in the full
run; alone 3 of 3 green on this tree, not reproduced.
The owner (10-22, a screenshot of Settings → General): no line above
"Open at login", and the rows' space above and below differed.
- The line between rows is `.row + .row`; Settings' agent-pref link box
(#agentPrefLinks, empty but while searching) sits between "Provider in
model names" and "Open at login", so that row had none. The row after
the box, and the box's own first row, now get it.
- In the window every row had `body.window .row`'s 7px, which beat
`.row.pref` on specificity: one-line rows were centred by min-height
(13-15px around their words), a row with a line under its name had
7-8px. Every settings row now has 12px above and below; the Language
and Session terminal buttons are 26px as the segments are, so every
one-line row is 51px and a two-line row 61px, in both engines.
- A row's new line now grows it ~12px (was 1-2px under min-height).
hold() kept a view at its top only while the clicked control moved
less than half its height, so turning automatic updates off scrolled
About 12px (#2134 says the view stays at its top). The bound is now the
control's height; #961's ~138px stage still holds the bar.
- turn-done, reset-reminder and usage-alert clicked a switch left under
the window's foot or the tabs; Playwright's scroll to it read as the
page moving. They now reach() it first; update-restart's at-top bound
is "less than the switch's height", not 4px.
Run at this tree (worktree magpie-wt/setrows, base 86254d404):
- settings-general: 20/20 (chromium+webkit, 5 languages, 1000/440).
Red with the old CSS (fullContextRow 7px above), and red with only
the line rule taken out ("loginRow has no line above it").
- The 94 GUI files that touch settings rows: 1559 pass, 61 red; against
the old CSS 56 of them passed. Those 56 are fixed above:
update-restart + update-auto 32/32, turn-done + reset-reminder +
usage-alert 36/36. mobile-web's desktop screenshots differ from
origin/main by design (the change itself).
- Red on the old CSS too: s3-sync (webkit en), usage-checkin (webkit en,
zh).
- go test ./internal/gui ok.
Not run before push: the whole GUI suite (830 files) is running now;
reds it finds go in their own commits.
Opening Settings reads the settings twice: the page's own read
(showView), then the window's load() once the state is in. Each read
redraws every row. A test that found a row after the first draw, and
then called scrollIntoViewIfNeeded or boundingBox on it, failed when the
second read landed in between. The errors were "Element is not
attached", or a null box. #1653 fixed the three masking-rules tests and
listed these 37 in #1659.
Each of the 37 now calls watchSettingsReads(page) before every
page.goto, and settingsDrawn(page) right after it. Right after goto is
exact for ?view=settings: at boot, show(view) asks for showView's read
before load() runs. load() sets load.done in the same run that then asks
for its own read, so settingsDrawn's "load.done and every read asked
for drawn" holds only once the second read is drawn. For a test opened
on another page that clicks into Settings later, load is done by then,
the click makes the only read, and the wait passes at once.
watchSettingsReads now watches a page once, however many times it is
opened, since some of these tests open one page several times. The
page is unchanged.
Reproduced with a generic injection (scratchpad inject1659.cjs, loaded
with NODE_OPTIONS=--require). A route added at each goto holds the
page's second GET /api/settings. It lets the read go just as the test
calls scrollIntoViewIfNeeded or boundingBox, or waits on the page with
waitForFunction (which settingsDrawn is), with a 4s timer as a backstop.
This is #1653's injection, made generic.
Before, injected, both engines, all languages:
- 5 files red with the issue's error:
- github-token: null box.
- member-model-setting, searcher-pick, search-first and update-wait:
"Element is not attached to the DOM".
- 4 files red on a check of a row drawn from the first read:
model-suffix-own, otel, readable-focus and warm-at-times.
- 28 green.
After, injected: 36 of the 37 files green, every held read let go by
settingsDrawn's wait. otel stays red in WebKit at 360px. It is red the
same way with no injection, on origin/main's own copy of the test. That
cause is separate (the narrow nav laid out after setViewportSize
returns) and has its own commit next.
Plain (no injection), both engines, all 37 files: 460 cases passed and
2 failed, both otel's WebKit 360px check above.
The 8 files red under injection before, injected again after,
5 rounds: 390 of 390 cases passed.
itieniu asked for a "ding" when a long Claude Code or OpenCode task
finishes. magpie sees every request an agent sends through it, so the
gateway now follows each agent session's turn and the app notifies at
its end.
Gateway (turndone.go): a request is of the turn unless it is one the
agent makes on the side (Kind) or a Claude Code subagent's. Its reply is
scanned on the way to the agent for a tool call in every wire format
(Anthropic tool_use, Chat tool_calls/function_call, Responses
function_call/custom_tool_call/local_shell_call/..., Gemini
functionCall), as a JSON value, never a key ("tool_calls":[]) or text.
The turn is done when no request of it is going, the last reply was
whole, under 400 and called no tool, and nothing more came for 4s; a
session idle past 30m starts over. The ChatGPT backend path is followed
too. Only a turn at least Settings' TurnDoneAlert seconds long is told,
and only when the app set gateway.TurnDone: magpie serve follows nothing.
Settings: turnDoneAlert (seconds, 0 = off, the default, at most a day).
GUI: Settings › Usage "Task done alert": Off / 1 / 3 / 10 min; the
notification says "Codex is done", "Took 1m 8s · folder", in en, zh,
zh-TW, ja and de. A click on it doesn't open the Usage page.
Tests: TestTurnDoneSaidAtTheTurnsEnd (chat and anthropic through the
gateway: a tool reply, a subagent's last reply and a short turn don't
fire; a final reply fires once with session and folder),
TestTurnDoneCodexBackend, TestTurnDoneWaitsForEveryRequest,
TestTurnDoneOff, TestToolScan (every split point), TestTurnDoneText,
settings' range. Broken by hand: without the capture's scan, without the
subagent exclusion, or without the codex backend's scan, they go red.
turn-done.test.cjs: every language, 900 and 380px, chromium and webkit.
The new row moved the Usage tab's geometry: usage-alert and currency
now wheel their row clear of the header before clicking it, as a reader
would (both green 5/5 here; on base they were green as before).
Run: gofmt -l; go vet darwin, GOOS=windows ./..., GOOS=linux gateway and
settings; go test ./... (gateway alone: ok, 863s under a GUI suite's
load); the full GUI suite in both engines. codex-credits and
gateway-key-models fail now and then here on base 398f8469b too
(codex-credits filed as #1622).
Real use: a sandbox HOME, the app's dev build on 3486/3487, "1 min"
clicked in its Settings › Usage (settings.json got turnDoneAlert 60);
then the gateway in that HOME with a TurnDone that logs, and real Codex (codex exec, ChatGPT sign-in, openai_base_url at the
sandbox gateway) running `sleep 62` then answering: the turn's end came
once, agent codex (Codex), its session, folder turnproj, took 1m8s; a
short "reply hi" turn after it didn't fire. The macOS notification
itself wasn't seen: an unbundled dev binary can't post one ("require a
valid bundle identifier"); the notifier is the one usage alerts use.
Claude Code and OpenCode weren't run live; their wire formats are in
the tests.
usage-alert was red in WebKit zh ("no click moved the page", 206 !== 207)
since e9221e96d (#1518) added the Allowance reads row to Settings > Usage
(bisected). In zh the wheel now stops at the bottom of the settings with
the currency row 0.02px above the view (opt top 49.98, view top 50.00).
Playwright scrolls a click's target into view before clicking, and that
scroll is the 1px. scrollIntoViewIfNeeded alone moves it 207 -> 206; no
app script writes scrollTop, and focus, mouse down and up on the option
move nothing. The app changed on purpose and a reader's click moves
nothing, so the test is fixed: the alert clicks are checked against the
wheel's position as before, then the currency row is brought into view
and its click is checked against that.
Run: usage-alert alone, webkit and chromium, en and zh: 5/5 each.
Broken by hand (served app.js: hold() a no-op, the CNY click scrolls the
settings up 30px 600ms later): the new check goes red in en (90 !== 120)
and zh (176 !== 206), in both engines.