Skip to content

test(ui-regression): clear the prompt with keys before a readline fixture, and rewrite pushed rosters in the background-tasks check - #3557

Merged
devswha merged 1 commit into
mainfrom
test/ui-regression-races
Nov 10, 2026
Merged

devswha merged 1 commit into
mainfrom
test/ui-regression-races

Conversation

@devswha

@devswha devswha commented Nov 10, 2026

Copy link
Copy Markdown
Owner

Why

Two races in scripts/ui-regression.ts failed 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 the node …readline.cjs command 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 show bash: ode: command not found and bash: $'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 each finally stays: 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 main went 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.

Run Result
main + the poll held until the next pushed roster, every step TimeoutError at .badge[data-status=waiting]
main + the same hold, only while a peer is set TimeoutError at .tab-strip-tab[aria-selected="true"] .tab-strip-dot[data-status="working"]
this branch + the same holds the check passes every step, each within one push period
main + Ctrl+C and the command in one write readline fixture must start (arrows alone)
this branch, with only the clearing keys put back to Ctrl+C, in one write readline fixture did not start
this branch + the clearing keys and the command in one write the arrows fixture alone passes; all of ui-regression.ts passes
ui-regression.ts unchanged, three runs each, main and this branch side by side 3 of 3 and 3 of 3 pass

The 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 main during 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).
  • An independent review agent tried to break both fixes (event orders in the check, the two transports' rosters field by field, the clearing keys in every line state these fixtures reach) and found nothing above a note. Its notes: a pushed roster also seeds the page's alert bookkeeping, which no assertion reads before the page's next reload (now said in the comment); the arrows fixture's launch relies on the Cmd+Backspace mapping that only the backspace fixture asserts (in ui-regression.ts that one runs first and fails with the right message); with UI_EVIDENCE_DIR set, one evidence screenshot can still show the last peer, as before this PR.
  • scripts/ui-regression.ts in the runner image: the runs above. ui-contexts-regression.ts and ui-contexts-layout-regression.ts do not import the changed files.
  • Skipped: 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, then stty size > file by RPC. A lost first byte would run tty 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 ^C on 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-folders is in the flake list (0 failed, 3 flaky); the others were not examined.

🤖 Generated with Claude Code

…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]>
@coderabbitai

coderabbitai Bot commented Nov 10, 2026 •

Copy link
Copy Markdown

Explain Change →

No actionable comments were generated in the recent review.

Summary

Summary by CodeRabbit

  • Tests
    • Updated regression checks for terminal keyboard input and command-line behavior.
    • Expanded interface regression coverage for background-task status updates, including working, completed, blocked, and idle states.

The terminal regression scripts change the keys sent before fixture commands. The UI regression rewrites machine rosters during background-task checks, varies peer statuses, and clears the rewrite before a later refresh.

Changes: Terminal key setup

Layer / File(s) Summary
Readline fixture setup
scripts/terminal-command-arrows-regression.ts, scripts/terminal-command-backspace-regression.ts
The scripts replace the pre-command Ctrl+C with Cmd+Right followed by Cmd+Backspace, or Ctrl+E followed by Ctrl+U, respectively.

UI background-task regression

Layer / File(s) Summary
Background roster refresh
scripts/ui-regression.ts
The regression adds a helper that rewrites machines payloads and dispatches visibilitychange for background-task and peer-status checks. The final refresh clears the rewrite before dispatching the event.

Estimated code review effort: 2 (Simple) | ~10 minutes

Change: Other

Suggested reviewers: wouldu-pres

Merge Risk: Minimal · up to 8c782

No merge-blocking issue was identified in the regression-test changes.

Pre-merge checks: Passed 5

Check name Status Explanation
Title check Passed The title clearly identifies both main changes: clearing the prompt before launching the readline fixture and rewriting pushed rosters in the background-tasks check.
Description check Passed The description explains the problems and resulting changes, and reports validation performed and skipped. It covers the required Change and Validation information, though it uses different section he…
Docstring Coverage Passed Docstring coverage is 100.00% which is sufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff with cyclomatic complexity of at least 2. Documentat…
Linked Issues check Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check Passed Check skipped because no linked issues were found for this pull request.
Full details: Description check

Explanation

The description explains the problems and resulting changes, and reports validation performed and skipped. It covers the required Change and Validation information, though it uses different section headings from the template.

Full details: Docstring Coverage

Explanation

Docstring coverage is 100.00% which is sufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff with cyclomatic complexity of at least 2. Documentation-only edits and deletions within surviving functions are included; unchanged diff context and fully deleted functions are excluded. Analyzed 2 functions across 3 files.

Finishing Touches

Generate docstrings

  • Commit to this branch
  • Create a new PR
Generate unit tests (beta)

  • Commit to this branch
  • Create a new PR
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

Share

Recent review info

Run configuration

Commits

Reviewing files that changed from the base of the PR and between 1466d30 and 8c7825d.

Files selected for processing: 3

  • scripts/terminal-command-arrows-regression.ts
  • scripts/terminal-command-backspace-regression.ts
  • scripts/ui-regression.ts

Included review availability: This review used your included allowance. Your plan provides up to 8 included reviews per hour; 5 remain after this review.

@devswha

devswha commented Nov 10, 2026

Copy link
Copy Markdown
Owner Author

Local merge gate: PASS

Local merge gate: PASS #3557 merge=6d677986f78b head=8c7825d912ef main=1466d30fdc0f on herdr-ci-runner:local on devswha-ThinkStation-P620 CPUs 64-127 in 929s, reruns=1

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 herdr-ci-runner:local on devswha-ThinkStation-P620 CPUs 64-127 (14% busy before the start, host load 71.85; shards=4 unit_workers=8 browser_main_workers=2 browser_other_workers=16). Scope: full. Native Windows install and the macOS checks are not part of this gate.

Step Command Result Seconds Counts
fast-install bun install --frozen-lockfile pass 0 -
release-guards bun scripts/release-guards.ts --base 1466d30fdc0f pass 0 -
fast bun run check fast pass 213 tests 14465 pass / 0 fail; check steps 6 ok / 0 failed
integration-install bun install --frozen-lockfile pass 0 -
integration bun run check integration pass 229 tests 1385 pass / 0 fail; check steps 3 ok / 0 failed
browser-main-install bun install --frozen-lockfile pass 0 -
browser-main-build bun run build pass 15 -
browser-main BROWSER_SCRIPTS=ui-regression,ui-contexts-regression bun run check run -- bun scripts/ci-browser-parallel.ts pass 432 browser scripts 2/2 passed
browser-other-install bun install --frozen-lockfile pass 0 -
browser-other-build bun run build && bun run build:shell pass 20 -
browser-other BROWSER_EXCLUDE=<those two> bun run check run -- bun scripts/ci-browser-parallel.ts pass 899 browser scripts 185/185 passed

Reruns:

  • browser scripts/relay-e2e-regression.ts failed, then passed on its automatic second run

Total 929s.

@devswha
devswha merged commit 815a292 into main Nov 10, 2026
12 checks passed
@devswha

devswha commented Nov 10, 2026

Copy link
Copy Markdown
Owner Author

Merge pass

Merged head 8c7825d912ef as 815a2929f6bf on the local merge gate, with no unresolved review threads.

Reviewer Verdict Note
codex CLEAR

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant