Skip to content

Fold the site benchmark into verify_site, and post the delivery eval's comment to an idle session - #1238

Merged
max-sixty merged 3 commits into
mainfrom
benchmarks-survey
Sep 26, 2026
Merged

max-sixty merged 3 commits into
mainfrom
benchmarks-survey

Conversation

@max-sixty

Copy link
Copy Markdown
Owner

Two benchmark fixes from a survey of Leaf's measurement harnesses.

One site journey, not two. scripts/benchmark-site.py ran the same verify_agent_turn journey as verify_site.py --agent and differed only in printing JSON. The agent pass now writes its progress and timings to stderr and one JSON sample to stdout, so the production gate and the benchmark are one run, and benchmark-site.py is deleted. deploy-site-dev.sh calls verify_site.py ORIGIN --release … --agent. Without --release, the agent pass reads the release from the origin's state as the benchmark did, so it still measures any origin (production included) with no local build. The sample's description moves into verify_site.py's module header.

The delivery eval measured the wrong route and never ended a session. scripts/eval_claude_delivery.py posted its comment 5 s after it saw the page URL, which was still inside the agent's setup turn. The leaf wait then ended mid-turn, the Stop hook delivered the comment, and the agent handled it in that same turn. The stream held one result, the results > 1 close never fired, and every session ran out the 600 s limit (both arms of a first run did). The comment is now posted once the setup turn's result arrives, so it reaches an idle session through the background-task notification the docstring describes, and the scorer counts only notifications after that turn.

A four-round A/A run on the fixed harness (both arms on the same plugin code) finished all eight sessions with no timeouts:

arm pickup (s) first reply (s)
base 8, 8, 11, 9 10, 9, 13, 11
head 6, 8, 7, 5 7, 10, 9, 7

So the noise floor is about ±2–3 s at four rounds, and "actions before ack" read 1 in every run, which means it can't tell arms apart. Each session cost about $1, and the docstring now says so. That run predates #1216's child isolation.

Tests: test_the_agent_pass_emits_one_json_sample_for_local_and_remote_targets replaces the benchmark CLI test. It asserts that stdout is only the JSON sample and that a remote agent pass needs no local manifest. The post-presentation wait test now reads its profile line from stderr.

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

🤖 Generated with Claude Code

max-sixty and others added 3 commits September 26, 2026 09:35
… comment to an idle session

`benchmark-site.py` ran the same agent journey as `verify_site.py --agent` and
differed only in printing JSON. The agent pass now writes its progress and
profile to stderr and one JSON sample to stdout, so the production gate and the
benchmark are one run; `deploy-site-dev.sh` calls it with `--agent`. Without
`--release`, the agent pass reads the release from the origin's state, as the
benchmark did, so it still measures an origin with no local build.

`eval_claude_delivery.py` posted its comment five seconds after it saw the page
URL, inside the agent's setup turn. The wait then ended mid-turn, the Stop hook
delivered the comment, and the agent handled it in that same turn, so the
stream held one `result`, the `results > 1` close never fired, and every session
ran out the 600 s limit (both arms of the first round did). The comment is now
posted once the setup turn's `result` arrives, so it reaches an idle session
through the background-task notification the docstring describes, and the
scorer counts only notifications after that turn. A four-round A/A run on the
fixed harness finished every session, with no timeouts. The docstring's cost is
corrected to about a dollar per session, measured.

Tests: `test_the_agent_pass_emits_one_json_sample_for_local_and_remote_targets`
replaces the benchmark CLI test and asserts stdout is only the JSON sample, and
the post-presentation wait test reads its profile line from stderr.

Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
# Conflicts:
#	scripts/eval_claude_delivery.py
# Conflicts:
#	scripts/AGENTS.md
#	scripts/benchmark-site.py
@max-sixty
max-sixty merged commit 3b541e5 into main Sep 26, 2026
5 checks passed
@max-sixty
max-sixty deleted the benchmarks-survey branch September 26, 2026 19:44
max-sixty added a commit that referenced this pull request Sep 26, 2026
…delivery eval an ack reading and a mid-turn case (#1240)

Two follow-ups to #1238's benchmark survey.

**`verify-site-local.sh` becomes `verify_site.py wrangler`.** The shell
script started `wrangler dev` with prewarm off, polled it, ran
`verify_site.py`, and printed the Worker log on failure, which is the
same lifecycle `local_adapter()` already ran in Python for the `local`
target. Both targets now share `serving` (start, wait for readiness,
terminate) and `logged` (collect output, print it beside any failure).
CI, `publish-site`, `AGENTS.md`, `scripts/AGENTS.md`, and
`/developing-leaf` call the new target. It also removes its own
containers once wrangler exits: `wrangler dev` 4.130 stops each
session's container but leaves its `proxy-everything` sidecar running,
and no later run reclaims it, so each local run used to leak about three
running containers. To tell its containers from those of another
`wrangler dev` of this Worker (such as `npm run dev` in `worker/`), the
run serves under a Worker name of its own, `lv<pid>`, which workerd puts
in every container's name. Verified with real runs through Docker,
including one beside a stand-in container named like another run's,
which survived.

**The delivery eval gets a sharper per-comment reading and a mid-turn
case.** "Actions before ack" read 1 in every run because the one action
was always the expected read of the wait's output, so it had no range.
It is replaced by `ack`, the seconds from the delivery reaching the
agent to its pickup (the agent's own share of pickup time), and `extra`,
anything run before `leaf wait --ack` other than that read. Cases:

- `idle`: a comment after the setup turn ends, then a second once that
turn has ended, which only arrives if the ack re-armed the wait;
- `mid-turn`: a comment posted while the setup turn runs, which the Stop
hook carries in.

The children now run with `--include-hook-events`, each stream record
carries the time it was read, and `ROUNDS` drops to 2. One A/A round
(same plugin in both arms):

| session | route | pickup | reply | ack | extra |
|---|---|---|---|---|---|
| base idle #1 / #2 | notification | 6 s / 5 s | 9 s / 8 s | 5 s / 5 s |
none |
| head idle #1 / #2 | notification | 5 s / 5 s | 11 s / 8 s | 5 s / 4 s
| none |
| base mid-turn | Stop hook | 10 s | 13 s | 6 s | read two references
first |
| head mid-turn | Stop hook | 8 s | 13 s | 4 s | none |

On idle comments nearly all of pickup is the agent's own time; the
notification lands within a second of the comment.

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

---------

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