Repository navigation
Give the suite's rendered-frame waits a deadline of their own - #84
leaf-agent wants to merge 7 commits into
Conversation
`page.evaluate` takes no timeout, so a promise the page never settles blocks the worker for as long as the job lives. Every render test waits on one: `navigate` ends its handover on a rendering turn, and eleven more sites ask for one the same way. rAF stops in a page the compositor has stopped drawing, and the worker's last word is then the nodeid it picked up — runs 33130006054 and 33130455313 each spent the step's whole 45 minutes there. State the wait once, in `FRAMES`, with a deadline on the page's own clock. A rejected promise comes back through `evaluate` as the failure of the test that asked for it, which is what the removed hang guard could never name.
leaf-agent
left a comment
There was a problem hiding this comment.
Three evaluate frame promises are still unbounded, so the class isn't closed. The harness comment says "A frame wait is the one browser wait Playwright does not bound … So the wait states its own end", and the PR body says "If the next wedge is elsewhere, it will now say so" — but a wedge at any of these still ends the way runs 33130006054 and 33130455313 did, with no traceback:
test_render_navigation.py:918—const frame = () => new Promise(r => requestAnimationFrame(() => r()));intest_an_address_is_never_drawn_on_the_key_line, awaited twice per iteration across 21 scroll positions. Same module as the render-navigation family, and the most exposed of the three.test_render_projection.py:3571—await new Promise(resolve => requestAnimationFrame(resolve));intest_command_hub_stops_listening_after_live_version_replacement.test_site.py:268—AFTER_THE_DRAG; thesetTimeoutbounds the queue hop, not the frame.
All three are composable, and the suite already shows the shape: RING_NEW_STOP in test_render_controls.py does await ({RENDERED})(); inside a larger page script. Either convert them, or narrow the claim in the FRAMES comment to the harness's own waits.
FRAMES' justification for the page-side clock — "there is no seam to hang a driver-side deadline on" — isn't right. page.wait_for_function takes polling=<ms>, so a flag set from a nested requestAnimationFrame plus a polled wait is a deadline on Playwright's clock, and its TimeoutError names the test the same way. The page-side version is still the better trade here — one round-trip, no page-global flag name, and it composes into scripts like RING_NEW_STOP where a two-call form can't — but it's a trade, not an absence of options. It also matters for what the deadline covers: setTimeout and requestAnimationFrame share the renderer's main thread, so this bounds a page whose compositor stopped, not one whose main thread is blocked. That second shape still wedges silently.
lint is red on event_endpoint.py, which this PR doesn't touch — ruff format collapses two calls the branch's base still has spread over three lines. It's inherited from the base commit 19227b2, and main has since fixed it in 02cce9c. Merging main in (or re-running the job once the merge ref recomputes) clears it; nothing in this diff is implicated.
Not approving because I authored this one.
|
Three more wedges have landed on
The bottom three are not in the PR body; 33131937176 is the run that dispatched this How each name was read, and a caveat for re-probing the old waitUnder the gh run view <id> --log-failed > run.log
comm -23 \
<(grep -oP '(?<=Z )tests/\S+' run.log | sort -u) \
<(grep -oP '\[gw[01]\] \[[ 0-9]+%\] \w+ \Ktests/\S+' run.log | sort -u)The idle second worker is not a second wedge. A caveat if anyone re-probes the unbounded expression: whether it hangs depends on the resolver staying referenced. Stub |
The three `evaluate` frame promises the deadline had not reached — the scroll sweep in `test_an_address_is_never_drawn_on_the_key_line`, the update count in `test_command_hub_stops_listening_after_live_version_replacement`, and `AFTER_THE_DRAG` in `test_site.py`, whose `setTimeout` bounds the queue hop and not the frame — now ask through `ONE_FRAME` and `RENDERED`, so the claim that a frame wait states its own end holds for the whole suite. The deadline's message says how many turns arrived rather than how many were asked for: zero is a compositor that stopped before the wait, one of two is a compositor that stopped inside it, and those are different bugs. `FRAMES` no longer claims there is no driver-side seam. A flag a nested `requestAnimationFrame` sets, read by `wait_for_function(polling=...)`, is one; the page-side clock is a trade against it, and the comment now says what the trade buys and what the shared main thread leaves uncovered.
|
Review actioned in The three unbounded sites are converted, so the claim in the That closes the class. The four awaited frame promises left in The seam claim is corrected. The comment no longer says there is no driver-side option; it names the
Verification
The full |
leaf-agent
left a comment
There was a problem hiding this comment.
nextFrame is a twelfth awaited frame promise, and it is unbounded — so the FRAMES comment's "A frame wait is the one browser wait Playwright does not bound … So the wait states its own end" and the PR body's "every awaited frame promise in the suite now goes through them … That is the class closed" are both false as written.
// plugins/leaf/skills/leaf/scripts/leaf/render-checks.js
export const nextFrame = () => new Promise(requestAnimationFrame);It reaches page.evaluate through evaluate_probe, from the last line of the gate's per-scheme read — evaluate_probe(page, "nextFrame"), under the comment about the print reset resizing what an observer watches. It is therefore neither one of the four test_render_anchors.py promises with a two-second deadline of its own, nor a fire-and-forget sampler the driver polls. It is also the one site of the class that is not test code: leaf version check --render runs it on every page it gates, so a page whose compositor has stopped hangs a user's command with no output. Inside the suite it is on render_version's path, which eight files call — test_render_gate.py, test_render_controls.py, test_render_options.py, test_render_pages.py, test_render_projection.py, test_render_widgets.py, test_smoke.py, and render_cases_layout.py.
render_checks.py already states the rule this breaks, immediately above the constant a fix would reuse: "Keeping the server request timeout beside it turns a wedged preview into a useful failure rather than an unbounded evaluate", over SERVED_TIMEOUT_MS = 30_000. _LOAD_PROBES in the same file already has the shape — Promise.race against a setTimeout that rejects naming what did not arrive — and _call already hands every probe its timeoutMs, so nextFrame can take it as an argument rather than growing a second constant. That also keeps the gate and the suite stating one frame wait rather than two, which is the drift watched's own docstring warns about for the error channel: "one implementation with two callers is what keeps version check --render and this suite holding the same invariants".
Bounding it here or in its own PR are both defensible — it is product behaviour rather than suite behaviour. But if it is split out, the FRAMES comment and the PR body have to stop saying the class is closed.
Smaller: the PR body's Bug-back block still prints Error: 2 rendering turns never arrived under # this branch. aa3bac1 replaced that message; the branch now says only 0 of 2 rendering turns arrived.
What I checked on this push
- Both inline suggestions applied verbatim. The new message's arithmetic holds: running the generated
FRAMESsource under a stub that serves a fixed number of frames and then retains the callback givesonly 0 of 1(turns=1, none served),only 0 of 2,only 1 of 2, and resolves at turns=2 with two served. - The three conversions keep their turn counts —
await frame(); await frame();→RENDERED, which isFRAMES(2); the two single-frame sites →ONE_FRAME.AFTER_THE_DRAG's reads move from inside therequestAnimationFramecallback to the microtask after it, which is the same rendering turn, and neither read depends on layout. - All three composed scripts parse: the f-strings were evaluated against the real
ONE_FRAME/RENDEREDand each result passednode --check. - Every remaining
requestAnimationFrameintests/is either one of the four boundedtest_render_anchors.pywaits or a sampler (FRAME_BY_FRAME,ROOM_EVERY_FRAME, the scroll and drafts samplers,test_render_gate.py'shold).nextFrameis the only one outsidetests/. lintis green on this head, so the inheritedevent_endpoint.pyfailure is cleared by the merge as the last review expected.testis still running.
Not approving because I authored this one.
|
Measured which wait it is: Reproduced the wedge locally with the full suite under a plugin that records the Playwright call each worker is inside. Both workers were caught in That is about which run this closes, not about whether this PR is worth having: |
… wait A call tracer caught both workers of a reproduced wedge inside Response.json, not a frame promise (#85), so the attribution the comment made is refuted. The bounded frame wait still closes a real unbounded-wait class; the comment now says only that.
|
Pushed The fix is untouched: an unbounded |
leaf-agent
left a comment
There was a problem hiding this comment.
The replacement sentence swaps one causal claim for another, and the new one isn't measured either.
No CI run was traced. The comment now says "the three 45-minute ci runs on main were traced, under a call tracer, to a response body read". The tracer never ran on a CI run — it ran on a wedge reproduced locally. #85's body is careful about this ("the full suite was run locally under a call tracer and both workers were caught inside Response.json"), and so is this commit's own message ("a call tracer caught both workers of a reproduced wedge"). Only the source prose — the artifact that outlives the thread, which is the reason given for the change — states it as a trace of the runs themselves. That is the same shape of attribution the commit set out to remove, pointed at a different wait.
And there were five, not three. #85 names three because it was filed at 02:58, after the 02:37 comment on this PR had already listed five wedged runs with the nodeid each stopped on. I checked the wall clocks independently: 33130006054 45m51s, 33130455313 45m54s, 33131937176 45m45s, 33133078347 48m13s, 33133680899 49m32s — against 29m01s and 33m13s for the green runs either side of them.
The suggestion drops the count rather than correcting it to five: the comment no longer names the runs, so "the three" has nothing for a reader to resolve against, and any number written here goes stale the next time one lands.
Not approving because I authored this one.
|
It is also the first of these wedges observed off That is a cost of the wedge separate from the lost coverage, and it applies to #85 rather than to this PR — a wedge does not only spend the job, it erases the evidence for whatever genuinely failed before it. The wedged test is consistent with #85's measurement rather than with a frame wait: The outbox failure itself is unclassified. It does not reproduce at |
The comment claimed "the three 45-minute `ci` runs on main were traced, under a call tracer, to a response body read". The tracer never ran on a CI run — it ran on a wedge reproduced locally (#85). The count was wrong too: five runs have wedged, not three. The replacement states the absence rather than a second attribution, and names no count, which would go stale the next time one lands. The PR body carried the same shape of claim in the paragraph that said the frame wait "is the only call on those tests' path that can stop there"; it now says the runs were never traced and points at #85 for the measurement.
…#85) ## Problem Three `ci` runs on main have now spent the whole 45-minute step bound and left no failure to read: [33130006054](https://github.com/max-sixty/leaf/actions/runs/33130006054) (`45de22f`), [33130455313](https://github.com/max-sixty/leaf/actions/runs/33130455313) (`d4472ad`), [33131937176](https://github.com/max-sixty/leaf/actions/runs/33131937176) (`caa8460`). Under the `-v` #81 added, each names a different test that a worker picked up and never reported — `test_a_resolved_thread_can_be_reopened`, `test_a_sent_comment_is_revealed_in_the_panel`, `test_an_answer_carrying_an_older_pick_cannot_undo_a_newer_one` — so the wedge is not a test's, and the other worker stops minutes later in a module of its own. It is `Traffic`. [`_responded`](https://github.com/max-sixty/leaf/blob/3feb009d654af450fed766621909b1933f96e418/tests/render_harness.py#L629) queues a response when its **headers** arrive, and [`settle`](https://github.com/max-sixty/leaf/blob/3feb009d654af450fed766621909b1933f96e418/tests/render_harness.py#L648) then reads the body with [`response.json()`](https://github.com/max-sixty/leaf/blob/3feb009d654af450fed766621909b1933f96e418/tests/render_harness.py#L663). That call waits on the request's finished fact and takes no timeout in any binding. A page that abandons an answer it no longer wants leaves a request Chromium never reports finished, and the read then blocks for as long as the job lives. It is the one wait in this harness that cannot run out: `_until`'s own 30-second deadline guards `wait_for_event` and never gets a turn, so the worker stops inside a helper every render test calls, with no nodeid, no traceback and no Playwright timeout. This is measured, not inferred — the full suite was run locally under a call tracer and both workers were caught inside `Response.json`, unmoved across two snapshots a minute apart (below). ## Solution Settle a response only once `requestfinished` says the browser holds the whole body, and wake `_until` on that same fact rather than on arriving headers — a body is what the counters are read from, and that event is the browser saying it has one. `settle` keeps an unfinished response queued instead of reading it, so the shape that used to stop the run now lets `_until` reach its deadline and print its counters, which is the naming a wedge could never do. The counters themselves are untouched: `acked` and `heard` still move on the `response` event, so what a trip means to `round_trip` is what it meant before. This is at a different site from #84, which bounds `page.evaluate`'s frame promises on the same three runs' evidence and says of itself that it does not prove which wait wedged them. The two do not overlap in `render_harness.py`, and #84 still closes a real unbounded-wait class — it is just not the one that stopped these runs. ## Testing `uv run pytest tests --run-nightly` — **1357 passed, 6 skipped in 19:36**, on the machine that had just wedged twice in a row at 65% and 91% without the change. Rebased onto `dd42ddb`: `ruff check`, `ruff format`, `tests/test_render_conversations.py` and `tests/test_render_reactions.py` (48 passed), and the three traffic-wait gates. Bug-back: with `settle` restored to its unconditional drain, `test_traffic_leaves_a_body_the_browser_has_not_finished_handing_over` fails with `a body was read before the browser had all of it`. <details><summary>How the blocking call was identified</summary> The suite was run as CI runs it (`uv run pytest tests --run-nightly -v`) with a plugin wrapping the Playwright sync surface — `Page.close`, `Page.evaluate`, `Page.wait_for_function`, `Response.body/json/text`, `Locator.*`, `Mouse.*`, `Keyboard.*` — each writing the call it is inside to a per-worker file. A watchdog snapshotted those files after the log had been silent for 150 seconds, and again a minute later: ``` --- snapshot A 30159 1787884275.442 ENTER Response.json stack=['Response.json'] 27463 1787884129.338 ENTER Response.json stack=['Response.json'] --- snapshot B 30159 1787884275.442 ENTER Response.json stack=['Response.json'] 27463 1787884129.338 ENTER Response.json stack=['Response.json'] ``` Both workers, unmoved, with the report count frozen at 1315 of 1395. `py-spy` cannot reach these (the sandbox denies `ptrace`), and `faulthandler` names nothing here for the reason `pyproject.toml` records — the test's frames sit in a suspended greenlet. The wedge reproduces without instrumentation too. An earlier plain run stopped at 91% with `gw1` inside `test_a_resolved_thread_can_be_reopened` after `test_a_thread_the_agent_closed_names_who_closed_it` — the same pair, in the same order, as run 33130006054. Both wedges left their page server answering: the served page's `viewed.json` kept ticking every 30 seconds, and `ss` showed one established connection per server with empty queues, so nothing was stalled on the wire and no `flock` was held. Per-test pacing in the failed CI runs matches a green run's decile for decile, which rules out the machine slowing down before it stopped. </details> --- Automated fix for [failed run](https://github.com/max-sixty/leaf/actions/runs/33130006054) --------- Co-authored-by: leaf-agent <[email protected]>
# Conflicts: # tests/test_render_navigation.py
|
Landed directly on
|
#100) ## Problem [Run 33220366482](https://github.com/max-sixty/leaf/actions/runs/33220366482) (`db3f5d0`) spent the step's whole 45 minutes and left no failure to read. Under the `-v` #81 added, both workers name what stopped them, and they stopped in two different places. `gw0` printed `tests/test_render_widgets.py::test_accept_all_decides_every_pending_suggestion` at 23:48:35 — that is the `Response.json` shape #85 diagnosed, and #85 has since landed on `main` as [e626f53](e626f53). `gw1` printed `tests/test_smoke.py::test_a_shipped_page_passes_the_real_browser_gate` at 23:49:53, at 99%, and never reported it. That second one is left over: it is one line — `render_gate_model.render_version(...)` — so the wait is on the gate's own path, in shipped code rather than in `tests/`, and it has now stopped three runs. `page.evaluate` takes no timeout in any binding. [`render_checks.py`](https://github.com/max-sixty/leaf/blob/b25a9e06f74cc1f994de6dc48a1e0a2ada873a05/plugins/leaf/skills/leaf/scripts/leaf/render_checks.py#L23) already races the probe module's *load* against `call.timeoutMs`; the probe it then invokes was awaited with nothing bounding it. Two probes await a promise the page supplies rather than a fact it states, and both are reached that way: - [`nextFrame`](https://github.com/max-sixty/leaf/blob/b25a9e06f74cc1f994de6dc48a1e0a2ada873a05/plugins/leaf/skills/leaf/scripts/leaf/render-checks/runtime.js#L47) is `new Promise(requestAnimationFrame)`, awaited at [`readings.py:188`](https://github.com/max-sixty/leaf/blob/b25a9e06f74cc1f994de6dc48a1e0a2ada873a05/plugins/leaf/skills/leaf/scripts/leaf/render_gate/readings.py#L188) as the last thing each scheme reads. `requestAnimationFrame` stops in a page the compositor has stopped drawing. - [`retiredSlots`](https://github.com/max-sixty/leaf/blob/b25a9e06f74cc1f994de6dc48a1e0a2ada873a05/plugins/leaf/skills/leaf/scripts/leaf/render-checks/widgets.js#L166) awaits `Promise.allSettled` over each holder's animations — `a.finished`, the same promise `bb8b7e0` had to bound on the test side. They are the only two: no other export under `render-checks/` contains an `await` or a `.then`. #84 named `nextFrame` and scoped it out as product rather than suite behaviour, which is right — it belongs here rather than in `tests/render_harness.py`, and this PR does not touch anything #84 does. ## Solution Race each probe's answer against the deadline `_INVOKE_PROBE` already carries for the load, in the one place every probe goes through. Nothing new is declared: `call.timeoutMs` is the gate's `served_timeout_ms`, defaulting to `SERVED_TIMEOUT_MS`, which is Playwright's own 30 seconds — so a probe now runs out where every other browser wait in the gate and the suite runs out. The rejection comes back through `evaluate`, and [`render_version`](https://github.com/max-sixty/leaf/blob/b25a9e06f74cc1f994de6dc48a1e0a2ada873a05/plugins/leaf/skills/leaf/scripts/leaf/render_gate/version.py#L94) already turns a `PlaywrightError` from its probe module into a gate finding, so `version check --render` reports which probe stopped and the bound it passed instead of hanging. Bounding at `_INVOKE_PROBE` rather than at the two probes is what keeps the layer open: a probe added later that awaits the page is bounded by existing, and the suite's own `evaluate_probe` callers are covered by the same edit. `tests/CLAUDE.md`'s bounded-await rule is corrected to say so, since it currently names only the loader and would send an author to write a second race around a call that already has one. This does not claim to bound every unbounded await in the payload — only the ones reached through `evaluate_probe`. An `await` written directly into a `page.evaluate` argument elsewhere is still a wait nothing bounds. ## Testing `test_a_probe_that_never_answers_is_a_gate_finding`, beside the loader's own deadline test. It serves the real probe facade with `nextFrame` replaced by a promise that never settles, runs the whole gate, and asserts the finding names the probe and the bound. The replacement holds its own resolver, as `requestAnimationFrame` holds the callback it was handed — the first version let it be collected, and the driver ended the wait itself with `Resulting promise was garbage collected`, which is a different arrangement and not the one that stopped these runs. Bug-back on this runner, same test both ways: ``` this branch 1 passed in 9.51s (failure: "probe nextFrame did not answer within 3000ms") main's _INVOKE_PROBE exit=143 (still waiting when a 120s cap cut it off) ``` On the rebased tree (`b25a9e0`), every suite file that reaches `evaluate_probe`, plus the one the wedge landed on: `test_render_gate.py` and `test_smoke.py` (66 passed), `test_render_pages.py`, `test_render_startup.py` and `test_render_options.py` (135 passed), `test_render_widgets.py` (61 passed), and `test_render_export.py` with `test_render_projection.py` (97 passed, run against `6045970` before the rebase, along with `test_render_commands.py`). The everyday suite `uv run pytest tests` is 690 passed, 6 skipped, and `pre-commit run` over the three changed files is clean. The full `--run-nightly` suite has not been run here; CI runs it on this branch. <details><summary>The three runs this wait stopped</summary> Each row is the nodeid a worker printed and never reported, found by pairing `-v`'s start lines against its `[gwN] … PASSED/FAILED` lines over the whole job log: | Run | Commit | Unpaired nodeid | | --- | --- | --- | | [33169923393](https://github.com/max-sixty/leaf/actions/runs/33169923393), attempt 1 | `16a94ad` (#95's branch) | `test_smoke.py::test_a_shipped_page_passes_the_real_browser_gate`, and `test_render_options.py::test_a_question_owns_one_thread_in_the_page_and_panel` | | [33209352445](https://github.com/max-sixty/leaf/actions/runs/33209352445) | `1c5edad` | `test_smoke.py::test_a_shipped_page_passes_the_real_browser_gate`, and `test_render_conversations.py::test_a_resolved_thread_can_be_reopened` | | [33220366482](https://github.com/max-sixty/leaf/actions/runs/33220366482) | `db3f5d0` | `test_smoke.py::test_a_shipped_page_passes_the_real_browser_gate`, and `test_render_widgets.py::test_accept_all_decides_every_pending_suggestion` | The second nodeid on each row is #85's shape rather than this one — all three reach `Traffic` through `round_trip`. This PR does not claim them; e626f53 does. That first row is attempt 1 because its failed jobs were re-run afterwards, and the re-run's log is what `gh run view --job` returns now; attempt 1's own log is still readable through `actions/jobs/98844279758/logs`, and that is the one parsed here. The diagnosis on #95 named both of this PR's awaits after the first of these three runs, but #95 was a test-side fix and could not carry them. That comment is now on a closed PR, so this restates it rather than linking to it as if it were pending. </details> --- Automated fix for [failed run](https://github.com/max-sixty/leaf/actions/runs/33220366482) Co-authored-by: leaf-agent <[email protected]>
…the job (#154) ## Problem The review on #153 ([review](#153 (review))) raised this while that PR was in flight; it merged before the point was actioned, so the shape is on `main` now. `margins_laid_out` awaits the `/runtime/margin-layout.js` import inside `page.evaluate`, which `tests/CLAUDE.md` names as the unbounded case: "`page.evaluate` takes no timeout in any binding, so a promise awaited inside it — an animation's `finished`, a module's load, a listener's next call — is a wait nothing bounds. It does not fail in thirty seconds naming its test: it spends the job's whole step, and the share of the suite already handed to that worker never runs." That is the class #84 and #95 bound at eleven other sites; this helper was added after them and reintroduces it at three call sites — `test_render_pages.py` twice and `test_render_margin.py` once — all of them on the render suite's ordinary path. ## Solution Poll the import from the driver with `wait_for_function` against `render_checks.SERVED_TIMEOUT_MS`, the same patience the payload's own probes carry. The deadline moves to the driver side, which is the shape `tests/CLAUDE.md` prefers; the round trip count and the frame the layout runs in are unchanged. The docstring now says why the wait is bounded from outside, so the next reader does not have to re-derive it. ## Testing On this branch, rebased on `6d68a1b`: - `uv run pytest tests` — 740 passed, 6 skipped. That is the gate CI runs on this PR. - `uv run pytest tests/test_render_pages.py::test_a_left_sidebar_uses_the_margin_until_the_page_needs_it_back --run-nightly -n0` — passes. This is the test #153 fixed, and the one the helper was written for. - `uv run pytest tests/test_render_margin.py tests/test_render_pages.py --run-nightly -n2` — 62 passed, 2 failed. Both failures are pre-existing and untouched here (below). - `ruff check` and `ruff format --check` over the changed file pass. <details><summary>The two nightly failures, and why they are not this change</summary> `test_render_margin.py::test_g_addresses_the_page_map_prefix_in_its_announced_order` and `test_one_margin_item_owns_a_targets_controls_information_and_more_actions` both wait for `m\s*page-map items` on the key line and read `gm1–9page-map items` / `gm1–4page-map items` instead. I reran both at `-n0` with this diff stashed, on `6d68a1b` unmodified: they fail identically. They belong to `aa41f7a` ("Keep chord hints stable through progress"), which changed the chord row to carry the item count, and #153's body already named them on its own base. No open issue tracks them yet; the next `ci` on `main` should route them to `tend-ci-fix`. </details> --------- Co-authored-by: leaf-agent <[email protected]>
Issue #84 of the Lit follow-up review. That review numbers its own items, so #84 is not a GitHub issue. ## #84: a reply being written goes with its thread to another seat **What changed.** A thread can leave a widget's outlet while the user is writing a reply in it. It goes to the margin card, or to the Threads panel when the page draws its annotations in the page margin. Either way, the user now goes on in the same editor, and undo walks back through what they typed before the move. Before, the destination card's own reply editor took the words, the caret and focus, and the history was lost, so Cmd+Z did nothing. **How.** The reply row now belongs to the thread's editing session rather than to the card that drew it (`thread/replies.js`). - `wireReply` wires a row's editor once. What the row does for a card (its send actions, `onChange`, `editLast`, the panel's `lfRevealReply` and row-height observer) is a binding: `attach` sets it and the detach it returns clears it. - Once no card holds the session's row, `carry` has the card on the thread's current route take it in place of its own row (`binding.take`: detach, attach the session's row, redraw). That happens at the one point that knows the route, the hand-off's destination: `replyControlDestination` for a user standing in the box, and the realize loop of `holdReplyCompositions` for a session left by Tab. So it doesn't matter whether the destination card was built before or after the source card let go. A package mirror, which can't draw another row, keeps its own and takes the caret, as before. - `take` blurs the row it gives up before redrawing, so the card's focus hold doesn't move the user somewhere that cancels the hand-off. `replyDestination` (`thread/focus.js`) checks where `open` left the user before asking the destination for its control, then hands them to it. - `holdReply` forgets a box once the carry lands back on that same box, so the row can be carried again on a later move. - `attach` doesn't call the card's `onChange`. At construction that call was a no-op for both callers. After a take it made a settled thread request a presentation, whose hand-off carried the other session back. The margin card then alternated between two threads without end. **Not done here.** - The card itself isn't carried. Outlet cards are `<details>`, while page and margin cards are `<div>`. An overlay margin also opens its card only after the outlet has gone, so the source card has nowhere to move to. - The editor still blurs once, because it is out of the document between the outlet's removal and the destination taking it. Avoiding that would need a connected place to park it and cards that place their row with `move()` rather than through Lit. - A thread moving the other way, from the margin card back into an outlet, loses focus to the banner's More button. This also happens on `main`: the margin's rerender close (`closePreview`, which defaults to `letGo`) lands the user before the hand-off runs. **Lines.** Hand-written source: +127 / −80 (replies.js +106/−52, focus.js +15/−8, thread-card.js +6/−20). Tests: +28 / −9. **Test.** `test_a_reply_box_whose_thread_leaves_the_diff_takes_the_user_to_its_card` now presses undo twice after the move and expects the words typed before the move to go too. It runs on an overlay margin, with and without a resolve, and on a page margin, where the thread lands in the panel. All three cases fail on `main`. The page case also fails with `carry` disabled while the overlay cases still pass. ## Checks These pass: `npm run test:runtime`; the seat, reply, diff, margin, draft, mirror, resolved and composer selections of `test_render_threads.py`, `test_render_drafts.py`, `test_render_widgets.py`, `test_thread_response_continuity.py` and `test_response_pointer.py` (318 tests); and pre-commit. `test_an_empty_draft_survives_reload_and_a_live_revision` and `test_the_reading_page_keys_follow_the_user_into_the_panel` fail the same way on the base. > _This was written by Claude Code on behalf of max-sixty_ Co-authored-by: Claude Opus 5.5 (1M context) <[email protected]>
Problem
Run 33130455313 spent the step's whole 45 minutes and left no failure to read. Under the
-v#81 added, the log names what stopped:gw1printedtests/test_render_conversations.py::test_a_sent_comment_is_revealed_in_the_panelat 00:49:27 and never reported it, whilegw0drained the rest and stopped at 66%. Run 33130006054, the commit before, ended the same way ontest_a_resolved_thread_can_be_reopened. Neither test reached an assertion, and the quarter of the suite xdist had already handed the wedged worker never ran.The suite has a class of wait that can block that long. #46 removed the faulthandler guard on the premise that "Playwright's own 30-second timeouts already fail a stalled browser wait with the test's nodeid". That holds for every call except
evaluate, which takes no timeout in any binding — so a promise the page never settles blocks the worker for as long as the job lives. Every render test waits on one:navigateends its handover withpage.evaluate("() => new Promise(requestAnimationFrame)"), and the test modules ask for a rendering turn the same way in eleven more places.requestAnimationFramestops in a page the compositor has stopped drawing, and nothing then says so.Solution
State the frame wait once, in
FRAMES, with a deadline of its own.ONE_FRAMEandRENDEREDare that wait at one turn and two, and every awaited frame promise in the suite now goes through them —navigate,key_line,page_at_rest, and the test-side sites that had each written the expression out, including the scroll sweep intest_an_address_is_never_drawn_on_the_key_line, the update count intest_command_hub_stops_listening_after_live_version_replacement, andAFTER_THE_DRAGintest_site.py, whosesetTimeoutbounds the queue hop rather than the frame. The deadline is on the page's clock rather than Playwright's: a driver-side one is available — a flag a nestedrequestAnimationFramesets, read bypage.wait_for_function(polling=...)— but it costs a round trip and a page-global name, and it does not compose into a larger page script the wayRING_NEW_STOPcomposes this one. The page-side timer keeps running through the frames that stop, and the rejected promise comes back throughevaluateas the failure of the test that asked for it, which is the naming the removed hang guard could never do. The message says how many turns arrived rather than how many were asked for, because zero and one of two are different bugs. Insidetests/that is the class: the four awaited frame promises left intest_render_anchors.pyalready state a two-second deadline of their own, and every otherrequestAnimationFramethere is a fire-and-forget sampler the driver polls rather than a promiseevaluatewaits on. It is not the whole class —nextFrameinrender-checks.jsis an unbounded awaited frame promise that reachesevaluatethroughevaluate_probeonrender_version's path, and it is product behaviour rather than suite behaviour, so it is untouched here.What it does not cover, said rather than implied:
setTimeoutandrequestAnimationFrameshare the renderer's main thread, so this bounds a page whose compositor stopped drawing, not one whose main thread is blocked. That second shape still wedges silently.pyproject.toml's note is corrected where it said the 30-second timeouts already cover this.This bounds the class; it makes no claim on the runs that prompted it. Those runs were never traced, and a wedge reproduced locally under a call tracer stopped in a response body read instead — #85 has that measurement and its fix. What stands here is that
page.evaluatetakes no timeout in any binding, so an unbounded frame promise can wedge a worker with no nodeid and no traceback; after this it says so instead.Testing
uv run pytest tests --run-nightly—1356 passed, 6 skipped in 1674.97s, on a four-core Linux runner at the suite's own-n 2, against the first commit; both tests the wedges landed on pass. The second commit mergesmainin — which is also what clears the inheritedlintfailure onevent_endpoint.py, fixed onmainin02cce9c— and re-runs the three converted sites plus the whole oftest_site.pyagainst the merged tree:19 passed.ruff checkandruff formatare clean over the tree.Bug-back: the deadline fires, and main's wait does not
A page with
requestAnimationFramestubbed out, asked for a rendered turn:The 30 seconds is
FRAME_DEADLINE_MS, which matches Playwright's own default so a frame wait and every other browser wait in the suite run out at the same place.Automated fix for failed run