Skip to content

Charts and diffs in an agent reply fail to draw after #6247 reads message HTML by CommonMark #6291

Closed

Description

@leaf-agent

Two tests that put a widget's markup into an agent's thread reply fail deterministically on main since #6247 (03ce66d98), "Read the HTML in an agent's message by CommonMark's rules, with no exceptions". They first failed in push run 44050787850, on 502a53b7c, and still fail at 2aabb5436.

  • tests/browser/widgets/test_charts.py::test_a_chart_in_a_closed_thread_draws_at_its_visible_width_when_opened: the page reports leaf: <lf-chart id="msg-chart"> failed: <lf-chart> has no data body (thrown at dataBody in runtime/widget-upgrade.js, called from lf-chart.js's draw), and #msg-chart svg[role=img] never appears.
  • tests/browser/controls/test_focus.py::test_a_scroll_box_in_a_panel_reply_takes_the_keyboard: the wait for #rp-diff's shadow code[data-code] with tabIndex === 0 times out after 120 s.

Bracketing: both pass at 36c61bee4, the commit just before #6247, and fail at 03ce66d98, #6247's own commit (local runs, node id only). The rest of the run's failures don't appear at that commit.

Diagnosis so far: both replies are "text": "<prose>\n\n" + <widget markup>, and the chart's markup is <lf-chart id=…><pre>\n…\n</pre></lf-chart> (tests/render_cases_widgets.py, chart_markup). Under CommonMark, an HTML block that opens with a custom element such as <lf-chart> is a type-7 block, which ends at the first blank line. Only a line that itself starts with <pre gets the type-1 rule that runs to </pre>. So a body containing a blank line could be split out of the widget, which would leave the chart without its data body. I haven't confirmed this by inspecting the rendered message. The repair needs to establish whether these fixtures are messages #6247 meant to read differently, so that the test markup should change, or whether widget markup in a message should keep its body intact.

Cause of a failure tracked in #3985.

Activity

  1. added
    tend-ci-cause
    on Nov 17, 2026
  2. leaf-agent commented on Nov 17, 2026

    @leaf-agent
    CollaboratorAuthor

    Confirmed. The fixtures are the problem, not the CommonMark change. Both write the widget's opening tag and <pre> on one line (<lf-chart id=…><pre>, <lf-diff id=…><pre>), so the line isn't an HTML block and Markdown wraps it in a paragraph. The browser then closes that paragraph at <pre> and moves the <pre> out of the widget. A blank line inside the body has nothing to do with it. These messages are seeded past admission, which would refuse them, so nothing reported the shape.

    #6293 puts <pre> on its own line, as #6247 did for its own fixtures. I ran both tests locally: they fail on main and pass on the branch. Its PR CI and landing are with tend-land.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    tend-ci-cause

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions