Repository navigation
Closed
Labels
tend-ci-causeA root cause of a CI failure report
Description
The scheduled run 41432142330 records the following failing boundary. This is CI evidence, not a claim that the failure persists on current main or that its cause is established.
Reconcile current main, existing repairs and active work before reproducing. Diagnose the shared failing operation before choosing a fix; split ownership if reproduction establishes different mechanisms. Preserve the intended behavior from the originating changes and follow the repository’s focused verification, review and landing gates.
tests.journeys.test_render_sample_delivery::test_sample_upgrade_does_not_wait_for_child_saved_state[False-page] — Linux
browser = <render_harness.WatchedBrowser object at 0x7ff6a9af9d90>
serve = <function serve.<locals>.go at 0x7ff6a8a32fc0>, surface = 'page'
newer_input = False
@pytest.mark.parametrize("surface", ["panel", "page"])
@pytest.mark.parametrize("newer_input", [False, True])
def test_sample_upgrade_does_not_wait_for_child_saved_state(
browser, serve, surface, newer_input
):
"""A saved-thread request waits for history and yields to a newer child draft, and
in the panel to any draft in the field its view would take."""
source = leaf_page(
"Independent sample startup",
'<h1>Independent sample startup</h1><p id="outer">Parent passage.</p>'
'<lf-sample id="practice" label="Practice" window>'
'<template id="practice-source" data-sample data-sample-events="history">'
'<h1>Practice</h1><p id="inner">Child passage.</p>'
"</template></lf-sample>",
head="""<script id="history" type="application/json">
[{"id":"saved-thread","kind":"comment","anchor":{"section":"inner"},
"text":"A saved child conversation."}]
</script>""",
)
page = browser.new_page(viewport={"width": 1200, "height": 900})
held = []
route_pattern = re.compile(r"/api/samples/[^/]+/api/state")
page.route(route_pattern, lambda route: held.append(route))
page.goto(serve(source), wait_until="load")
holding(page, held, 1, "the child's unanswered saved-state read")
expect(page.locator("body")).to_have_attribute("data-lf-upgraded", "1")
sample = page.locator("#practice")
sample.evaluate("async sample => await sample.ready")
child = sample.locator("iframe").element_handle().content_frame()
expect(child.locator("body")).to_have_attribute("data-lf-upgraded", "1")
expect(child.locator("body")).not_to_have_attribute("inert")
expect(child.locator("body")).not_to_have_attribute("data-lf-presented", "1")
expect(child.locator(".lf-fp-leaf")).to_have_attribute(
"aria-label", "Page menu · Loading comments and choices…"
)
# The page's own panel floats over the window's foot, where the sample's stands
# too until the page is scrolled to the foot room it keeps clear of its chrome.
page.evaluate("scrollTo(0, document.scrollingElement.scrollHeight)")
scroll_settled(page)
outer_box = page_comment(page)
write(outer_box, "Parent draft")
page.keyboard.press("Escape")
inner_box = page_comment(child)
write(inner_box, "Child draft")
page.keyboard.press("Escape")
child.evaluate("""() => {
window.sampleRequestReceived = false;
document.documentElement.lfSample.receive(({method}) => {
if (method === 'thread') window.sampleRequestReceived = true;
});
}""")
sample.evaluate(
"""(sample, surface) => {
window.sampleSelected = false;
sample.showThread('saved-thread', {surface}).then(result => {
window.sampleSelectionResult = result;
window.sampleSelected = true;
});
}""",
surface,
)
# The child has received this command before newer input supersedes it.
child.wait_for_function("window.sampleRequestReceived")
assert page.evaluate("window.sampleSelected") is False
child_words = "Child draft"
if newer_input:
inner_box = page_comment(child)
child_words = "A newer child draft owns this view"
write(inner_box, child_words)
expect(outer_box).to_have_js_property("value", "Parent draft")
expect(inner_box).to_have_js_property("value", child_words)
page.unroute(route_pattern)
for route in held:
route.continue_()
page.wait_for_function("window.sampleSelected")
# The panel's view of a thread would stand its reply in the field the child's words
# stand in, so it yields to them as it does to newer input; the page's card doesn't.
shown = not newer_input and surface == "page"
assert page.evaluate("window.sampleSelectionResult") is shown
expect(child.locator("body")).to_have_attribute("data-lf-presented", "1")
expect(outer_box).to_have_js_property("value", "Parent draft")
> expect(inner_box).to_have_js_property("value", child_words)
E AssertionError: Locator expected to have JS Property 'Child draft'
E Actual value: None
E Error: element(s) not found
E Call log:
E - Expect "to_have_property" locator(".lf-fp-field leaf-text[name=\"comment\"]") with timeout 120000ms
E - waiting for locator(".lf-fp-field leaf-text[name=\"comment\"]")
E
E Aria snapshot:
E - main:
E - heading "Practice" [level=1]
E - paragraph: Child passage.
E - navigation "Page Map, 1 locations":
E - toolbar "Changes, threads, items on me, delivery status, and activity":
E - group "Page actions for paragraph · Child passage.":
E - button "Thread, Still queued for Agent, 1 of 1, 50 percent down, paragraph · Child passage."
E - dialog:
E - region "Leaf":
E - button "Back to Threads"
E - heading "A saved child conversation." [level=2]
E - button "Show on page"
E - button "Resolve thread"
E - button "Close"
E - blockquote: § paragraph · Child passage.
E - text: Me
E - time: 2m ago
E - text: ·Still queued for Agent
E - button "Edit message"
E - button "Copy as Markdown"
E - paragraph: A saved child conversation.
E - button "Page menu · Not answering — nudge the terminal"
E - textbox "Reply to A saved child conversation.":
E - /placeholder: Reply
E - button "1 comment on § paragraph · Child passage.": 1 comment
/home/runner/work/leaf/leaf/tests/journeys/test_render_sample_delivery.py:109: AssertionError
tests.journeys.test_render_sample_delivery::test_sample_upgrade_does_not_wait_for_child_saved_state[False-page] — Linux
_browser = <Browser type=<BrowserType name=chromium executable_path=/home/runner/.cache/ms-playwright/chromium-1248/chrome-linux64/chrome> version=156.0.8078.4>
request = <SubRequest 'browser' for <Function test_sample_upgrade_does_not_wait_for_child_saved_state[False-page]>>
@pytest.fixture
def browser(_browser, request):
"""The shared browser process, with context ownership scoped to one test.
`Browser.new_page` opens a fresh context, so local and session storage remain
isolated. Rejecting browser problems and then closing every remaining context at
teardown makes health and lifetime fixture guarantees instead of conventions
repeated at the end of each journey. Closing may itself cancel outstanding requests,
so it happens after the health reading. Unroute first so cancellations of handlers
still in flight cannot reach the shared driver's next test.
Handed over wrapped, because the health half of that guarantee has to be installed
on each page before it navigates: a test that makes its own page gets one already
reporting to the collector this reads (`render_harness.WatchedBrowser`).
"""
from render_harness import WatchedBrowser, clean_browser
try:
> with clean_browser(request.node):
tests/conftest.py:830:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
/usr/lib/python3.12/contextlib.py:144: in __exit__
next(self.gen)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
test = <Function test_sample_upgrade_does_not_wait_for_child_saved_state[False-page]>
@contextmanager
def clean_browser(test=None):
"""Reject every browser problem a test did not explicitly consume.
The function-scoped browser fixture owns this collector along with its contexts.
A worker runs one test at a time, so one process-local collector covers pages made
by `WatchedBrowser`, render helpers, and tests that navigate a page
themselves. The fixture hands over its `test` node to select shift coverage
(`watches_shifts`); every problem a watch reports reaches this collector. A test
that failed or left problems leaves a picture of each page (`_picture_pages`).
"""
global _BROWSER_PROBLEM_LISTS, _TEST
assert _BROWSER_PROBLEM_LISTS is None, "browser problem collector already active"
captured = []
_BROWSER_PROBLEM_LISTS = captured
_TEST = test
try:
yield
finally:
_BROWSER_PROBLEM_LISTS = None
_TEST = None
problems = [
f"{getattr(page, 'url', '<browser page>')}: {problem}"
for page, problem_list in captured
for problem in problem_list
]
if test is not None and (problems or getattr(test, "lf_failed", False)):
_picture_pages(test, [page for page, _ in captured])
> assert not problems, "\n".join(problems)
E AssertionError: http://127.0.0.1:33149/versions/v1.html: typed words left the screen without a key or press: "Child draft" in leaf-text.scroll
E assert not ['http://127.0.0.1:33149/versions/v1.html: typed words left the screen without a key or press: "Child draft" in leaf-text.scroll']
tests/render_harness.py:1305: AssertionError
tests.journeys.test_render_sample_delivery::test_sample_upgrade_does_not_wait_for_child_saved_state[False-page] — macOS
_browser = <Browser type=<BrowserType name=chromium executable_path=/Users/runner/Library/Caches/ms-playwright/chromium-1248/chrome-mac-arm64/Google Chrome for Testing.app/Contents/MacOS/Google Chrome for Testing> version=156.0.8078.4>
request = <SubRequest 'browser' for <Function test_sample_upgrade_does_not_wait_for_child_saved_state[False-page]>>
@pytest.fixture
def browser(_browser, request):
"""The shared browser process, with context ownership scoped to one test.
`Browser.new_page` opens a fresh context, so local and session storage remain
isolated. Rejecting browser problems and then closing every remaining context at
teardown makes health and lifetime fixture guarantees instead of conventions
repeated at the end of each journey. Closing may itself cancel outstanding requests,
so it happens after the health reading. Unroute first so cancellations of handlers
still in flight cannot reach the shared driver's next test.
Handed over wrapped, because the health half of that guarantee has to be installed
on each page before it navigates: a test that makes its own page gets one already
reporting to the collector this reads (`render_harness.WatchedBrowser`).
"""
from render_harness import WatchedBrowser, clean_browser
try:
> with clean_browser(request.node):
^^^^^^^^^^^^^^^^^^^^^^^^^^^
tests/conftest.py:830:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
/Library/Frameworks/Python.framework/Versions/3.12/lib/python3.12/contextlib.py:144: in __exit__
next(self.gen)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
test = <Function test_sample_upgrade_does_not_wait_for_child_saved_state[False-page]>
@contextmanager
def clean_browser(test=None):
"""Reject every browser problem a test did not explicitly consume.
The function-scoped browser fixture owns this collector along with its contexts.
A worker runs one test at a time, so one process-local collector covers pages made
by `WatchedBrowser`, render helpers, and tests that navigate a page
themselves. The fixture hands over its `test` node to select shift coverage
(`watches_shifts`); every problem a watch reports reaches this collector. A test
that failed or left problems leaves a picture of each page (`_picture_pages`).
"""
global _BROWSER_PROBLEM_LISTS, _TEST
assert _BROWSER_PROBLEM_LISTS is None, "browser problem collector already active"
captured = []
_BROWSER_PROBLEM_LISTS = captured
_TEST = test
try:
yield
finally:
_BROWSER_PROBLEM_LISTS = None
_TEST = None
problems = [
f"{getattr(page, 'url', '<browser page>')}: {problem}"
for page, problem_list in captured
for problem in problem_list
]
if test is not None and (problems or getattr(test, "lf_failed", False)):
_picture_pages(test, [page for page, _ in captured])
> assert not problems, "\n".join(problems)
E AssertionError: http://127.0.0.1:52356/versions/v1.html: typed words left the screen without a key or press: "Child draft" in leaf-text.scroll
E assert not ['http://127.0.0.1:52356/versions/v1.html: typed words left the screen without a key or press: "Child draft" in leaf-text.scroll']
tests/render_harness.py:1305: AssertionError
The full tracebacks are in that run’s pytest-results-* JUnit artifacts.
Cause of a failure tracked in #4225.
Metadata
Metadata
Assignees
Labels
tend-ci-causeA root cause of a CI failure report
Activity
leaf-agent commentedon Nov 3, 2026
This has the same cause as #5156, and #5203 repairs it the same way #5200 did. Since #5039, a window with no room for the rail opens every thread in the floating panel. This test's sample child was that narrow, so the host's
{surface: 'page'}request opened the child's panel, and the panel's thread view replaced the comment field holding "Child draft". #5203 widens the sample so the page case covers the margin card again. Locally on main4a7adaf63,[False-page]failed with the scheduled run's errors before the change, and all four cases pass after it. PR CI is green atd5cf01dd, the review recorded that head for landing, and a tend-land run is merging it.The narrow-window path is still a real defect. There, a host's page-surface request replaces the panel field's draft without the yield that
{surface: 'panel'}applies. It is filed as #5202, with the cause and the open question of where the yield belongs.