Skip to content

Add portable Leaf agent benchmark - #555

Merged
max-sixty merged 2 commits into
mainfrom
codex/website-agent-single-reply
Sep 10, 2026
Merged

max-sixty merged 2 commits into
mainfrom
codex/website-agent-single-reply

Conversation

@max-sixty

Copy link
Copy Markdown
Owner

Summary

  • add one JSON benchmark for page presentation, comment acknowledgement, agent activity, publication, reply, and changed-page visibility
  • reuse the deployed verifier journey for both a supplied HTTP origin and the canonical local Python adapter
  • keep Cloudflare-specific provisioning out of the local path while preserving comparable application-level milestones

Evidence

  • uv run pytest tests (1007 passed)
  • focused website tests and pre-commit hooks
  • uv run scripts/benchmark-site.py local
  • uv run scripts/benchmark-site.py https://leaf.page

This was written by Codex on behalf of max-sixty

@leaf-agent leaf-agent left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Two findings on the new benchmark. The journey itself reads correctly, and uv run pytest tests/test_website_server.py passes (55) on the merged tree.

benchmark-site.py local fails when LEAF_SITE_RELEASE names a git SHA. site.py accepts either digest form — re.fullmatch(r"[0-9a-f]{40}|[0-9a-f]{64}", release) — and verify-site-agent-local.sh hands whatever site.json recorded straight back to the runner. With a 40-hex release the re-entry misses RELEASE.fullmatch, falls through to configure_origin, and the run dies with target must be `local` or an http(s) origin — an error naming a target the caller never typed. The inline suggestion widens the pattern to match site.py's.

The narrower point behind it: the re-entry is dispatched on the shape of the argument rather than on the signal that already marks it, since measure_local sets LEAF_BENCHMARK_OUTPUT for exactly this child. Branching on that env var first drops the RELEASE pattern entirely, and closes the gap where scripts/CLAUDE.md's "Each script's own docstring and --help own its behavior, flags, and lifecycle" meets a third mode neither one mentions.

The new assertion cannot tell page from changedPage. _DeployedPage.evaluate returns one constant STARTUP_READING keyed only on self.presented_at, so the two profiles are identical by construction and the assertion literal repeats the same thirteen readings twice. I swapped initial_startup and startup in the result dict and the test still passed — while the emitted sample would then report the post-turn reload's presentation as the first page's, which is the one comparison the sample exists to make: verify_agent_turn's own comment measures that gap at 123 ms before a turn against 2252-3918 ms after one. Keying the fake's reading on len(self.presentation_waits) would pin it. Happy to push that if you'd like.

Smaller, and a judgment call rather than a defect: startup_profile re-derives the same thirteen fields startup_line formats, and agent_profile the same milestones print_agent_profile prints. The printed CI profile and the JSON sample are the two readings anyone would compare, and they now extract independently. Having startup_line format from startup_profile(startup) would keep them unable to disagree.

Comment thread scripts/benchmark-site.py Resolved
Comment thread tests/test_website_server.py Resolved
@max-sixty
max-sixty merged commit 4bc5753 into main Sep 10, 2026
7 checks passed
@max-sixty
max-sixty deleted the codex/website-agent-single-reply branch September 10, 2026 16:42
max-sixty added a commit that referenced this pull request Sep 27, 2026
…hroughout" by area

Review of the faint/visible split found the containment filter dropping real
changes: it compared bounding boxes, so a strong region inside another strong
region's box (a button inside a restyled header-and-sidebar L, or the 3x2 change
the visual-review gallery has outside its focus) vanished, and "throughout" was
read off the box too, so a thin border ring counted as the whole image.

A strong region is never dropped now; only a slight region inside a larger box
is, and the check walks larger boxes first, so a page of equal specks compares
none. "Throughout" means the region's squares cover half the image's. "Faint"
claimed a perception the rule does not measure (text from #333 to #555 moves 34
levels and is plainly visible), so the kind is `slight` and the docs say how far
pixels moved rather than what a reader sees. The symmetric joins scan only later
neighbours without allocating, and a square stops measuring once it is strong:
2880x1800 all-changed went from 159 to 87 ms in Node.

visual-review puts "(N outside the focus)" beside the description it qualifies,
which the gallery's case 1 exercises again. stills.py crops to the strong
regions when there are any.

Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
max-sixty added a commit that referenced this pull request Sep 28, 2026
…outlines` (#1385)

A handoff page once shipped an `lf-shot` pair whose two sides matched in
every part its prose described, under an `alt` claiming the thread card
changed. Nothing on the page said so: a reader of one side of the
divider, or an agent screenshotting the page, cannot tell where a pair
differs, or that it differs nowhere. `lf-shot` now compares its two
images and says so on its rail, and with `outlines` it also outlines
each changed region on both frames.

## What the reader sees

Every pair's rail reads "identical", "only slight changes" (no pixel
moved far: a redrawn shadow, a small contrast shift, re-encoding), or
"changed throughout" (strong changes over half the image or more, such
as a photo turned black and white) when it has nothing to point at. The
first two take the warning style, since they are what a handoff gets
wrong. A pair with `outlines` also outlines each region that changed,
over both frames at the same place, and the rail counts them ("3 changed
areas"). The motivating pair now reads "only slight changes": its thread
card differed only by a shadow redrawn by 1–9 levels.

`outlines` is a boolean attribute, coded positively like `collapsed` and
`multiple`; `packages.md` ("A widget") now states that rule for widget
flags. `authoring-evidence.md` tells an author to add it and check an
outline stands where the prose puts the change; to leave it off where
most outlines would mark what the pair is not about, such as live data
between captures that cannot be retaken; and, for a pair reading "only
slight changes", to name the change in the prose.

## The rule and its one home

`skills/leaf/assets/runtime/image-difference.js` owns what counts as a
difference, with its measurements in the header: a pixel differs on any
channel, alpha included; 8px squares where some pixel moved 48+ levels
are strong, and strong squares within 3 squares join into one region; a
slight square joins only as a strong region's edge. `differenceKind` and
`describeDifference` give the reading its kind and its words. `leaf-dev
stills` loads the same module into its browser and crops each changed
state to the union of its regions, so the widget and the stills tool
cannot disagree.

Visual review sets `outlines` on the shots it builds, states the reading
in its case line ("Case 1 of 3 · Changed · 4 changed areas (1 outside
the focus)"), and hides the marks on its focus crop, whose coordinates
they do not share.

## Fixed on the way

- `media.js` read `node.matches` on anything in a click's path, and an
element with `id="matches"` made `window.matches` a node without the
method, so a click threw.
- A composed-tree climb took a detached `<a>` subtree's root `host` (its
URL's host name) for a node and threw on `getRootNode`. Main's
`shadowHost(root)` (#1376) covers it;
`tests/runtime/shadow-climb.test.mjs` pins the `<a>` case and
`anchor-controls.js` now uses the same helper.

## Measured

Guidance A/Bs, ×3 runs per arm, both arms run together:

- `evals/shot-pair-outlined` (a header-only change, kept): against this
branch's earlier wording, where every pair drew outlines unless it set
`no-outlines`, 0 of 3 base runs wrote `outlines` and 3 of 3 candidate
runs did; the judgment passed in both arms, so it measures that the
guidance names the attribute a page now needs. `shot-pair-live-data` (a
header restyle over live data that cannot be recaptured) ran as the
guardrail: every run in both arms left the pair without outlines, the
base with `no-outlines`, so it no longer told the wordings apart and was
dropped. Two candidate runs failed its regex only by nesting the images
inside `lf-shot`, since the eval's child cannot read the registry.
$4.46.
- The `no-outlines` wording, against the branch before it:
`shot-pair-live-data` went from 0 of 3 to 3 of 3, every base run already
pointing its prose at the header but having no attribute to set;
`shot-pair-differs` and `shot-pair-matches` held, and no run put the
flag on them. $6.75, plus $6.78 for a first draft named `unmarked` that
also hid the "identical" reading (0 to 2 of 3).
- Replacing `authoring-evidence.md`'s "a screenshot of the page cannot
show that the two sides match" with the rail's reading: no change on
`shot-pair-matches` (3 of 3 both arms) or `shot-pair-differs` (2 of 3
both), since the cold cases never render a page. $3.35. Main has since
dropped both cases (#1382).

The pixel rule, on the thread-card pair: redrawn shadows moved at most
20 levels (mostly 1), an 8% contrast change 17, palette quantization 35,
the grown card 227. Text going from #333 to #555 moves 34 levels, so it
reads "only slight changes" with no outline, and the guidance has the
author name such a change in the prose. Node timings: 2880×1800 all
changed 64ms, 2880×8000 192ms, one pair per frame after presentation.

The everyday gate passes: 1426 of 1428 on the last full run, whose two
`test_interact_contract.py` failures (a preview's contract, a
revendoring race) pass on rerun, alone and as a file, and touch nothing
here; 169 runtime tests. Two nightly render tests fail on this branch
and on its merge base:
`test_visual_review_gallery_gives_a_laptop_to_the_evidence` and
`test_the_versions_menu_uses_the_banner_panel_and_its_doors_edge`.

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

🤖 Generated with [Claude Code](https://claude.com/claude-code)

---------

Co-authored-by: Claude Opus 5.5 (1M context) <[email protected]>
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.

2 participants