Skip to content

Fold the harness verifiers into leaf-dev journey, with an HTTP or browser user end - #2144

Merged
max-sixty merged 21 commits into
mainfrom
thread-title-latency
Oct 9, 2026
Merged

max-sixty merged 21 commits into
mainfrom
thread-title-latency

Conversation

@max-sixty

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

Copy link
Copy Markdown
Owner

leaf-dev journey TARGET is now the one command that runs a real session of a harness or the website and checks and times what the user's comments get. verify-claude-code-task, verify-codex-task and verify-pi-task are folded into it and deleted.

There were three launchers for "a real session of harness X": the journey's headless claude -p, the Claude Code tmux driver, and codex_task.Task. The journey timed one comment through a browser but ran Claude Code headless, unlike a user's session. The verifiers ran the realistic sessions and checked several moments, but timed nothing per comment. Now each target runs its most realistic session, and every step is both checked and timed.

Targets

  • claude-code: interactive Claude Code in tmux; --hooks-module turns on the plugin's hooks module.
  • codex-app-server and codex-queue: a Codex task on each transport. The queue transport is the desktop app's route and had no journey before. --preview keeps verify-codex-task's preview checks.
  • pi: a real Pi session.
  • website-adapter (was local): leaf.page's adapter on this host.
  • website-worker (was wrangler): the built site through the local Worker and a page container. The rename covers verify-site, ci.yaml, publish-site.yaml, AGENTS.md and the docs.
  • Or a website origin.

The user's end: HTTP or --browser

One axis applies to every step:

  • HTTP, the default for harness targets, starts no browser. Each comment is posted as the page's tab posts one, and checked and timed from the event log on the page server's clock: picked up (opened, separate from queued per Read pickup receipts through the delivery contract #2080), work started, progress, published, titled, replied. Across the runs below, a browser adds only 0.1–0.6 s to a harness reply.
  • --browser, the only end for website targets, is the whole unmocked journey. Every comment is typed as a user types it: a page comment in the banner's comment card, an anchored one on its selected passage. The page records when each reply showed: its message in view, its thread's row, or its news notice once the page has applied the reply. The release ask's reload is checked and profiled.

Both ends share one User and one release check (run_journey): an end only sends the ask, and the shared code waits on the turn, the title and the answer.

What each harness checks

Every check the verifiers made still runs:

  • each comment is answered once;
  • a comment sent during a turn is picked up in it (Codex: on the queue transport);
  • Escape closes the turn, and a comment after it is answered;
  • restart and resume recover (Codex: Fix Codex turn tracking and atomic claim discovery #2046's Stop-first resume);
  • quitting ends the claim.

Claude Code's permission prompts are answered and recorded on the step's sample. Detection of the user's command is scoped to the run's own tmux pane, so journeys can run side by side.

Where to look

  • dev/leaf_dev/journey.py: targets, the two ends, the shared release check, step samples, journey-chart.
  • dev/leaf_dev/journey_claude_code.py, journey_codex.py, journey_pi.py: each harness's session and steps (from the verifiers).
  • dev/leaf_dev/verify_site_browser.js: the page's record of when each reply showed.
  • tests/test_journey.py: step readings at both ends, prompt matching, transcript and Pi trace parsing, a no-Chrome check over HTTP.

Runs

Every target passed a real run, one at a time:

  • over HTTP: claude-code, codex-app-server, codex-queue and pi;
  • with --browser: claude-code, codex-queue and website-adapter.

website-worker was not run locally (no Docker); CI's verify-site website-worker covers it.

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

max-sixty and others added 17 commits October 8, 2026 02:49
…gets

`leaf-dev journey` now runs every real-agent check. A harness target runs
interactive Claude Code in tmux (`claude-code`, `--hooks-module`), a Codex task
on each transport (`codex-app-server`, `codex-queue`, the desktop app's route,
`--preview`), or Pi (`pi`), with this working tree as its plugin, and goes on
past the timed release ask through the steps `verify-claude-code-task`,
`verify-codex-task` and `verify-pi-task` ran: mid-turn, ending, Escape, woken,
rich replies, restart, held input after Escape, quit. Every check those commands
made still holds between steps. Each comment now goes through the Threads
composer in Chrome rather than an HTTP POST, and each step's comments are timed
as the release ask is (`steps` in the sample), with the turn split into phases
from Claude Code's transcript, Codex's App Server notifications or Pi's RPC
events. The three `verify-*-task` commands are gone, and the journey's headless
`claude -p` launcher with them: Claude Code timings now come from the
interactive session users run. `LiveChild` stays for the evals.

The website targets say what they run: `local` is `website-adapter` and
`wrangler` is `website-worker`, in `journey` and in `verify-site`, CI and the
docs.

Along the way:
- the journey read thread titles from `state["thread"]`, which the served state
  no longer has; it reads the browser projection, `state["browser"]["thread"]`;
- a reply in a thread the panel has closed is read by opening that thread, as a
  user would;
- Claude Code runs in its default permission mode and the journey answers a
  permission prompt Yes, since bypassing permissions makes Claude Code hold
  admission's nudge, a message from another session, unread;
- `journey-chart` leaves out samples kept before `steps`, gives the hooks module
  and preview rows of their own, and shortens a website release id.

Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
# Conflicts:
#	dev/leaf_dev/journey.py
#	tests/test_website_server.py
# Conflicts:
#	dev/leaf_dev/journey.py
#	tests/test_scenario_eval.py
The review of the folded journey found readings that measured the journey rather
than the page, checks the docs overstated, and code the three harness modules each
carried. In this change:

- Every wait in a harness journey hears the session through one `Terminal`, the
  release ask's included (`Session.pause`), so Claude Code's permission prompts are
  answered whichever wait meets them and a session that exits fails the wait. Each
  answered prompt is recorded in its step (`approved`) and its time left out of the
  step's. A prompt is "Do you want to …?" above "1. Yes" and "Esc to cancel", as
  Claude Code draws every one, Bash, Edit and Write alike.
- The page records when it showed each reply, whatever the journey is doing then
  (`replyShownAt`): the reply's message coming into view, a thread's row in the
  panel, open or folded, dating its latest activity at or after the reply, or a news
  notice changing after it. A folded thread draws no messages, and a held reply
  shows only as a notice. The 30 s per-reply waits and the thread-opening clicks
  that delayed other readings are gone; the user opens news on a thread they wait
  on, as a reader does.
- Delivery in `turn_phases` ends at the comment's opened pickup, not at the first
  record after admission, which for a comment a running turn took in was a tool
  result.
- Comments are anchored again: the user selects the passage and comments on it,
  shutting Threads where it covers every word. The journey's window is a desktop
  one.
- `journey.py` owns what the harnesses share: the isolation (temporary root, payload,
  environment swap, server stop, keep-or-remove) and its evidence under
  `.tmp/journey/` (the page's log and `trace.jsonl` on every harness, plus Claude
  Code's screen and debug log, Codex's hook runs and Pi's log), `Terminal`'s
  `until`/`settle`/`await_command`, the user's shell turn, and each comment's
  pickup and answer times, read from `recorded_steps` alone. A thread's title has one
  reader, the log (`journey.title`); Codex's check that the page server made it
  stays as the titles log's provenance reading.
- An Escape ends Claude Code's turn but not its shell command, so the next user turn
  waits for the last one's command to be gone, and clears the prompt Escape puts
  back in the box before typing.
- The docs say what each target checks rather than claiming every check of every
  harness. Stale names are gone: `website-adapter.log`, `LEAF_JOURNEY_CODEX_ENDPOINT`,
  the `leaf-dev` App Server client, and the note's readings, which were headless
  Claude Code's and are now this change's runs.
- Tests cover a step's comment readings, the folded and held replies' page timing,
  `--preview` refused off Codex, Claude Code's transcript, Pi's events as turn
  records, and the title wait against state a real page server serves.

Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
# Conflicts:
#	dev/AGENTS.md
#	dev/leaf_dev/journey_codex.py
The page reads a reply's message coming into view on any surface, not only inside a
thread card, as the verifier's own fixtures draw it.

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

From the second review of the journey:

- Claude Code's journey finds the user's command among its pane's own processes
  (`runs`), not with a host-wide `pgrep`, so a journey running beside it no longer
  reads as its turn.
- A permission prompt's time is no longer subtracted from its step, since the
  subtraction only ever counted Enter to the prompt's going. The prompt is recorded
  instead: on its step, on each comment of that step and on the release ask's
  reading (`approved`), and the chart gives a release ask held up by one a row of
  its own. Matching a prompt is a pure function of the screen
  (`permission_prompt`), tested on the wordings Claude Code's binary holds for a
  command, an edit and a new file.
- Codex's resumed turn reruns the user's command, and the comment goes out once
  it is running, so the comment is admitted while the turn runs.
- The page reads a news notice as showing a reply only once its applied state
  holds that reply (`semantic-state`'s reading), comparing the page's clock with
  itself; a row's date still compares with the reply's, both the server's. Rows and
  notices count only in view, by the IntersectionObserver that measures messages.
- One visible-reply path: the release ask waits on the page's reading
  (`await_reply_shown`), opening any news held back as `User.answered` does, and
  `wait_for_visible_reply`, `visibleReplyRecorded` and `visibleReplyAt` are gone.
  A reading names the sign that showed the reply (`responseShownBy`).
- `select_passage` no longer shuts Threads: in the journey's desktop window Threads
  never stands over every word of either passage (checked against the served page,
  shut and open).
- Pi's trace drops the `init` record nothing read.
- The note keeps its 2026-10-05 readings, as its rule asks until new samples hold,
  saying its Claude Code ones were headless; `dev/AGENTS.md` puts the passages on
  the page.

Every harness target and `website-adapter` passed a real run, one after another.

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

From the third review of the journey:

- `resume` tests #2046's case again: the resumed turn only reports its
  interruption, so its first boundary is its Stop. The race that made it flaky was
  the send's typing, so the user now writes the comment while nothing runs
  (`User.write`, over `write_comment`) and sends it the moment the resumed turn
  starts. In the run, the Stop hook handed it over and it was picked up in the
  resumed turn.
- The test of the pane-scoped command check starts its processes in process groups
  of their own and ends those, not every matching process on the host.
- The chart picks the latest version per target and options before splitting a
  release ask held up by a permission prompt into its own row, so an older
  prompted run leaves the chart.
- The page's reply watch keeps its reading in memory and writes sessionStorage only
  when it changes; each mutation batch adopts only the nodes it adds and rereads
  only the nodes in view.
- Opening news gives the click a second, and a notice gone in between is nothing to
  open.

Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
# Conflicts:
#	dev/leaf_dev/journey.py
#	dev/leaf_dev/journey_pi.py
#	dev/leaf_dev/review_scenario.py
#	dev/leaf_dev/verify_claude_code_task.py
#	dev/leaf_dev/verify_codex_task.py
…HTTP

The browser adds readings only the release ask needs. Across the last fourteen
samples, a harness step's send-to-acknowledged was 40-130 ms and its reply showed
0.1-0.3 s after the server admitted it, on replies of 20-55 s; only the release ask
on the website targets and on Codex's App Server transport shows a gap worth
reading. Every milestone a step is timed by (picked up, started, progress, title,
reply) is on the page server's clock in the event log.

So the release ask stays the one comment sent through Threads in Chrome, timed from
its send to its reply showing, with the reload and its startup profile, on every
target. Every later step's comment is posted to the served page as its tab posts
one, on its section (`review_scenario.post`), and timed and checked from the log.
Gone with the per-step browser route: selecting passages and typing each comment,
the write-then-send split `resume` needed (an HTTP post is instant, so #2046's
resumed turn, which only reports its interruption, keeps its Stop-first check
without a race), reading each step's reply off the page, and the recorder's thread
rows, which only a folded thread needed. The recorder keeps the reply's message and
its thread's news notice once the page has applied the reply, which is what times
the release reply when its thread holds news.

Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
The browser-for-the-release-ask hybrid was neither cheap, since every run still
started Chrome, nor complete, since no run timed what the page showed after the
first turn. Where the user is is now one axis, applied to every step, the release
ask included (`User.end`):

- over HTTP (`--http`, a harness target's default): no browser starts. Every
  comment is posted as the page's tab posts one, the release ask on the page and
  each later step's on its section (`HttpEnd`, `review_scenario.post`), and checked
  and timed from the event log on the page server's clock. The release ask requires
  a published revision naming the release and an answer, read from the page
  directory. This is the journey for agent and harness behaviour and timing.
- in Chrome (`--browser`, a website target's only end): every comment is typed in
  Threads, an anchored one by selecting its passage in a desktop window; each
  reply's showing is timed by the page; and the release ask's reload is checked and
  profiled (`BrowserEnd`). The page's recorder is the full one again (the message,
  a thread's row, and a news notice gated on the page's applied state, all by the
  IntersectionObserver), and `resume` writes its comment before the resumed turn
  and sends it as the turn starts.

One `User` carries either end, so the harness modules drive the same steps and
checks at both. A website target refuses `--http`, since delivery through its page
is its subject; `publish-site`'s journey call is unchanged, since a website's
default is the browser. Each sample records its end (`userEnd`), and
`journey-chart` gives an HTTP run a row of its own.

Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
The HTTP end had its own copy of the release check, and it had diverged: it waited
for no title, so its samples missed `titled`; it took no early exit on a failure
receipt and no patience bound, so a failed turn held for 600 s; and its failure said
nothing of the reply or the source.

The release check is now one function both ends run (`run_journey`): it waits on
the turn, the title and the answer through the end (`state`, `names`, `pause`), and
the end only sends the ask and says what it saw of it. The browser end's
`opening` and `closing` hold what only a page has, its startup profile and the
reload presenting the published revision. Each end owns what a comment's reading
holds (`reading`): the browser times its send and its reply showing in Threads; HTTP
has the log's milestones alone. `User.sample` no longer infers the end.

Tests run the release ask over HTTP against a served page through the shared check,
check a step's comment is posted on its section, and show that a harness target
without `--browser` never launches Chrome. The step test uses the real ends.

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

@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.

PR #2141 fixes the old title lookup that this diff replaces with event-based reading. The two PRs overlap; #2141 can close if this version lands.

Comment thread dev/leaf_dev/journey.py Resolved
max-sixty and others added 3 commits October 9, 2026 00:44
# Conflicts:
#	.claude/skills/developing-leaf/SKILL.md
#	dev/leaf_dev/journey.py
…omment card by its selector

The suite's lint tests refuse a test that starts processes outside the spawn
fixture, ends one with SIGKILL, or bounds a wait by its own number; the
pane-process test now starts its processes through spawn and waits within
STATED_TIMEOUT. The page comment card's open state is read as a selector count,
which the deploy gate's stand-in page answers.

Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
A comment sent mid-turn is picked up while the agent's command still runs. The
turn's phases dropped that command's tool_use, as it preceded the pickup, so its
result matched nothing and the rest of the wait read as model time. The phases
now start in a tool phase holding the calls out at pickup.

Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
leaf-agent
leaf-agent previously approved these changes Oct 9, 2026
# Conflicts:
#	dev/leaf_dev/journey.py
#	tests/test_website_server.py
@max-sixty
max-sixty merged commit dbaa4da into main Oct 9, 2026
6 checks passed
@max-sixty
max-sixty deleted the thread-title-latency branch October 9, 2026 09:43
leaf-agent added a commit that referenced this pull request Oct 9, 2026
…2156)

The [failed deployment
run](https://github.com/max-sixty/leaf/actions/runs/37913111514) reached
the new release and got an agent reply, but its final reload could not
import a revision-scoped `runtime/semantic-state.js`: the release asset
URL returned 404. The Worker sent every release-scoped request only to
built static assets, while an active user's newly published revision
exists only in that user's container.

This routes a missing release-scoped session file through the existing
active-container fallback, using the page's canonical path. Built assets
continue to come from the edge; anonymous misses remain 404 and are not
cached as immutable. The failing Worker regression test passed after the
change, and `npm test --prefix worker` (72 tests) and `npm run typecheck
--prefix worker` pass.

The failure followed
[#2144](#2144), which added the
browser journey's revision-state import on the deployed page. The
deployment journey itself still needs the PR gate to verify the Worker
and container together.

Co-authored-by: leaf-agent <[email protected]>
max-sixty added a commit that referenced this pull request Oct 11, 2026
…behind "1 new reply" (#2294)

A Codex reply now streams into an open thread card as the agent writes
it, and the agent's answer completes that same message in place. Before,
an idle open card showed an empty agent bubble behind "1 new reply"
until the user pressed it, and held the answer again as an edit.

Since #1926 the agent's first move is a progress acknowledgement, so
nearly every answer folds progress or completes a streaming placeholder,
and the card's hold on changes to existing messages held almost all of
them. Journey runs (#2144) showed the notice on every Codex reply.

### What changes

- **One name for a reply and its answer.** The server adds a streaming
reply to its thread once it has words, and draws it and the input's
first answer under one key, `response:<input>`
(`served_state/thread.py`). The browser draws a message under that key
(`messageKey`, `thread/model.js`), so the answer completes the stream
rather than arriving as a second message. `thread.is_answer` is the one
rule for what counts as an answer, so a failure receipt keeps its own
name; a second answer in the log keeps its own id.
- **Held news reads a stream as arrival** (`thread/held-news.js`). Words
joining a streaming reply, and its answer completing it, are the reply
arriving, not an edit. An answer folding the progress run at the
thread's end shows at once in an idle open card (`footFold`), unless the
reader stands in that progress by focus or selection. Notices now say
"new reply", "new message" (the user's own, from another tab) or
"message edited".
- **Where the user stands is read once** (`focus.js`,
`standingNodes`/`standsOn`): focus, then the selection's ends.
`standingPlace` and the held-arrival lapse use it.
- **A message sent while the agent streams** goes above the streaming
reply, so its acceptance moves nothing.
- **An open progress group draws its border around its messages** rather
than padding them in (`styles/components/surfaces.css`). With #2219's
inset padding, the fold above moved the words the reader was on 13px
right and 11px down. Its messages now line up with the rest of the
transcript; the group otherwise looks as before.
- **Journey timing** records when the reply's own message came into view
(`responseMessageVisible`), apart from its row or notice.

### Testing

Eight new browser journeys in `tests/test_render_threads.py` cover
streaming into an open card, a held card counting the stream once, a
send during a stream, an answer completing its stream with the same
words, the foot fold under the shift watch, a selection holding the
fold, and no change above the fold. Runtime tests, the fold-related
render tests, and the thread appearance snapshots pass locally. Real
`codex-app-server --browser` and `claude-code --browser` journeys showed
no notice at any step, with the stream visible about 2.1–2.4 s after
send.

> _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