Skip to content

Choose every A/B command's arms one way, with the working tree as head - #5239

Merged
max-sixty merged 3 commits into
mainfrom
agent-ab3cc6983e2a22745
Nov 3, 2026
Merged

max-sixty merged 3 commits into
mainfrom
agent-ab3cc6983e2a22745

Conversation

@max-sixty

Copy link
Copy Markdown
Owner

The seven leaf-dev commands that run Leaf at two versions (stills, probe, compare, pins, profile, bench-check, bench-latency) now choose their arms through one function, arms.choose_arms, and one option, --base [REF] (arms.base_option). Head is always this working tree in place, uncommitted edits included. The base is the merge base with main, or the commit --base REF names. The arms are called base and head in every command's output, files and slots.

Before this, the seven had four spellings (a positional BASE_REF, --base [REF], --base REF, --tree), two meanings of head (stills, bench-check and bench-latency built the committed HEAD and told you to commit first; the others ran the working tree), five label sets, two ways to build the base (extract_arm, build_arm) and two implementations of --authored.

What changes for each command

Command Before Now
stills positional BASE_REF; head = committed HEAD --base REF; head = working tree
bench-check positional BASE_REF; head = committed HEAD --base REF; head = working tree
bench-latency positional BASE_REF, head = committed HEAD; or --tree for the working tree alone the working tree alone (what --tree did); --base [REF] adds the base
compare --base REF; baseline/candidate slots and output --base REF; base/head
probe arm worktree; JSON field ran; recordings in DIR/worktree arm head; field commit; DIR/head
profile arm worktree arm head
pins head listed first base first, as everywhere

stills, compare and bench-check always run a base, since their readings mean something only beside it (base_option(paired=True)); probe, pins, profile and bench-latency run one only when given --base. A bare --base takes the next word as its REF, so the help says to put it after any arguments, as probe's and profile's did.

One way to build the base

choose_arms builds the base with build_arm from the whole tree at its commit, which compare already needed, since its preview runs the base's own leaf_dev worker. A whole checkout makes --authored one path mapping into it (arms.own_source), shared by stills and compare, instead of stills' list of authored directories to extract and compare's corpus special case. extract_arm and build_pair are gone.

On a quiet disk, building the whole tree took 2.7 s against 2.2 s for the payload and 0.4 s for extract_arm, whose unbuilt payload then built its environment on its first uv run. The whole tree is about 1,900 tracked files against 750 for the payload, beside a few thousand in the base's .venv, so under heavy disk contention the base takes proportionally longer to write.

Head runs in place, as probe, pins, profile, compare and bench-latency --tree already did, so an edit made during a long stills run reaches the states captured after it.

Evidence

With an uncommitted edit to the heading of examples/review-a-plan.html, on the merge commit 6141620f3 against its merge base 18479950c:

  • stills --state review-a-plan printed base 18479950c5 vs head 6141620f3e and found the state unchanged, since both arms build the page from this working tree's source. With --authored it found 428,017 px changed: the base read its committed heading and the head the edited one, which wraps to two lines.
  • probe review-a-plan --js "document.querySelector('h1').textContent" --base printed one line for base and one for head, each with its commit, both showing the edited heading.

On 38fd46e3a, before merging main:

  • pins --base wrote a report of "26 cases on this working tree against the base, b76f665", with 52 lf-shot pairs.
  • bench-latency --base --page triage-board --transition comment --runs 1 printed a base and a head row.
  • profile triage-board comment --base printed the per-run detail for base and head and the side-by-side summary.
  • bench-check, narrowed to one page and one check per arm in a scratch script since it has no option for that, printed base b76f665a2f vs head 38fd46e3a2 and its table with the change column.
  • compare review-a-plan printed a base: and a head: preview URL within 25 s, both serving the page, with the base built under .tmp/compare/run-…/arms/base; SIGTERM stopped both previews.

dev/tests/model/test_stills.py, dev/tests/journeys/test_compare.py and the probe recording test pass, and pre-commit is clean. Across the seven commands and arms.py, the change removes 27 lines of code net (docstrings not counted) and adds 19 lines of docstrings.

Left as they are

  • leaf-dev eval declares the same --base [REF] by hand and labels its arms base/candidate; its arms stay payload-only copies, since its child agents must not read another arm's files. It can take base_option() once the eval --from change touching that command lands.
  • leaf-dev bugback still says to commit first: it reverts the branch in a git worktree detached at HEAD, a different mechanism from these arms.
  • A head arm reports HEAD's commit even when it ran uncommitted edits.

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

@max-sixty
max-sixty merged commit 89482e4 into main Nov 3, 2026
4 checks passed
@max-sixty
max-sixty deleted the agent-ab3cc6983e2a22745 branch November 3, 2026 20:43
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