Skip to content

fix: wait for each trace capture to commit before reading its caption - #5267

Merged
leaf-agent merged 1 commit into
mainfrom
fix/issue-5184
Nov 4, 2026
Merged

leaf-agent merged 1 commit into
mainfrom
fix/issue-5184

Conversation

@leaf-agent

Copy link
Copy Markdown
Collaborator

test_trace_frames_retain_saved_elements_and_disclosure_stays_closable failed on macOS in the scheduled runs of Nov 1 and Nov 2 (41432142330) and passed in the other six of the last eight. It was a read-before-ready race in the test: it pressed ArrowRight and read .lf-trace-caption at once. lf-trace only says "Captured frame" after the Viewer commits decoded pixels, and the next press cancels a Viewer that is still decoding. The recording has only two frame stops after the populated checkpoint (2.945 s and 3.296 s), so a slow runner could step past both before either one committed and run out of stops. The loop now waits at each stop for rendered, then for .lf-trace-images to drop aria-busy, and only then reads the caption. The widget and what the test asserts are unchanged.

Verification: with HTMLImageElement.decode delayed by 300 ms, the old loop fails with the CI's exact No captured frame after the populated checkpoint. The new loop passes under that delay, passes three times unthrottled, and passes once at --cpu-throttle 10.

Underlying gap, left as is

rendered() can't see the pending Viewer because lf-trace doesn't register it as a holdRendering preparation (browser/runtime/rendering.js says finite asynchronous preparation should). Packages can only reach holdRendering through the widget controller's state-driven preparations, not for local navigation like this. A public hold in widget-api.js would let rendered() cover image commits for every test and widget. This PR leaves that change exactly as easy to make as it was.

Closes #5184 — automated triage

The trace journey stepped through captures with ArrowRight and read the
caption straight after each press. lf-trace only names a frame once its
Viewer commits decoded pixels, and the next press cancels a Viewer still
decoding, so on a slow runner every frame stop after the populated
checkpoint was skipped before it committed. The test now waits for the
repaint and for the image host's aria-busy to clear at each stop. No
behavior changes; the test still asserts the same frame and disclosure.

Delaying HTMLImageElement.decode by 300 ms reproduces the CI assertion on
the old loop; the new loop passes under that delay and at --cpu-throttle 10.

Closes #5184
@leaf-agent
leaf-agent merged commit 238e965 into main Nov 4, 2026
5 of 7 checks passed
@leaf-agent
leaf-agent deleted the fix/issue-5184 branch November 4, 2026 00:39
max-sixty added a commit that referenced this pull request Nov 4, 2026
`running-tend` told a session fixing a failure only `test-macos` shows
to dispatch `ci` on the fix's branch and read that run's `test-macos`
job. A triage session takes that as evidence it must collect before it
finishes, so it polls the run for its whole length, four to five hours,
while it holds the only triage lane. Two Claude triage sessions did so
in their first day: #5174's waited 4 h 10 min and #5184's 4 h 46 min. In
both, the PR (#5218, #5267) merged within 20 minutes of the wait
starting, so the result changed nothing, and #5184's dispatched run
ended red after its PR had merged.

Leaf already chose not to have Tend sessions wait on CI (`await_ci:
false`, #2455), and Tend tells every triage session so. This
instruction, added in #3939, asked for a wait the setting doesn't
govern, since the dispatched run is outside the PR's checks. It also
supplied the "passes after" evidence the merge rule in **Fixing a CI
failure's cause** asks for. Now the merge rule says that for a failure
only `test-macos` shows, the checks the Linux runner can run suffice,
and the macOS paragraph names the next scheduled run on main, after the
merge, as the evidence after the fix. The landing sessions already
worked that way: both PRs merged before their dispatched runs ended. If
the scheduled run still fails, its CI report brings the failure back to
triage.

Supersedes #5315, which makes the same merge-rule change but still
dispatches the macOS run and leaves the cause issue open until a later
session reads it. That costs a macOS run and another triage session per
fix to learn what the next scheduled run reports anyway.

> _This was written by Claude Code on behalf of max-sixty_
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.

Trace journey captures no frame after its populated checkpoint

1 participant