Repository navigation
Add leaf-dev guidance-ab, the guidance eval A/B in one command - #1366
Merged
Merged
Conversation
The mechanisms the scripts, the suite and the eval harnesses share now live in one package, `leaf_dev` under `dev/`, rather than as sibling modules found through `scripts/` on sys.path. It is a uv workspace member that only the root dev group depends on, so the checkout's environment installs it editable and `bin/leaf`, which runs `--no-dev`, never does. An arm carries `dev/pyproject.toml` so uv can read the lock; a ref from before the package has none and builds as before. - `eval_harness.py`, `page_fixtures.py` and `example_data.py` move in as `harness`, `page_fixtures` and `example_data`; every importer cuts over, and the notes harnesses drop their sys.path insertion. - `leaf-dev probe SOURCE` builds a page from the working tree, runs input steps, and prints what a JavaScript expression returns, the console errors, and optionally a screenshot, with `--base` for the merge base beside it. Agents wrote about 1,150 throwaway Playwright scripts doing this over three weeks. - `stills.py` becomes `leaf-dev stills`; its state inputs are reachable from probe as `drive:NAME`. - `eval_harness.py REF DEST` becomes `leaf-dev arm REF DEST`. - `harness.serving_source` builds and serves an authored source on an arm, and `browser.tab` opens and settles a tab, for both commands. - `example_data.named_source` resolves a page name for preview and probe alike. Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
# Conflicts: # scripts/bench_render_check.py
- preview.py --runtime runs its worker in the other checkout's --no-dev environment, which lacks leaf_dev; the worker now overlays this checkout's dev/ with --with-editable. leaf-dev names no leaf dependency, so the overlay keeps the selected checkout's leaf. - probe listens for console errors from the first request, reports a failure at any stage (build, load, a step, the shot) as that arm's reading and runs the other arm, fails fast on a crop target that is not displayed, and writes each run's shots to a directory of its own. - harness.build_source builds an authored source on an arm; serving_source and both bench scripts use it. Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
# Conflicts: # AGENTS.md # scripts/AGENTS.md
Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
Every guidance change is scored on the base and on the working tree, and sessions assembled that by hand: an arm built outside the checkout, the cases copied in, two `claude plugin eval` runs launched together, two result sets read into a Record row. `leaf-dev guidance-ab [CASE]... [--base REF] [--runs N]` does all of it and prints each case's passes per arm, the cost (children and judges; the aggregate's costUsd leaves the judges out) and a Record row with "Tried" left blank. The candidate is an arm too, built from the working tree, uncommitted and untracked files included: the checkout would load arms and other plugins under its .tmp/, and would hold examples, docs and notes the base arm does not. `build_arm(None, dest)` builds that arm, through `copy_working`, which also copies the selected cases into both arms, so several globs select and a case newer than the base runs on it. It replaces `leaf-dev arm`, whose one documented use was this recipe. The command avoids the word "eval" in its name because the isolated worktree guard refuses any Bash line containing it. Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
A run that errored (a rate limit, a timeout) measured nothing about the
guidance, yet the table and Record row showed it as a failure. Each
count now names the errored runs ("0 of 3 (2 errored)"), and an arm
whose aggregate is partial is warned about.
Each `claude plugin eval` starts in a session of its own, and however
the command stops, SIGTERM included, it SIGTERMs each still-running
group and SIGKILLs it after ten seconds, so no paid `claude -p` child
outlives the arm it runs on. Before, only the parent was killed, and
SIGTERM skipped the cleanup.
`copy_working` keeps symlinks as links, as `git archive` does. Each
invocation's output directory is unique, so two started in the same
second no longer collide.
Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
# Conflicts: # .github/workflows/publish-site.yaml # dev/AGENTS.md # dev/leaf_dev/cli.py # dev/leaf_dev/harness.py # evals/README.md # scripts/AGENTS.md
leaf-agent
reviewed
Sep 27, 2026
leaf-agent
left a comment
Collaborator
There was a problem hiding this comment.
The cleanup in run_together skips a process group once its top-level claude plugin eval process has exited. If that process exits while a claude -p child is still running, proc.poll() is non-None, so the child survives after the arm directory is removed and can keep billing. I reproduced this with a subprocess that started a sleeping child in its session and then exited: the child was still running when run_together returned. Please terminate and wait on each process group through the grace period even when its leader has already exited.
`run_together` signalled a run's process group only while its top-level `claude plugin eval` was still running, so a `claude -p` child left behind by a leader that had exited kept running, and billing, after its arm was deleted. `stop_group` now signals every group however the runs end, waits for it to empty, and SIGKILLs what remains after the grace period. macOS answers EPERM for a group holding only zombies another process will reap, so that reads as an empty group too. Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
leaf-agent
previously approved these changes
Sep 27, 2026
# Conflicts: # dev/AGENTS.md # dev/leaf_dev/cli.py # dev/leaf_dev/harness.py
leaf-agent
approved these changes
Sep 27, 2026
max-sixty
added a commit
that referenced
this pull request
Sep 28, 2026
…ng-leaf (#1371) `evals/README.md` held the suite's method and a Record table of every A/B. The table grew to two thirds of the file in three days and repeated each fix's commit message. Nothing said when a case measured during a fix should stay, so cases that passed on both arms stayed too: 6 of the 15 have never told two wordings apart. This change sets the rule for new cases and records where each old one stands; removing the six is a separate decision. - **Method** moves to `/developing-leaf`, "Score a guidance change", where the repo keeps its workflows, trimmed to what an agent running or adding a case needs. It runs A/Bs through `leaf-dev guidance-ab` (#1366), which no longer prints a Record row. - **Rule for adding a case:** it pins a clause no case pins, and it separated two arms, with the base failing most runs and the change passing every run, or a blunter draft failing a guardrail the change passes. That is usually one case per problem, rarely more than two. A case both arms passed goes in the commit message instead. - **History:** each case's Record history is now a comment at the top of its `case.yaml`: where it came from, and base against change at named commits. The rows for A/Bs that kept no case live in their commit messages (#1311, #1332). `tags` stay the suite's categories. - `AGENTS.md`, `dev/AGENTS.md` and `leaf_dev/harness.py` point at the new section. #1363's rows are in its three cases' comments. Two unopened branches that add rows will conflict on the deleted file; their rows move the same way. > _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]>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
uv run leaf-dev guidance-ab [CASE]... [--base REF] [--runs N]runs the guidance evals inevals/on the base's guidance and on the working tree's, both at once. It then prints each case's passes on each arm, the total cost, and a pre-filled row for the Record table inevals/README.md, with the "Tried" cell left for the author. Until now, sessions put this A/B together by hand for every guidance change: an arm built outside the checkout, the cases copied in, twoclaude plugin evalruns started together, and two result sets read into a row.Design
build_arm(None, dest), viaextract_payload). If the checkout ran as the candidate, it would load any arms or plugins under.tmp/as extra plugins, and it would carry examples, docs and notes that the base arm lacks.--case.--casetakes only one glob. Copying lets several globs select cases, and a case newer than the base still runs on the base.harness.copy_workingcopies tracked and unignored untracked files, with edits, and keeps symlinks as links, asgit archivedoes. Bothextract_payload's working-tree branch and the case copy go through it.costUsdleaves out.claude plugin evalruns in its own session. However the runs end, including an error, Ctrl-C or SIGTERM,stop_groupSIGTERMs whatever is left in each process group, even when the group's leader has already exited, then SIGKILLs anything still there after 10s. That way no paidclaude -pchild outlives the arm it runs on.leaf-dev armis removed. Its one documented use was the hand recipe thatevals/README.mdnow replaces with this command.Checks
--runs 1, $1.44 in all. Against the merge base,pin-takes-no-page-roompassed 1 of 1 on both arms ($0.35). Against--base bc04aa55fwith two case globs, the output is the table above ($1.09). That matches the Record row for the pin change: the base fails itsjudgmentgrader, andshot-pair-matches, a case newer than bc04aa5, runs on the base.claudeonPATH. It printed0 of 3 (2 errored)and the warning, at no cost.extract_payloadon the working tree againstgit archiveof HEAD, over the fullPAYLOADon a clean tree: 426 files each, with no difference in bytes, executable bits or link targets. Untracked files and symlinks carry over.🤖 Generated with Claude Code