Skip to content

Measure which widgets agents write that fail to draw, and keep plain page check's browser run - #3901

Closed
max-sixty wants to merge 2 commits into
mainfrom
grind/g-check-browser
Closed

max-sixty wants to merge 2 commits into
mainfrom
grind/g-check-browser

Conversation

@max-sixty

@max-sixty max-sixty commented Oct 25, 2026 •

Copy link
Copy Markdown
Owner

Plain page check draws a page in the host's browser (about 1.3 s instead of 0.15 s) only where the page has a script or places a page widget, a data widget or a widget naming page media (needs_browser). TODO.md asked for evals measuring the widgets it leaves undrawn, then to run the kinds agents get wrong and stop running those they reliably get right. This adds the evals and the measurement. The measurement leaves needs_browser unchanged.

What changed

  • evals/placed-widgets-draw has an agent author a README review (lf-text-document with a Markdown preview), the notification design playground (lf-playground), or a latency summary whose thread message carries a chart. visual-change-uses-captures/visual-review has one build an lf-visual-review from that case's captures. All are tagged checks and draws.
  • dev/leaf_dev/page_draws.py, the cases' assertion, runs render_gate.page_code.run_page_code on the final page whether or not needs_browser asks. Where an agent message carries markup, it then opens each such thread and collects the error events the runtime posts. It fails on any of them. Its metadata records which widgets the page and its messages placed, whether plain check would have drawn the page, the drawing failures the executor's final --render read, and which of the author's own checks reported one.
  • Codex's leaf tool calls are now in the eval traces. eval_codex records an MCP result's content list, as Claude Code records a tool result. authoring_eval.check_log also reads page checks Codex runs through its leaf tool (args). Before, check_log matched only shell commands, so since Run leaf from Codex's sandbox through a plugin MCP server #3331 no authoring sample's check_log showed a Codex page check.
  • render_gate/page_code.py's header records the decision and points to the note for the counts. TODO.md narrows the item to the kinds the data leave unsettled. notes/agent-usability-evals.md gains "Widgets that fail to draw" with the runs.

Evidence

Run at f00911ed1: 41 samples on Claude Code (Opus 5.5, $27) and 28 on Codex (Sol 6.1):

uv run leaf-dev eval 'placed-widgets-draw*' visual-change-uses-captures/visual-review --harness claude-code --repeat 3 -j 2
uv run leaf-dev eval 'placed-widgets-draw*' visual-change-uses-captures/visual-review --harness codex --repeat 2 -j 2

Further runs of the same cases, with more repeats of the thread message, brought the counts to these. Final pages and messages with a widget whose drawing the runtime reported as failed, with Wilson 95% intervals:

Widget Claude Code Codex Both
lf-text-document with a Markdown preview 0 of 8 0 of 5 0 of 13 (0–23%)
lf-playground, markup only 0 of 4 0 of 5 0 of 9 (0–30%)
lf-visual-review with focus rectangles 0 of 8 0 of 5 0 of 13 (0–23%)
lf-chart in a thread message 0 of 17 0 of 13 0 of 30 (0–11%)

Failures found during authoring. Final pages hide what authors fixed mid-session, so I read every author's own page checks from the saved traces. --render reports a widget that fails to draw as a console-error. 19 of 41 Claude Code authors ran it 46 times, and 6 of 28 Codex authors 10 times.

  • Text documents, playgrounds and visual reviews: it reported no drawing failure, so those rows hide none.

  • Thread charts: this is the least biased row, since --render is the only check that opens a thread and 25 of the 29 thread-message samples never ran it. Those 25 posted no failing chart. The other 4 Claude Code authors drew their chart on a scratch page, and 2 found a failure:

    • One lf-chart failed with invalid lineAnchor (a function where Plot takes a constant). The runtime reports this one. The author fixed it before posting; an author who ran only plain page check would have posted it.
    • One posted chart logs Plot's translate(0.5,NaN) console error. The runtime reports no error event for it, so neither page_draws nor plain check catches it. The final --render still does, because the frozen message keeps it.

    So at least 2 of the 29 samples (7%, 2–22%) had a chart draft that failed.

Plain check itself drew 5 Claude Code pages during authoring and caught a real failure on 1. On that page, a script's recorded-design element read the playground's controller before the playground had captured it, and the author fixed it after the check named the error.

As a control, the assertion catches what plain check misses. On a hand-made page, a playground control whose value="40" exceeds max="24" passes plain page check (status 0, no browser), and page_draws reports <lf-playground id="pg"> failed: control radius has a value outside its range. A thread message's <lf-chart> with an invalid body is reported against its thread.

Decisions (Max may reverse)

  • Text documents, playgrounds and visual reviews stay undrawn. Agents wrote none that failed, at the end or during authoring, so drawing them would add 1.2 s to each such check and catch nothing these samples show.
  • Page code stays drawn, since it caught a failure on 1 of the 5 pages it drew.
  • Data widgets and media stay drawn, unsettled. lf-chart drafts failed in at least 2 of 29 thread samples, so the data-widget run isn't idle. Mermaid diagrams, diffs, drafts and page-level charts are untested, and media appears on only 3 lf-shot pages. The TODO item asks for those contexts.
  • Thread markup still posts undrawn. It is outside needs_browser. Drawing a message's widgets before posting would have caught the lineAnchor draft, but not the NaN chart. One draft in 29 doesn't settle whether 1.2 s per widget-carrying message pays for itself. This is the closest call in the data, and the TODO names it.
  • The visual-review prompt names the package. Asked for "a Leaf visual review", 3 of 3 Claude Code authors paired the captures in lf-shot instead. The case therefore measures whether the widget draws once it is chosen, not whether authors find it.

What I ran and didn't verify

  • uv run pytest dev/tests/test_evals.py -q -n0 passes, and the pre-commit hooks pass on every changed file. After the refactor, the scorer still reports both hand-made failures and still passes three saved samples (a thread chart, a visual review and a text document). Re-normalizing a saved Codex trace through the new eval_codex gives check_log its page-check output.
  • The table's counts come from the runtime's own reports, so a widget that draws wrongly without reporting (an empty review, the NaN chart) counts as drawn. The final --render reported no drawing failure on the other 68 samples. I read the bound runs of 7 visual reviews by hand: each held both cases, with focus rectangles inside the 1200×700 captures.
  • page_draws.py reads pages with this checkout's Leaf, so it grades only the candidate arm. --base comparisons would need it to use the arm's code.
  • I did not re-measure the 1.3 s and 0.15 s timings, and ran no new evals after the review.

This was written by Claude Code on behalf of max-sixty

max-sixty and others added 2 commits October 24, 2026 21:57
…page check's browser run

Plain `page check` draws a page in a browser only where it has a script or
places a page widget, a data widget or a widget naming page media
(`needs_browser`). The new `placed-widgets-draw` cases, with
`visual-change-uses-captures/visual-review`, have agents author the kinds
it leaves undrawn: a text document, a playground, a visual review and a
thread message carrying a chart. `dev/leaf_dev/page_draws.py` draws each
final page and opens each thread holding markup, and fails on any error
the runtime reports.

Over 41 Claude Code and 28 Codex samples at f00911e, none of 65 final
pages and messages failed to draw (Wilson 0-6%), while plain check's
own run caught a page-script failure on 1 of the 5 pages it drew during
authoring. So `needs_browser` stays as it is; data widgets and media
remain unsettled, and the TODO item now asks for the cases that would
settle them. notes/agent-usability-evals.md, "Widgets that fail to
draw", has the runs.

`authoring_eval.check_log` also reads page checks Codex runs through its
`leaf` tool; it matched only shell commands, so Codex samples showed none.

Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
… from page_draws

Review of #3901. The final-page rates hid what authors fixed mid-session,
so the note and TODO now read every author's own page check from the saved
traces. `--render` reported no drawing failure for text documents,
playgrounds or visual reviews, but 2 of the 4 authors who drew a thread
chart before handover found one: an `lf-chart` failing on a function
`lineAnchor` (fixed before posting), and a posted chart logging Plot's
`translate(0.5,NaN)`, which the runtime doesn't report. So at least 2 of
29 thread-chart drafts failed (2-22%); posting stays undrawn, and the TODO
names it as the open call.

- `page_draws` calls `run_page_code` for the page and keeps only the
  thread pass, so a refused page reports what plain check reports. It
  matches failure codes in compact JSON too (`jq -c`), counts
  `page-exception`, and records the executor's final `--render` readings.
- `eval_codex` records an MCP result's `content` list, as Claude Code
  does, so `check_log` no longer parses a JSON wrap back; `"args": null`
  no longer raises.
- The `page_code.py` header keeps the decision and points to the note for
  the counts.

Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
max-sixty added a commit that referenced this pull request Oct 25, 2026
…horing-effort campaign (#3960)

The arrangement executor pinned every author's `page check --render` to
the fixed 1280×720 window, so authors fought a constraint Leaf doesn't
impose in use. This PR stops that, and records the 2026-10-24
authoring-effort campaign in `notes/agent-usability-evals.md`.

**Unpinned author render checks.** `arms.environment` pins the render
check's window for every child so a judged page's verdict doesn't depend
on who last viewed it, and that pin also reached the authors. In the
width phase the user states a 1600×1000 window, but the browser user
first opens the page in the comment phase, so every render check kept
reading 1280×720 ("fixed, pinned by LEAF_RENDER_VIEWPORT"). In 8 of 12
Claude Code Leaf width revisions the author hunted for a way out: it ran
`LEAF_RENDER_VIEWPORT=1600x1000 leaf page check` (a ValueError), grepped
Leaf's source for the variable, unset it, and took its own screenshots.
In use the check reads the window the user's browser last reported, so
this cost came from the harness. Leaf authors now run unpinned, and
after the first handoff the executor opens the page once at the run's
first window, as the user who said "I'll open it" would, until the page
records the view. The harness's own checks keep the pin. Configuration
workflow, Claude Code (Opus 5.5), 5 samples after the change: render
checks after the handoff read 1600×1000, "the user's window"; no call
named the variable (0 of 5, against 4 of 6 before); width-phase minutes
2.1, 2.0, 2.2, 2.2, 2.8 against 2.6, 2.8, 1.6, 1.9, 1.9, 4.9; 4 of 4
judged samples passed. One sample's scratch cleanup failed with
"Directory not empty" on its state home after the Stop hook was killed
(137); the next 3 ran clean.

**The notes section** ("Authoring effort, 2026-10-24") records where a
Leaf author's first turn spent time an HTML author's didn't, the repair
for each sink with its before and after counts (#3952, #3954, #3956,
#3959), the full-workflow validation on Claude Code and Codex, the
record review's measured cost, and the decision-overclaim observation
with the reader split behind #3959's wording change. The per-cycle log
and scripts stay in the campaign worktree's `.tmp/overnight/`.

Overlap: #3913 also edits `dev/leaf_dev/arrangement_eval.py` (task
selection, not the render pin), and #3898, #3901, #3913 and #3923 each
add to `notes/agent-usability-evals.md`; whichever lands second takes a
textual merge.

Checks run: `dev/tests/test_evals.py` and
`dev/tests/model/test_eval_discover.py` (3 pass); an import of
`leaf_dev.arrangement_eval`; pre-commit over the diff. The executor
change itself was exercised by the campaign's 5 post-change workflow
samples, not rerun here.

> _This was written by Claude Code on behalf of max-sixty_

---------

Co-authored-by: Claude Opus 5.5 (1M context) <[email protected]>
@max-sixty

Copy link
Copy Markdown
Owner Author

Superseded by #3923 (merged), which measured the same question with evals/widgets-draw-as-written, kept plain page check's browser rule, and draws a thread message's widgets before it posts.

This was written by Claude Code on behalf of max-sixty

@max-sixty max-sixty closed this Oct 25, 2026
max-sixty added a commit that referenced this pull request Oct 25, 2026
#3901 closed as superseded by #3923, which has merged. #3901 still held
findings #3923 lacked; this carries them into
`notes/agent-usability-evals.md`, inside "Widgets plain page check
doesn't run, 2026-10-24", and ports #3901's control of the draw-failure
grader.

## The note

- #3901's final counts, with Wilson 95% intervals: text documents 0 of
13 (0–23%), markup-only playgrounds 0 of 9 (0–30%), visual reviews 0 of
13 (0–23%), thread charts 0 of 30 messages (0–11%).
- 2 of 29 thread-chart samples (7%, 2–22%) had a draft that failed while
being written: one with `invalid lineAnchor`, which the runtime reports,
and one with Plot's `translate(0.5,NaN)`, which the runtime of the time
didn't.
- Asked for "a Leaf visual review", 3 of 3 Claude Code authors (44–100%)
used `lf-shot`. So the visual-review rates measure whether the widget
draws once chosen, not whether authors find it.

## The `translate(0.5,NaN)` chart

#3901's saved sample (`placed-widgets-draw-thread-message-wh5421ar`)
shows the cause: a `Plot.text` mark given `dy: (d) => (d.region ===
"us-east" ? 14 : -10)`. That is the per-datum offset #3956 refuses.
Drawn on a page at main `d91276596`, plain `page check` reports
`marks[1] (text) has a dy that is not a number`, and `thread create`
would refuse the message. #3901 reported no other NaN drawing, so the
after-draw NaN scan #3923's merge dropped would catch nothing these runs
show. The note says so, and `TODO.md` gets no item.

## The grader's control

`dev/tests/browser/test_draw_failures.py` ports the control onto main's
`dev/leaf_dev/draw_failures.py` with the grader unchanged. A playground
control at `value="40"` over `max="24"` passes plain `page check`
(`status 0`, no browser), and the grader, reading `--render`, reports it
beside a thread message's `lf-chart` whose body throws. The message is
written to the log directly, since `thread create` now draws a chart
before posting and would refuse it. With the value set back in range,
the test fails at the playground assertion.

`uv run pytest dev/tests/browser/test_draw_failures.py -q -n0` passes,
and pre-commit passes on the changed files.

> _This was written by Claude Code on behalf of max-sixty_

Co-authored-by: Claude Opus 5.5 (1M context) <[email protected]>
max-sixty added a commit that referenced this pull request Nov 23, 2026
`notes/agent-usability-evals.md` still described results of
`visual-change-uses-captures/review` and `/review-scaled`, which this branch deletes.
Each count now covers the cases that remain, from the note's own table: 60 Claude Code
and 36 Codex pages, 0 of 48 playground and text-document pages failing to draw (Wilson
0–7%), and the fine-steps context's 20 drawn pages (0 of 68 with the plain contexts,
0–5%). #3901's counts drop its visual-review case.

Dropped because the tree holds nothing to split them by: the per-context cost range
($0.41–1.77 a page), the Codex author whose page script misused `generatedElement`
(the note doesn't say which harder context it came from), the "41 on Claude Code and
28 on Codex" sample counts in #3901, the timing row over 70 final eval pages and the
by-context 6.5–11.1 s range that named visual reviews as the slowest.

Also dropped, recorded here: asked for "a Leaf visual review", 3 of 3 Claude Code
authors in #3901 paired the captures in `lf-shot` rather than `lf-visual-review`, so
the package was named in the prompt from then on.
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.

1 participant