Skip to content

Read the journey's milestones with response-times' reader - #5238

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

max-sixty merged 4 commits into
mainfrom
agent-a71442547a85f905e

Conversation

@max-sixty

Copy link
Copy Markdown
Owner

leaf-dev journey timed each comment with a reader of its own (recorded_steps, pickup_at) beside response_times.page_timings, which leaf-dev response-times and delivery_eval already used, so the page's milestones were computed twice. The journey now reads them with page_timings, and journey-chart draws that reader's rows.

What changes

  • One reader (dev/leaf_dev/commands/journey.py): each end's timings() runs page_timings over the page directory (input_rows), and a sample's comment carries that row's milestones in place of sinceAdmissionMs. recorded_steps and pickup_at are gone, and the Claude Code journey's fork-work step reads first_reply from the same rows.
  • Milestones only the journey had move into page_timings (dev/leaf_dev/commands/response_times.py), so response-times reports them too:
    • titled: when the input's thread got its first title, from the page server or the agent's own message, for an input admitted while the thread had none;
    • published: when the page published the revision the input's answer stands on, where that came after the input, read from the page directory's revision files. Nothing records which input a revision serves, so a revision published while several inputs were open counts for each answer that stands on it: on recent real pages, 10 of the 62 inputs with published stand on a revision an earlier answer stood on.
  • A website target has no page directory within reach, so the journey reads the log the page serves (written to a temporary directory for page_timings), which gives no published.
  • journey-chart draws titled, opened, started, progress and answered from the rows, under the same labels. Samples kept before this change have no milestones and drop out of the chart and the --replies table; with none left it says so rather than failing.
  • A website's reading stops at the served state's own now, so a container clock ahead of the runner's drops nothing.
  • The browser's reading of when the reply showed stays (verify_site_browser.js, whose header now says why). The runtime's reply_visible record covers agent words coming into view, but it records nothing while a thread holds the reply behind its notice: on a seated thread holding an answer behind "1 new", no record appeared until the notice was pressed. A website's diagnostics also stay in its container.

Evidence

  • On the 25 journey page logs kept on this machine (208 comments, 176 of them in kept samples), the old reader, page_timings and the kept samples agree on every queued, picked-up, started, titled, progress and answered reading. Progress now follows page_timings' rule, an ephemeral reply that takes its input in hand (start), where the old reader counted any ephemeral reply in the thread; no kept log differs.
  • On the pages touched in the last three days, published came at or before the answer for all 62 inputs that have one; response-times over 42 recent inputs observes titled for 35 and published for 34.
  • A real leaf-dev journey claude-code did not get past setup in two attempts, before any code this changes runs: with about 160 uv run processes on the machine, the payload's first bin/leaf call took 185 s in one and over 300 s in the other, so the session never claimed the page within the step's 300 s. The release ask's path through run_journey, HttpEnd.timings and page_timings runs end to end in test_the_release_ask_over_http_is_the_shared_check, against a real page server and a real published revision, reading titled, published and answered; the website path runs in test_the_page_a_turn_has_just_written_waits_for_its_revision_after_presentation.

Tests: the recorded_steps attribution tests are deleted, their rules now page_timings' and covered in dev/tests/model/test_response_times.py, which gains a titled and published case. The response-times summary tests now expect total_s, which they had missed since #4557. dev/tests/model/test_response_times.py, dev/tests/model/test_journey.py and the touched tests in dev/tests/process/test_website_server.py pass.

#3840 (draft) also edits journey.py and journey_chart.py: its CI-sample test builds samples with sinceAdmissionMs, which this change's chart leaves out, so it needs milestones there, and SIGNS loses its clock column.

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

`leaf-dev journey` timed each comment with its own reader of the page's log
(`recorded_steps` and `pickup_at`), beside `response_times.page_timings`, which
`leaf-dev response-times` and `delivery_eval` already used. The journey now reads
each comment's milestones with `page_timings` (`journey.input_rows`), and a
sample's comment carries that row's `milestones` in place of `sinceAdmissionMs`.
`journey-chart` draws those rows; samples kept before this change, which have no
`milestones`, drop out of the chart and the `--replies` table.

The two milestones only the journey read move into `page_timings`, so
`response-times` reports them too:

- `titled`: when the input's thread got its first title, from the page server or
  the agent's own message, for an input admitted while the thread had none;
- `published`: when the page published the revision the input's answer stands
  on, where that came after the input, read from the page directory's revision
  files.

A website target's page directory is out of reach, so there the journey reads
the log the page serves, which gives no `published`.

On the 25 journey page logs kept on this machine (208 comments, 176 of them in
kept samples), the old reader, `page_timings` and the kept samples agree on every
queued, picked-up, started, titled, progress and answered reading. Progress
follows `page_timings`' rule, an ephemeral reply that takes its input in hand
(`start`), where the old reader counted any ephemeral reply in the thread; no
kept log differs.

The browser's own reading of when the reply showed (`verify_site_browser.js`)
stays. The runtime's `reply_visible` record covers agent words coming into view
but records nothing while a thread holds the reply behind its notice (checked
on a seated thread: no record until the notice is pressed), and a website's
diagnostics stay in its container.

Tests: the `recorded_steps` attribution tests are gone, their rules now
`page_timings`' and tested in `test_response_times.py`, which gains a titled and
published case; the response-times summary tests expect `total_s`, which they
had missed since #4557.
…g to its own clock

`journey-chart` now says the samples file holds no sample with milestones,
rather than failing in `min()`, as it would on a machine whose samples all
predate the journey reading `page_timings`.

A website journey reads the served log up to the served state's own `now`, so a
container clock ahead of the runner's drops no event from the reading.

The `response-times` header says that a revision published while several inputs
were open counts as `published` for each answer that stands on it, and the
journey header that `published` comes from the revision files, not the log.
@max-sixty
max-sixty merged commit 95e2280 into main Nov 3, 2026
4 checks passed
@max-sixty
max-sixty deleted the agent-a71442547a85f905e branch November 3, 2026 20:39
max-sixty added a commit that referenced this pull request Nov 3, 2026
…al (#5255)

`leaf-dev journey` wrote each harness step's contract once but
implemented it per harness: `mid-turn` three times, `escape` and `quit`
twice, `setup` three times, each on top of the shared `Terminal` base
class. This puts those steps, and `release`'s wait for the session to
settle, on `Terminal` once. Each harness module now supplies only its
primitives (`session`, `say`, `work`, `hear`, `idle`, `listening`, and
where it has them `press_escape` and `leave`) and its own steps. By a
line diff, the change removes 414 lines of code and adds 293 (net −121),
and adds 29 lines of docstring prose net, mostly the shared steps'
contracts.

## How the tooling behaves now

- `Terminal.setup`, `release`, `mid_turn`, `escape` and `quit`
(`dev/leaf_dev/commands/journey.py`) own those steps' checks. The
harness modules call them in their own order and add only what is
particular to their harness: Claude Code's PostToolBatch check after
`mid-turn`, Pi's requirement that its abort closes the claim's turn, and
the Codex queue's check that the mid-turn comment is answered before the
user's turn's final response, now a hook (`on_final`) around the shared
step.
- `Terminal.user_turn` types the user's own turn and returns the turn
the page's claim opened for it, replacing the
`work()`-then-read-the-claim pair the steps repeated. `review_scenario`
gains the page readings every module open-coded: `claimed`, `picked_up`
(the turns whose opened pickup took a comment) and `activity`.
- `Terminal.titled` formats the page server's title record one way for
every harness, where Codex and Pi each had their own.
- `journey_chart.TARGET_NAMES` is gone: each `HARNESS_TARGETS` entry is
a `HarnessTarget` carrying its chart title, harness and transport.
- `ClaudeCode` takes its session id at construction, so
`claude-code-session` passes `--session-id` as the journey does and sets
its page up through the shared `setup` step, rather than learning the id
from the page's claim.

## Checks that changed

One implementation per step means one set of checks per step. Where the
harnesses' copies disagreed, the shared step keeps the stronger check,
and every target passes it:

- Claude Code's `setup`, `release`, `mid-turn` and `escape` now wait for
the session to stay idle through `QUIET` (10 s), as Codex and Pi already
did. That adds five 10 s waits to a run; `steps[].seconds` grow, and
milestones and reply breakdowns don't change.
- `mid-turn` requires, on every harness, that the comment is picked up
in the user's turn, answered before that turn ends, and starts no turn
of its own. Claude Code and Codex App Server gain the last two; App
Server's kept runs, three before this branch and its run here, all show
the comment entering the user's turn. Pi's "no second run" is now read
from the page's claim rather than Pi's run counter. App Server's check
that the claim names the user's turn by App Server's id now follows from
the claim's turn being unchanged and every step's end-of-step check,
rather than a poll.
- `escape`, on Claude Code and Pi, requires the session to stay idle
through `QUIET` with a watch on its pages, no turn to open, and the
page's status to read `listening`. It returns whether the claim's turn
stayed open: Pi requires it closed, as before; Claude Code, where Escape
runs no Stop hook, prints it.

## Runs

Each target this touches passed `leaf-dev journey` on this branch, over
HTTP, case `waiting`: `claude-code` (12 steps) and `codex-queue` (8) on
the first commit, `pi` (6) and `codex-app-server` (8) on both.

The `claude-code` run is also the real run #5238 left owed. Its kept
sample carries `comment.milestones` from `response_times.page_timings`,
and `journey-chart` charts it: the release ask was picked up after 0.41
s, titled after 2.47 s, its work started after 16.1 s, its revision
published after 21.5 s and it was answered after 28.9 s. The reply's
breakdown puts 2.5 s of the 28.9 s on Leaf (delivery 0.4 s, commands 1.0
s, hooks 1.2 s) and 26.0 s on the model. The fix commit's only Claude
Code change, `escape`'s new check that no turn opens after Escape, reads
the same claim that run's `escape` line printed as the turn staying
open.

> _This was written by Claude Code on behalf of max-sixty_
max-sixty added a commit that referenced this pull request Nov 4, 2026
…check every harness's steps with one set of checks (#5265)

`leaf-dev journey` computed each reply's breakdown twice, and wrote its
checks between steps once per harness. This leaves one of each,
finishing what #5238 (milestones through `response_times.page_timings`)
and #5255 (shared steps on `Terminal`) left.

## How the tooling behaves now

- **One reply breakdown.** `response_times.page_timings` takes a reader
of the answering session's record (`records`). By default it reads the
Claude Code transcript on this machine (`transcript_of`), as `leaf-dev
response-times` always has. The journey passes its terminal's record
when it builds the sample and keeps each row's `reply`. `User.commands`,
the `commands` closure in `user_at` and the journey's own
`reply_breakdown` call are gone. The per-step timing lines read no
session record (`no_record`). They used to parse the transcript at every
step, and cache its first read for the rest of the run, so later reads
were stale.
- **One rule for a fork's answer.** `page_timings` reads `fork_reply`
records. An input a fork of the conversation answered gets no reply
breakdown, pickup wait or `leaf_commands_s`, since the session spent
nothing on it. The journey used to apply this rule to the breakdown
alone. `response-times` applied it nowhere: it computed a breakdown
whose delivery ran past the reply, such as a 4 s reply with 20 s of
delivery in the fork test. No page on this machine had a fork reply in
the last two weeks (6 hand-overs only), so `response-times`' numbers
don't move today.
- **One set of checks between steps.** `Terminal.between`
(`dev/leaf_dev/commands/journey.py`) requires what every harness must
hold after a step. Every comment the steps have named has one answer and
a pickup. The claim names the session, with its turn closed. Leaf
listens for the session within 60 s. The page server has titled the
thread of each comment the step named. `Terminal.passed` records a step
after those checks, setup included. Claude Code adds its checks on Stop
hooks, printed deliveries and the rows Leaf puts in the conversation;
Codex adds its checks on the claim's turn, the keyed URL and the
preview. Pi adds nothing.
- **A failed title fails at once.** `Terminal.titled` reads the page
server's `thread_title_failed` record too, so a step whose title failed
stops with the request's error at once, rather than after the 3-minute
title patience with no cause.
- `reply_phases.pickup_wait` now treats a turn start's `origin` as
optional, as the module's record contract says. Codex and Pi records
reach it now, and they carry none.

## Checks that changed

- Codex now requires its adapter to be listening between steps, and
Claude Code requires the page server's title on every comment. Both pass
live (below).
- Pi's listening check now waits up to 60 s, Claude Code's existing
bound, where before it read once.
- Claude Code's setup step runs Claude Code's own checks and keeps its
own `shown` rows, which used to be counted in `release`'s.
- In a sample, `reply` carries `case`, and a comment a fork answered has
`"reply": null` rather than no `reply` key.

## Runs

Each target passed `leaf-dev journey` over HTTP, case `waiting`:
`claude-code` (13 steps), `codex-queue` (8) and `codex-app-server` (8)
at f2be41a, and `pi` (6) at 5eae388, whose difference from f2be41a
is in `response-times` paths a journey without forks doesn't read. The
three also passed before review, at 45354f0 and ed3cc82. The last
commit changes only what `titled` does when the page server's title
fails, checked against a kept run with a failed title. For every run,
each comment's `reply` in the kept sample equals the breakdown the old
path computes from that run's evidence (the terminal's records in
`trace.jsonl`, and the page's log and diagnostics): 12 of 12 for Claude
Code, 7 of 7 for each Codex transport and 4 of 4 for Pi. The 16 earlier
runs kept on this machine (Claude Code and Codex) agree on all 132
comments.

Across these runs the page server titled all 48 comments within 1.3–3.2
s: Haiku on Claude Code, gpt-6-luna on Codex, gpt-6.1-sol on Pi. In the
earlier kept runs, 2 of 27 Claude Code titles failed when `claude -p`
timed out after 60 s on a loaded machine (2026-11-01). The new check
fails a Claude Code journey when that happens.

`dev/tests/model/test_journey.py` and `test_response_times.py` pass. The
fork case now goes through `page_timings`' rule, and fails without it.
The touched product test
(`test_codex_app_server.py::test_a_completed_stream_reply_survives_the_claim_advancing`)
and website test
(`test_website_server.py::test_a_title_written_after_the_reply_is_still_timed`)
pass by node id.

By line, classified with Python's tokenizer: code −225 +213, docstrings
and comments −88 +133, tests −12 +25.

> _This was written by Claude Code on behalf of max-sixty_
max-sixty added a commit that referenced this pull request Nov 5, 2026
Main moved `journey` and `journey-chart` onto `response_times.page_timings` (#5238,
#5265), so CI's samples now chart through `comment.milestones` and `HARNESS_TARGETS`,
with no reader of the draft's own. A real `publish-site` sample has those milestones.

What changed to fit main, and what running on real samples showed:

- The auto-merge left two `env:` keys on the deployed verify step, which actionlint
  refuses. `NODE_OPTIONS` and `XDG_STATE_HOME` now share one block.
- `--from-ci` orders samples by the instant in `at`. CI writes UTC and a local run
  writes its own zone, so sorting the strings could chart an older version as the
  latest.
- Chart rows keep the order their samples ran in, grouped by target, and the chart
  grows with them. Plot sorted them by release hash into a fixed 240 px, so `--since`
  showed no trend across releases.
- Each budget line has its own dash offset. Title and work started are both at 2 s,
  and one line hid the other.
- The error for nothing to chart stays main's, through `chosen`, and names CI's
  artifacts when `--from-ci` read them.
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