Repository navigation
Remove the hang guard that killed a live worker and named no test - #46
Conversation
|
can we instead try removing the faulthandler configs? might that help? I'm loath to add more configs |
The faulthandler timeout cannot name a stalled browser test. Under the sync Playwright API the test's own frames sit in a suspended greenlet, so the dump sees only OS threads: its one trip on main printed the page server's thread, execnet's reader, and Playwright's event loop, and named nothing. It then exited the worker, which under `--dist loadgroup` leaves the controller on a session that never finishes, so a run already at 99% spent the job's whole 45-minute cap. What it fired on was not a hang either. The suite's slowest browser sweeps run 60-105 seconds on four cores at `-n 2`, so a three-minute clock sits 1.7x above work every run does, and one noisy runner spends that margin. The two things it was meant to buy are already held elsewhere. Playwright's own 30-second timeouts fail a stalled browser wait with the test's nodeid — the shape of the three other recent failures on main. The workflow's 45-minute step bound is what turns a true wedge into the `failure` `tend-ci-fix` answers.
4841984 to
3337041
Compare
|
Yes — it helps more than the tuning did, and I've replaced the PR with it. Pushed as Checking the premise turned up a better reason than the config count. The guard cannot name a stalled browser test. Under the sync Playwright API the test's own frames sit in a suspended greenlet, and faulthandler dumps OS threads — so the trip on main printed the page server's thread, execnet's reader, and Playwright's Both things it was meant to buy are already held, by machinery that wasn't added for it. Playwright's own 30-second timeouts fail a stalled browser wait with the nodeid — the three other recent One thing it gives up, in the PR body rather than here: the untimed cold-cache launcher runs in Also noting rather than changing: |
|
The red It's a GitHub-side runner-allocation problem, not one of ours, and it's hitting the repo more widely: main's Evidence
|
## Problem [Run 33069480665](https://github.com/max-sixty/leaf/actions/runs/33069480665) on `main` did not fail a test — it stopped. The suite ran clean to `[ 72%]` at 12:17:45Z and then wrote nothing for twenty-three minutes, until the step's 45-minute bound killed it. The bound kills pytest rather than failing it, so nothing is written on the way out, and the default terminal reaches the log only once every 72 tests: the run named no test at all, which is the one fact `tend-ci-fix` needed and the only one it could not get. ## Solution Add `-v` to the CI invocation. Under `-v` xdist writes a nodeid when a worker picks a test up and writes it again when the test reports, so the trailing unmatched line is exactly the test that stopped. It watches nothing and ends nothing, so it does not reopen the decision in `pyproject.toml`: the hang guard removed in #46 killed a worker in order to print a suspended greenlet's frames and name no test, and `-v` names the test while intervening in nothing. It also adds no configuration: `pyproject.toml` is untouched and the local default is unchanged, because the problem is CI-specific — on a workstation a wedge is visible in the terminal, while here a killed process leaves the log as the sole witness. No test is weakened and no bound moves. **This does not fix the stall.** The stall is not reproducible and I could not identify it. What it fixes is that the next one will be answerable instead of anonymous. <details><summary>Diagnosis: why no fix for the stall itself</summary> **The stall was not slowness.** The failed run was ahead of a healthy one at the same point — it reached 72% at 22m08s, where the green run on [bf87d64](https://github.com/max-sixty/leaf/actions/runs/33069396385) reached it at 25m16s. Then it produced nothing further. Normal blocks in that region run 2–7 minutes, so twenty-three is 3–4× the worst of them, and it was still silent when killed. **Both workers stopped, not one.** Under `--dist loadgroup` a wedged worker holds only its own batch; the other keeps draining `pending` and the counter keeps moving. It did not move at all. The runner's orphan sweep found both worker processes and both `chrome-headless-shell` processes still alive at the kill, so nothing had crashed either. **The code is not implicated.** The same tree passed on its own PR branch ([run 33066712190](https://github.com/max-sixty/leaf/actions/runs/33066712190), 35m03s), and the two commits that followed it onto `main` — [cbff468](https://github.com/max-sixty/leaf/actions/runs/33072090225) and [03a0f31](https://github.com/max-sixty/leaf/actions/runs/33073047974) — are both green with #79's code in them. `main` is not currently red. **It does not reproduce.** I ran the complete nightly suite on `main` on an `ubuntu-24.04` runner of the same class: `1381 passed, 6 skipped in 2296.13s (0:38:16)`, no failures and no stall, including the whole `test_render_gate.py` / `test_render_navigation.py` region that 72% falls in (`test_render_gate.py` spans items 944–1016 of 1387). That run was under `-v`, which is also where the claim above was checked rather than assumed: 1387 nodeid lines against 1381 `PASSED` lines, and each poll of the growing log ended on the bare nodeid of whatever was in flight — the 283s ring sweep stood alone for 171 lines. Output to a pipe, as in Actions, not a terminal. **The region is not the untimed-launcher class either.** #46 left one shape unbounded — the cold-cache runs in `test_interact_layer.py` that let `uv` resolve through the index with no `timeout=` — and it is not this: those are items 336–463, long finished by 72%, and everything in the stall's region goes through `render_version` and the browser, where Playwright's own 30-second bounds apply. **No upstream incident covers it.** githubstatus lists nothing against Actions in the 12:17–12:41Z window; the only incident open that morning was Copilot AI Model Providers, resolved 12:12:58Z. So this is not the dispatch-layer shape of #47, and it is not the stale-`page.route` cascade of #34 either. **It is the first wedge of its kind.** Across all 54 `ci` failures on `main` with a recorded test step, exactly two spent the full 45 minutes. The other, [32954830645](https://github.com/max-sixty/leaf/actions/runs/32954830645), is the one #46 answered: it reached 99%, the old faulthandler guard fired at three minutes, printed the server thread, execnet's reader and Playwright's event loop, killed `gw1` (`node down: Not properly terminated`) and left the controller on a session that never ended. That was the guard's own wedge and the guard is gone. Every other failure concluded in under 40 minutes on a real assertion. That leaves this one unclassified rather than transient, and `running-tend` says to treat unclassified as durable. A durable cause I cannot name has no safe fix, so the change above is scoped to making the next occurrence nameable rather than guessing at the wedge. </details> <details><summary>Separately: the bound's headroom is thinning fast</summary> Not addressed here — whether the suite should grow or the bound should is not a call to make on one occurrence — but worth seeing. Test-step wall time on `main`, oldest to newest: | Run started (UTC) | Items | Test step | | --- | --- | --- | | 08-26 09:48 | 1230 | 17.6 min to 99% | | 08-26 18:58 | — | 18.2 min | | 08-26 20:47 | — | 19.9 min | | 08-26 21:04 | — | 24.3 min | | 08-27 00:24 | — | 24.9 min | | 08-27 03:51 | — | 26.4 min | | 08-27 06:31 | — | 36.7 min | | 08-27 11:53 | 1381 | 36.0 min | | 08-27 12:41 | — | 35.4 min | The bound is 45. Note that the item count rose 13% while the time rose 110%, so this is per-test cost rather than test count. Four tests carry 13 of the roughly 76 worker-minutes, all corpus sweeps and three of them on `gallery`: ``` 283.65s test_render_controls.py::test_every_ring_the_layer_draws_is_shown_whole_somewhere_in_the_corpus 245.85s test_render_controls.py::test_a_press_leaves_its_neighbours_where_they_were[gallery] 140.72s test_render_controls.py::test_an_aimed_press_does_only_what_the_outline_promised[gallery] 109.79s test_render_anchors.py::test_every_passage_in_a_real_page_can_be_quoted[gallery] ``` `-n 2` is also the whole machine's allowance on a 4-vCPU runner, where the cap's stated reason — "keep overlapping browser test suites from saturating the machine" ([1ee98fe](1ee98fe)) — is a workstation's reason, and in CI no second suite exists. I have not touched it: more workers is more browser load on exactly the shape of race `running-tend` says dominates red runs here, and that trade is not mine to make. </details> <details><summary>Cost of `-v`</summary> About 2,800 lines and ~250 KB of log per run, in place of ~20 progress lines. The visible cost is to `gh run view --log-failed` on an ordinary red run, which now carries the roster ahead of the traceback. </details> --- Automated fix for [failed run 33069480665](https://github.com/max-sixty/leaf/actions/runs/33069480665) Co-authored-by: leaf-agent <[email protected]>
Reopen in the floating panel left focus on the pressed button, which turned into Resolve, so what the user typed next went nowhere until they clicked the field. Reopen now gives the panel a settlement landing that puts the caret in the reply the reopening draws; a refusal, or `z` while the user has not acted since, stands them on the thread's view again, through the same mechanism Resolve's landing uses. A rewrite saved in a resolved thread also reopens it, and its editor's landing ran before the reopened thread drew a reply box, so the user ended on the thread rather than in the reply #46 chose for them. The landing now follows the save's presentation into the box it draws, in the panel and in a seated thread alike. The panel test of that decision had been weakened to `to_be_visible` when the classic chrome went; it asserts focus again. Cards needed no change: Reopen in a margin card or a seated thread already lands in the reply, in Chromium and Firefox. A page comment being written keeps its words, focus and caret across an in-place or a fresh revision in both engines, so that case needed no change either. Picked as `gain-caret` on the floating-panel review page. > _This was written by Claude Code on behalf of max-sixty_ Co-authored-by: Claude Opus 5.5 (1M context) <[email protected]>
The Claude Code journey reads the session's transcript while Claude Code is still writing it, between steps and as it breaks a reply down. When the read caught a record half-written, the last line didn't parse, and the journey failed with a `JSONDecodeError` even though the session itself was fine. That happened twice in one batch of #46 benchmark runs. `native_records` now decodes only the bytes up to the last newline, leaving out the record that isn't finished. Those bytes can end inside a character, so it splits before decoding. The next read picks the record up once Claude Code finishes writing it. The transcript test now ends its file in a half-written record cut inside a two-byte character. It fails without the fix and passes with it. This is the transcript-read fix from Max's decision #46 on the overnight report. The #46 experiment itself stays unmerged on `opening-progress-experiment`. > _This was written by Claude Code on behalf of max-sixty_ --------- Co-authored-by: Claude Opus 5.5 (1M context) <[email protected]>
The Claude Code journey's transcript reads still failed with `JSONDecodeError: Unterminated string`, after #3700. The cause was not a half-written last line, as #3700 assumed. Claude Code writes U+2028 and U+2029 raw inside JSON strings, which JSON allows, and both readers split the transcript with `splitlines()`, which breaks a line at those characters. A transcript kept from a failed run held one U+2028 and one U+2029: 113 newlines, but 115 lines to `splitlines()`. Both readers now share `reply_phases.transcript_records`: - `journey_claude_code.native_records` reads the journey's session. - `claude_code_transcript` reads a session for `leaf-dev response-times`. It splits only at the newline Claude Code writes after each record, and keeps #3700's rule of leaving out a record still being written. The transcript test now holds a raw U+2028 inside a string. It fails without the fix and passes with it. This follows up #3700, the transcript-read fix from Max's decision #46 on the overnight report. `leaf.event_log.jsonl_line` already escapes these characters in the page log for the same reason. > _This was written by Claude Code on behalf of max-sixty_ --------- Co-authored-by: Claude Opus 5.5 (1M context) <[email protected]>
#6982) When a test outlives `faulthandler_timeout` (30 minutes), the worker's dump lists every OS thread. Under Playwright's sync API, though, the test's own frames sit in a suspended greenlet, so the dump shows only Playwright's event loop and never the line whose call is waiting. #46 named this gap when it removed an earlier guard. It also left the one hang in #6807 (`test_page_fixture_renders[feature-gallery]` on macOS) with no location. Now, a minute before the timeout, `tests/conftest.py` prints the stack of every suspended greenlet to the run's own stderr, next to faulthandler's dump. It only prints: no test is failed and no worker is stopped. To verify, I ran a scratch test that waits in `page.evaluate("() => new Promise(() => {})")` with `-o faulthandler_timeout=75`, under both `-n0` and `-n1`. Before the change, the dump ended at `playwright/sync_api/_context_manager.py ... greenlet_main`. After it, the output also holds the greenlet's stack, ending at the scratch test's `evaluate` line. Then faulthandler's dump follows and the worker crashes as before. `tests/model` passes except for three `test_codex_adapter.py` cases that fail the same way on `main` in this sandbox (`OSError: [Errno 97] Address family not supported`). The stderr written to is a copy of fd 2 taken at `pytest_configure`, because output capture redirects `sys.stderr` during a test and that output would be lost when the worker exits. Refs #6807 — automated triage. This adds what the next hang will need for a diagnosis; it doesn't fix the hang, nor the document-scroll and quoting failures that issue also tracks. --------- Co-authored-by: leaf-agent <[email protected]> Co-authored-by: leaf-agent <[email protected]>
Problem
Run 32954830645 reached 99% of the suite, tripped the 180s faulthandler guard, killed
gw1, and then sat silent for twenty-five minutes until the step's 45-minute bound ended the job. The guard bought a stack dump that named no test, and gave the rest of the budget back.It cannot name one. Under the sync Playwright API a test blocked on the browser has its own frames in a suspended greenlet, and faulthandler dumps OS threads — so the trip printed the page server's thread, execnet's reader, and Playwright's event loop, and nothing else. Exiting the worker is then worse than doing nothing: xdist clones a replacement, and under
--dist loadgroupthe clone never picks the run back up.What it fired on was probably not a hang. The suite's slowest browser sweeps run 60–105s on four cores at
-n 2— the shape of machine CI runs on, at the same wall time — so a three-minute clock sits 1.7× above work every run does, and one noisy runner spends that margin.Solution
Remove
faulthandler_timeoutandfaulthandler_exit_on_timeout. Both things the guard was meant to buy are already held elsewhere, by machinery that was not added for it:cifailures on main — each oneFAILED tests/test_render_projection.py::test_a_message_reference_travels_or_says_it_cant - TimeoutError, named, at ordinary cost.failuretend-ci-fixanswers, and that is the fault Bound the suite so a wedged run fails instead of vanishing #30 was actually about.Net two lines fewer than main, and nothing added.
What the dump actually printed
Three threads, no test frame among them: the page's dev server, execnet's reader, and the driver greenlet the main thread was sitting in.
What this gives up
One class the guard could have named, had it ever fired there: a wait with no timeout of its own outside the browser. The cold-cache launcher runs in
test_interact_layer.pyshell out tobin/leafand letuvresolve through the network with notimeout=. Those have never hung, and the direct fix if they ever do is atimeout=on the call — which names the test and raises in place, rather than exiting a worker the run cannot continue without. Not doing that here; no evidence asks for it yet.The
pytest>=9.1floor was raised in aef67af solely forfaulthandler_exit_on_timeoutsupport. Left alone —uv.lockpins 9.x either way, and lowering it would be a guess at a version the suite has not been run on.Testing
uv run pytest tests—574 passed, 6 skipped in 141.73s.pre-commitpasses on the changed file. This PR's owncirun exercises the config over the full--run-nightlysuite.