Repository navigation
test(ui-regression): clear the prompt with keys before a readline fixture, and rewrite pushed rosters in the background-tasks check - #3557
Conversation
…ture, and rewrite pushed rosters in the background-tasks check
Two races in scripts/ui-regression.ts that failed a first run and passed the second.
The readline fixtures sent Ctrl+C to the shell prompt and the node command right behind it.
Ctrl+C is a signal: when the command's first byte is readable before bash handles it, bash
runs the line without that byte ("ode: command not found"), and the ten-second wait for the
fixture's banner then waits for a command that already failed. The prompt is now emptied
with Ctrl+E and Ctrl+U, which bash reads in order with the command.
The background-tasks check rewrote only the polled GET /api/machines. The PC also pushes its
roster over the page's socket every five seconds; a push drops the poll in flight and replaces
what a poll brought, and the next poll is 30 s away, past the check's ten-second waits. Every
pushed roster now carries the same change as the poll, through the hook the plan check uses.
No assertion, locator or timeout changed.
Co-Authored-By: Claude Fable 5.2 <[email protected]>
|
No actionable comments were generated in the recent review. Summary
Merge Risk:
|
Local merge gate: PASS
The Linux suites of the required checks (Fast checks, Integration and browser), run on main 1466d30 with this PR's head 8c7825d merged in (local merge 6d677986f78b, not pushed), as groups side by side in the self-hosted CI runner image on
Reruns:
Total 929s. |
Merge passMerged head
One reviewer: owner's test-only PR: three ui-regression scripts, no product code. Test-only PR (three scripts under scripts/): one reviewer (Codex Terra), CLEAR with no findings. |
Why
Two races in
scripts/ui-regression.tsfailed its first run and passed the second, on the self-hosted PCs and on GitHub's runners alike. Both are in the tests: the product delivers every byte and every roster in order. Neither is fixed by waiting longer.1. "readline fixture must start" / "readline fixture did not start"
11 of 307
Browser regression (ui-regression)job attempts since 2026-11-08 (for example run 42754144490, where both in-job attempts lost).The two fixtures (
terminal-command-backspace-regression.ts,terminal-command-arrows-regression.ts) sent Ctrl+C to the shell prompt as cleanup and thenode …readline.cjscommand right behind it. Ctrl+C is a signal. When the command's first byte is readable before bash has handled it, bash runs the line without that byte: the CI screenshots showbash: ode: command not foundandbash: $'D\355\225\234CC\355\225\234node': command not found. The ten-second wait for the fixture's banner then waits for a command that failed within milliseconds.Reproduced outside the browser, in a pty with the test shell's flags and INPUTRC (bash 5.2.21 and 5.3.9, 200 runs each): Ctrl+C then the command with no gap loses the first byte 200 of 200 times; with a 3 ms gap, 0 of 200.
Fix: empty the prompt line with keys, which bash reads in order with the command: Ctrl+E then Ctrl+U (
\x05\x15). In the arrows fixture they go through the browser as Cmd+Right and Cmd+Backspace, the mappings that suite already asserts. The Ctrl+C in eachfinallystays: it ends the node fixture, and nothing is typed behind it.2. The background-tasks check:
.badge[data-status=waiting], "the ring is hollow, bordered and still",.tab-strip-dot[data-status=…]13 of 278 jobs (4.7%) hit it at least once; two runs of
mainwent red because both tries did (42596638439, 42748366477).The check rewrote only the polled
GET /api/machines. The PC also pushes its roster over the page's socket every five seconds, changed or not. A pushed roster drops the poll in flight and replaces what a poll brought, and since #2722 the next poll is 30 s away, past the check's ten-second waits. In all 16 failures read from the artifacts, the check's last poll request fell within 0.15 s of a multiple of five seconds after the server started.That is the intended rule in the product (both transports carry the same roster, and the push is the newer one), so nothing a user sees is wrong.
Fix: every pushed roster carries the same change as the poll, through
window.__rewriteMachinesFrame, the hook the plan check next to it already uses for the same reason. The change is set in the page task that asks for the poll and removed when the check ends.No assertion, locator or timeout changed, and no wait was added.
Proof
All runs in the CI runner image (
herdr-ci-runner:local), in a container of its own, one browser worker each.main+ the poll held until the next pushed roster, every stepTimeoutErrorat.badge[data-status=waiting]main+ the same hold, only while a peer is setTimeoutErrorat.tab-strip-tab[aria-selected="true"] .tab-strip-dot[data-status="working"]main+ Ctrl+C and the command in one writereadline fixture must start(arrows alone)readline fixture did not startui-regression.tspassesui-regression.tsunchanged, three runs each,mainand this branch side by sideThe holds and the one-write variants are temporary patches, not in this PR. Three passes say only that the normal path still works: at a 5% rate they cannot show the race gone, which is what the forced orders are for. One unforced run of
mainduring this work failed at the tab-strip dot by itself, its check starting 14.9 s after the server.Validation
bun run check fast: pass on this head (14413 unit tests pass, 0 fail).ui-regression.tsthat one runs first and fails with the right message); withUI_EVIDENCE_DIRset, one evidence screenshot can still show the last peer, as before this PR.scripts/ui-regression.tsin the runner image: the runs above.ui-contexts-regression.tsandui-contexts-layout-regression.tsdo not import the changed files.bun run check full, the integration suite and the other browser scripts (three test scripts changed, no product code). No changelog fragment: nothing a user notices.Not in this PR
The same Ctrl+C-then-text pattern elsewhere in
scripts/, found by reading:chat-size-regression.ts:1347: a key-bar Ctrl+C tap at a prompt, thenstty size > fileby RPC. A lost first byte would runtty size, and the check would fail after 10 s with "no size-N answer from the pane's shell". The key is what that check tests, so its fix is to wait for^Con the pane, not another key. Not seen failing in the last 36 hours' logs.terminal-copy-regression.ts:275: the same shape, harmless (lear: command not found, then node still runs).recent-folders-regression.ts:67,update-notice-regression.ts:49,wake-lock-regression.ts:85,chat-size-regression.ts:612: they rewrite only the poll, like the check fixed here.recent-foldersis in the flake list (0 failed, 3 flaky); the others were not examined.🤖 Generated with Claude Code