You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
test_page_fixture_opens_without_firefox_console_warnings[thread-panel-gallery]: Firefox reports a ResizeObserver loop on macOS #6604
tests/journeys/test_render_gate.py::test_page_fixture_opens_without_firefox_console_warnings[thread-panel-gallery] errors at teardown on macOS only (render_harness.py:1552): …/versions/v1.html: window error: ResizeObserver loop completed with undelivered notifications.
It reproduces on current main (d714c2e60): 5 of 18 copies errored with that message in dispatch 44762687613 on CI's Mac (--workers 1 --load 4). It first failed in scheduled run 44722728605 and passes on Linux.
Firefox reports this when an observer callback resizes something it observes within the same frame. So some ResizeObserver in what the thread-panel gallery draws can feed back into itself when frames are slow. #5708 and #5743 fixed an earlier corpus loop. Whether this is that path coming back or a new one isn't established yet; the next step is to find which observer's callback writes a size it observes.
I found the observer that loops, and it reproduces on Linux under load. A fit of the margin card writes max-height on #lf-margin-preview while box-motion's shared observer is delivering the card inside it. The two fixes I tried at the cap rule broke another test with the same loop, so this isn't fixed yet. The fix belongs where placements land, not in the cap rule.
The sequence. It is the same in every failing copy I logged, in the On Me sample's card:
The card's first fit, made before the card is held, writes max-height: 599px, the whole room, on the preview aside (depth 4). The card stands at 430 px.
Once the card is held at the top, each later fit computes a cap of 430 px. measureThreadCard only writes when the cap is below the card's current height, or when contents overflow. So the stale 599 px stays.
The message holding the Runs table finishes drawing (its body goes from 98 to 298 px), and the aside grows into the stale room, 430 → 599 px.
box-motion's placedParts delivers div.lf-margin-preview-card (depth 5) and asks the placement for this size (place). The fit lands in that delivery's microtasks and writes max-height: 430px on the aside, a box shallower than the one just delivered.
The reading-regions and Floating UI observers of the aside can't hear 599 → 430 in that frame, and Firefox reports the loop.
Two attempts that failed. I made the fit tighten the worn cap down to its computed cap: first always, then only while the contents fit. Either way the gallery passed 15 of 15 copies with the probe on, against 7 of 15 failing before. But tests/browser/margin/test_card_reply.py::test_a_card_a_scroll_moves_onto_or_off_the_windows_foot_as_it_resizes_only_resizes then failed deterministically with the same loop notice (Chromium) and a 120 s timeout (Firefox), and it passes on main. With the tighter cap, the content's growth reaches the card only through the fit's next write, and that write again lands in box-motion's delivery. So any size the fit sets from inside that delivery takes this path. box-motion's header relies on a placement landing in the delivery. That is safe only while the landing changes no observed size, and here it changes the parent aside's.
Next step. Decide where a placement that box-motion's delivery asks for should write a size change. One option defers just a placement that would change the aside's size to the next render pass, at the cost of one frame at the old size. The other lets the delivery observe the box the fit actually sizes, the aside. I'll keep working on this from that point.
Reproduction and probe
On Linux, uv run leaf-dev suite flake --copies 12 --workers 3 --load 6 'tests/journeys/test_render_gate.py::test_page_fixture_opens_without_firefox_console_warnings[thread-panel-gallery]' failed 2 of 12 on f33e974b4. --load 2 --workers 2 passed 8 of 8.
The probe is an init script added in clean_browser's page setup (render_harness.py, before watch_sources). It wraps ResizeObserver to log each delivery's constructor stack, its targets and their depths. It patches CSSStyleDeclaration.prototype.setProperty to log each max-height write on #lf-margin-preview with its stack and the delivery it ran in. On the loop error, it prints the log through console.error. With it, 7 of 15 and 3 of 9 copies failed, and every one showed the sequence above. A failing copy's fit inputs: first fit stood=0 height=599 stationary=false, then stood=430 height=415.6 stationary=true keepTop=true, with worn=599px until the write in box-motion's delivery.
Still open, and still live on current main (bd99da0ee): 3 of 18 copies failed on Linux at --workers 4 --load 8. A probe now names the observer that misses the shrink. Changing the order the observers are created in didn't fix the loop, which narrows what's left to a choice between the two options in the last comment.
The observer that loses the 430 px. In each sample's document, reading-regions' observer is created before box-motion's placedParts (4th and 5th of the page's observers). It watches .lf-margin-preview as a reading-region host (sizes.observe(host)). Floating UI's observer of the same aside is created later (31st). So in the gallery's sequence, reading-regions is delivered the aside's grown 599 px first, and placedParts then shrinks the aside to 430 px in its own delivery. box-motion's header assumes placedParts is made before any other observer of a placed box, and here that assumption is false.
Creating placedParts first doesn't settle it. I moved placedParts and its readers into rendering.js, so it's created before any module's observer. The gallery still failed 2 of 18 copies under the same load. So the order only explains the case where the aside was resized before the delivery. The fit can also resize the aside from inside a delivery of a deeper part while the aside itself wasn't resized beforehand, and then no creation order helps. That's the path the tightened cap took in test_a_card_a_scroll_moves_onto_or_off_the_windows_foot_as_it_resizes_only_resizes. page-layout.js already states the rule this breaks: a ResizeObserver callback must not resize a box it observes. The aside's own observers apply that rule to the aside too.
What remains. Of the two options in the last comment, letting the delivery observe the aside can't work on its own. Whichever observer delivers the aside, a write to the aside's size during that delivery is skipped by every observer of the aside. That leaves moving the size write out of the delivery: when the fit placedParts asks for would change the aside's size, run that placement in the next frame's pass. The open question is what that frame paints. If box-motion follows the new layout without a placement for one frame, the card may visibly jump. So the change needs the motion's stills compared before and after, as well as the flake run. I haven't built it yet.
Probe and runs
Reproduction on bd99da0ee: uv run leaf-dev suite flake --copies 18 --workers 4 --load 8 'tests/journeys/test_render_gate.py::test_page_fixture_opens_without_firefox_console_warnings[thread-panel-gallery]' failed 3 of 18 copies. At --workers 3 --load 6, 12 of 12 passed.
Probe: an init_script passed to open_page wraps ResizeObserver to record each observer's creation index, the runtime modules on its constructor's stack, and the targets it observes, read back from every frame (page.frames). In the sample documents (/api/samples/<id>/), observer 4 comes from reading-regions.js and observes lf-margin-preview. Observer 5 comes from box-motion.js and observes lf-margin-preview-card, lf-margin-preview-list and the card's parts. Observer 31 comes from annotation-overlay/floating.js through thread-preview.js and observes lf-margin-preview.
The ordering experiment, not committed: placedParts and the readers map moved to the end of rendering.js's observer section, with box-motion.js importing them. The same flake command failed 2 of 18 copies, with the same loop message.
Fix in #6727. A placement that box-motion's size delivery asks for no longer resizes the card in that delivery. It leaves the card's width and max-height as they are and fits the card again in the next frame. Moving the write out of the delivery was the option left open in the last comment.
On Linux under load, the gallery errored in 3 of 12 copies on main (fac415460) and passed 18 of 18 with the change. test_a_card_a_scroll_moves_onto_or_off_the_windows_foot_as_it_resizes_only_resizes, which both earlier attempts broke, passes. The trade is at most one frame at the card's earlier size, while box-motion's tween is already following it. The PR's CI and landing are with tend-land. The macOS evidence is the next scheduled test-macos run after it merges.
Activity
leaf-agent commentedon Nov 20, 2026
I found the observer that loops, and it reproduces on Linux under load. A fit of the margin card writes
max-heighton#lf-margin-previewwhile box-motion's shared observer is delivering the card inside it. The two fixes I tried at the cap rule broke another test with the same loop, so this isn't fixed yet. The fix belongs where placements land, not in the cap rule.The sequence. It is the same in every failing copy I logged, in the On Me sample's card:
max-height: 599px, the whole room, on the preview aside (depth 4). The card stands at 430 px.measureThreadCardonly writes when the cap is below the card's current height, or when contents overflow. So the stale 599 px stays.placedPartsdeliversdiv.lf-margin-preview-card(depth 5) and asks the placement for this size (place). The fit lands in that delivery's microtasks and writesmax-height: 430pxon the aside, a box shallower than the one just delivered.Two attempts that failed. I made the fit tighten the worn cap down to its computed cap: first always, then only while the contents fit. Either way the gallery passed 15 of 15 copies with the probe on, against 7 of 15 failing before. But
tests/browser/margin/test_card_reply.py::test_a_card_a_scroll_moves_onto_or_off_the_windows_foot_as_it_resizes_only_resizesthen failed deterministically with the same loop notice (Chromium) and a 120 s timeout (Firefox), and it passes on main. With the tighter cap, the content's growth reaches the card only through the fit's next write, and that write again lands in box-motion's delivery. So any size the fit sets from inside that delivery takes this path. box-motion's header relies on a placement landing in the delivery. That is safe only while the landing changes no observed size, and here it changes the parent aside's.Next step. Decide where a placement that box-motion's delivery asks for should write a size change. One option defers just a placement that would change the aside's size to the next render pass, at the cost of one frame at the old size. The other lets the delivery observe the box the fit actually sizes, the aside. I'll keep working on this from that point.
Reproduction and probe
uv run leaf-dev suite flake --copies 12 --workers 3 --load 6 'tests/journeys/test_render_gate.py::test_page_fixture_opens_without_firefox_console_warnings[thread-panel-gallery]'failed 2 of 12 onf33e974b4.--load 2 --workers 2passed 8 of 8.clean_browser's page setup (render_harness.py, beforewatch_sources). It wrapsResizeObserverto log each delivery's constructor stack, its targets and their depths. It patchesCSSStyleDeclaration.prototype.setPropertyto log eachmax-heightwrite on#lf-margin-previewwith its stack and the delivery it ran in. On the loop error, it prints the log throughconsole.error. With it, 7 of 15 and 3 of 9 copies failed, and every one showed the sequence above. A failing copy's fit inputs: first fitstood=0 height=599 stationary=false, thenstood=430 height=415.6 stationary=true keepTop=true, withworn=599pxuntil the write in box-motion's delivery.leaf-agent commentedon Nov 21, 2026
Still open, and still live on current main (
bd99da0ee): 3 of 18 copies failed on Linux at--workers 4 --load 8. A probe now names the observer that misses the shrink. Changing the order the observers are created in didn't fix the loop, which narrows what's left to a choice between the two options in the last comment.The observer that loses the 430 px. In each sample's document, reading-regions' observer is created before box-motion's
placedParts(4th and 5th of the page's observers). It watches.lf-margin-previewas a reading-region host (sizes.observe(host)). Floating UI's observer of the same aside is created later (31st). So in the gallery's sequence, reading-regions is delivered the aside's grown 599 px first, andplacedPartsthen shrinks the aside to 430 px in its own delivery. box-motion's header assumesplacedPartsis made before any other observer of a placed box, and here that assumption is false.Creating
placedPartsfirst doesn't settle it. I movedplacedPartsand its readers intorendering.js, so it's created before any module's observer. The gallery still failed 2 of 18 copies under the same load. So the order only explains the case where the aside was resized before the delivery. The fit can also resize the aside from inside a delivery of a deeper part while the aside itself wasn't resized beforehand, and then no creation order helps. That's the path the tightened cap took intest_a_card_a_scroll_moves_onto_or_off_the_windows_foot_as_it_resizes_only_resizes.page-layout.jsalready states the rule this breaks: aResizeObservercallback must not resize a box it observes. The aside's own observers apply that rule to the aside too.What remains. Of the two options in the last comment, letting the delivery observe the aside can't work on its own. Whichever observer delivers the aside, a write to the aside's size during that delivery is skipped by every observer of the aside. That leaves moving the size write out of the delivery: when the fit
placedPartsasks for would change the aside's size, run that placement in the next frame's pass. The open question is what that frame paints. If box-motion follows the new layout without a placement for one frame, the card may visibly jump. So the change needs the motion's stills compared before and after, as well as the flake run. I haven't built it yet.Probe and runs
bd99da0ee:uv run leaf-dev suite flake --copies 18 --workers 4 --load 8 'tests/journeys/test_render_gate.py::test_page_fixture_opens_without_firefox_console_warnings[thread-panel-gallery]'failed 3 of 18 copies. At--workers 3 --load 6, 12 of 12 passed.init_scriptpassed toopen_pagewrapsResizeObserverto record each observer's creation index, the runtime modules on its constructor's stack, and the targets it observes, read back from every frame (page.frames). In the sample documents (/api/samples/<id>/), observer 4 comes fromreading-regions.jsand observeslf-margin-preview. Observer 5 comes frombox-motion.jsand observeslf-margin-preview-card,lf-margin-preview-listand the card's parts. Observer 31 comes fromannotation-overlay/floating.jsthroughthread-preview.jsand observeslf-margin-preview.placedPartsand thereadersmap moved to the end ofrendering.js's observer section, withbox-motion.jsimporting them. The same flake command failed 2 of 18 copies, with the same loop message.test: update four nightly tests to what #6612, #6654, #6641 and #6640 …
leaf-agent commentedon Nov 22, 2026
Fix in #6727. A placement that box-motion's size delivery asks for no longer resizes the card in that delivery. It leaves the card's
widthandmax-heightas they are and fits the card again in the next frame. Moving the write out of the delivery was the option left open in the last comment.On Linux under load, the gallery errored in 3 of 12 copies on main (
fac415460) and passed 18 of 18 with the change.test_a_card_a_scroll_moves_onto_or_off_the_windows_foot_as_it_resizes_only_resizes, which both earlier attempts broke, passes. The trade is at most one frame at the card's earlier size, while box-motion's tween is already following it. The PR's CI and landing are with tend-land. The macOS evidence is the next scheduledtest-macosrun after it merges.