Skip to content

Reply to a revision without a page check first - #3372

Merged
max-sixty merged 5 commits into
mainfrom
agent-a5a9443e10d192b44
Oct 20, 2026
Merged

max-sixty merged 5 commits into
mainfrom
agent-a5a9443e10d192b44

Conversation

@max-sixty

Copy link
Copy Markdown
Owner

The skill told the agent to run leaf page check before replying about a revision. That cost a model call (2 to 8 s) on every revision reply, plus the check itself: 0.3 s on a plain page and 11.6 s on a page with scripts, data widgets or media, where the check opens a browser. The reply already checks the saved source and is refused over an error, so the reply is now the only step.

  • Instructions. A revision that answers a message goes straight to the reply (SKILL.md "Check the page", conversation-loop.md, threads.md, the site's how-it-works sample). The first handoff and a record's stamp keep page check. The Codex App Server contract drops its check before the turn's final reply too: that reply publishes the saved edit, and a refusal starts a correction turn, so the check cost every revision turn a call to save a turn only when the edit is broken.
  • What the reply reports. The first agent reply on a revision notes on stderr what page check would advise about the revisions since the agent's last reply: each open thread a revision moved, read from the log's reanchor events (the server usually activates a save before the reply) and from the reply's own activation, leaving out a thread the reply moves itself; and the source's drift (validation.source.source_advice). It reads them after releasing the page lock, so the user's page shows the reply at once. Later replies on the same revision repeat none of it. response reply --help says what the reply checks and that nothing runs in a browser.
  • Left out: the Leaf version note. page check names the Leaf that vendored the page when it differs. Reading this Leaf's provenance runs three git commands where the payload is a git checkout, as Codex installs and developer checkouts are: about 50 to 160 ms here, on every first reply on a revision. Claude Code's plugin cache reads it without git.

Measured. leaf response reply on examples/security-boundary.html after an edit, median of 7 cold runs: 0.27 s before, 0.26 s after; page check on the same page 11.6 s. Eval record-reply-before-its-stamp (its first criterion now fails any page check in the first turn): base ran a check before the reply in 5 of 5 Claude Code and 2 of 2 Codex samples, this branch in none, with the render check and stamp kept at sign-off. app-server-edit-before-final flips its check criterion to match.

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

max-sixty and others added 5 commits October 20, 2026 13:44
The skill told the agent to run `leaf page check` before replying about a
revision. That cost a model call (2 to 8 s) on every revision reply, plus the
check itself: 0.3 s on a plain page and 11.6 s on a page with scripts, data
widgets or media, where the check opens a browser. `leaf response reply`
already checks the saved source and refuses the reply over an error, so the
reply is now the only step.

- The shipped instructions send a revision that answers a message straight
  to the reply (SKILL.md "Check the page", conversation-loop.md). A first
  handoff and a record's stamp keep `page check`. The App Server contract
  keeps it only where the turn's final message is the reply, since that posts
  after the turn ends and a refusal there costs a correction turn.
- The first agent reply on a revision notes on stderr the advice `page check`
  gives on its source: threads the revision relocates, measurement lag,
  unreadable data and unpointable blocks (`validation.source.source_advice`,
  which now includes the relocation advice). Later replies on that revision
  repeat none of it. The reply's help says what it checks and that nothing
  runs in a browser.
- The reply leaves out `page check`'s Leaf version note. Reading this Leaf's
  provenance runs three git commands where the payload is a git checkout, as
  Codex installs and developer checkouts are. That measured about 160 ms, and
  would have added that to every first reply on a revision.

Reply time on `security-boundary`, median of 7 cold runs: 0.27 s before,
0.26 s after.

Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
…op App Server's check before the final reply

Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
@max-sixty
max-sixty merged commit fdedd0b into main Oct 20, 2026
3 checks passed
@max-sixty
max-sixty deleted the agent-a5a9443e10d192b44 branch October 20, 2026 21:22
max-sixty added a commit that referenced this pull request Oct 20, 2026
`page check` predicted the threads a revision would move only for a
source the server had not yet activated. The server activates a valid
save as soon as it is written, so on a served page the prediction was
usually empty, though `threads.md` tells the agent `page check` lists
those threads.

`page check` now names the threads the active revision moved, read from
the log's `reanchor` events, through the reader the first reply on a
revision already used since #3372 (`validation.source.moved_threads`).
The two differ only in where the window starts: the active revision for
`page check`, the agent's last reply for the reply. The reader names a
thread only while it still stands where the move put it. A reply that
has since placed the thread, resolving it, or the user taking back the
reaction that opened it leaves the move out. A move the unactivated
source would make still comes from the prediction and takes that
thread's place. `page check` now lists moves before the source's drift,
as the reply does.

`test_a_reply_names_the_threads_a_save_already_moved` now checks `page
check` after a save, and again after a reply re-anchors one of the
threads. `test_page_check_names_no_move_of_a_withdrawn_reaction` covers
a thread whose opening reaction was taken back, which a review probe
crashed with a `KeyError` before the fix.

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

---------

Co-authored-by: Claude Opus 5.5 (1M context) <[email protected]>
max-sixty added a commit that referenced this pull request Oct 20, 2026
…waiting and working (#3387)

Max asked that the reply benchmark record both Leaf's share and the
whole reply, and cover two cases: a comment that reaches a waiting
harness and one that reaches a working harness. This change makes
`leaf-dev journey` and `leaf-dev response-times` report both numbers for
every reply. The whole reply is broken into its model calls. The note
`notes/user-feedback-responsiveness.md` gets budgets for each number and
case, a measured table on current main, and the model calls a small page
change should take.

## The benchmark

- **One home for a reply's breakdown.** `dev/leaf_dev/reply_phases.py`
splits the span from a comment's admission to its reply into phases.
`busy` is the harness on other work before it takes the comment,
`delivery` runs until the comment is in the agent's context, and the
rest is `model`, `tool` and `idle` time between turns. `reply_breakdown`
sums the phases into the whole reply and Leaf's share (delivery plus
tool phases that run `leaf`). It also groups model phases into the model
calls the harness made, each with the tool calls it issued. The
journey's old `turn_phases` moved here.
- **Harness records carry turns and responses.** Each harness's
normalized record marks where a model response ended and where a turn
started and ended, using the harness's own signals. Claude Code's
transcript gives the last record of each message id, `turnPosition`,
`turn_duration` and `interruptedMessageId`. Codex gives
`thread/tokenUsage/updated`, `turn/started` and `turn/completed`. Pi
gives `turn_end`, `agent_start` and `agent_settled`.
- **Two cases in every harness journey.** `journey.CASES` names them.
The release ask reaches a waiting harness. The `mid-turn` step now asks
for the same small page change, naming a release of its own, while the
harness runs the user's 25 s command. Each step requires a revision that
names its release. Each sample says which comment asked for which case.
- **The table.** `uv run leaf-dev journey-chart --replies` tabulates the
kept samples by target and case.
- **Real pages.** `leaf-dev response-times` adds the breakdown for
inputs that Claude Code answered, reading the transcript it finds by
session id. On real pages Leaf's share is an upper bound, because a
shell command that runs `leaf` among slower work counts whole.

## Readings on current main

Four Claude Code journeys and three each on Codex App Server and Pi, at
this branch on main `23acce2b1`. Seconds:

| Harness | Case | Whole reply | Leaf's share | After the boundary |
Model calls |
| --- | --- | --: | --: | --: | --: |
| Claude Code | waiting | 21.9–45.2 | 1.1–8.7 | 21.9–45.2 | 4–8 |
| Claude Code | working | 35.5–41.9 | 0.9–1.2 | 10.8–17.0 | 2–3 |
| Codex App Server | waiting | 14.1–19.4 | 0.5–0.9 | 14.1–19.4 | 4–5 |
| Codex App Server | working | 38.6–43.1 | 0.7–0.8 | 13.9–18.4 | 3 |
| Pi | waiting | 31.0–33.0 | 1.0–1.5 | 31.0–33.0 | 8–10 |
| Pi | working | 40.0–41.7 | 0.7–0.8 | 14.8–16.5 | 6 |

In the working case the harness was busy with the user's command for
24.5–25.2 s first, so the working budget counts from that boundary.
Leaf's share was 0.5–1.5 s in 19 of 20 replies; the exception ran `leaf
page check --render`. The model takes the rest. The proposed budgets are
Leaf's share under 2 s in both cases, and a whole reply of Leaf's share
plus two model calls. The note says which calls the replies spent beyond
two: widget and registry lookups, and reference reads on a session's
first comment. It also says why the two cases differ in more than the
harness's state.

Codex App Server ran main's delivery after the revert of #3357 (#3362)
and #3368: Leaf starts a turn for an idle task, and the tool hook
delivers inline to a working one. Earlier batches on #3357's queue path,
before #3368 and #3372 landed, showed the two calls those changes
removed.

## Review

An independent Codex review ran over three rounds against real
transcripts and the kept runs. It found idle gaps counted as model time,
an idle harness read as busy, local commands and compaction summaries
starting turns, and `end_turn` blocks ending turns early. All of these
are fixed and checked on the page it used. The remaining limit is on
real pages: Leaf's share counts a whole shell command that runs `leaf`
among other work. The note proposes that each `leaf` command record its
own duration.

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

---------

Co-authored-by: Claude Opus 5.5 (1M context) <[email protected]>
max-sixty added a commit that referenced this pull request Oct 21, 2026
…side it (#3396)

A survey of `notes/` against the code and history at d91b67b. Where a
note's design has landed, its contract moves beside the code if it
wasn't already there, and the note or section goes; what is still
unresolved stays.

- **Deleted:** `floating-panel/GOAL.md` (every departure is now recorded
in `floating-panel.js` and `styles/floating-panel.css`; #3392 moved the
last one, the draft posture, beside `drafted`, and this adds the
no-key-hints decision to the header), `browser-reactivity.md` (its
design is in module headers; why paints that must land in the turn use
`render` moves to `assets/AGENTS.md`, and the margin's double draw
becomes a TODO implementation candidate) and `chrome-and-covers.md`
(`page-layout.md` holds the workspace decision; the `layouts.css`
Workspace comment now records the rejected main-region-scrolls design).
- **Trimmed:** `agent-usability-evals.md` drops the findings through
2026-10-12, which have landed. `comparisons.md` drops the phone-pin
finding (#2680), the 4 October follow-up proposals and two landed
lessons. `user-feedback-responsiveness.md` narrows delegated work to
Codex and Pi (#3370) and drops "Explicit stdin" (#3375). `threads.md`
drops request buttons (#1327), placement (#2134) and notification
transitions. `shared-decisions.md` points at the recorded owner
contract. `browser-support.md` drops two fixed entries and owners #3100
removed.
- **TODO.md** follows each: #28 points at the module header, #25 asks
for the board's write rather than an owner, the annotation-placement
item loses its landed phone half, and the delegated-work and
reply-budget items lose what #3370 and #3372 settled.
- Smaller corrections in `shift-watch-cost`, `undo-reach` (#3271),
`named-widget-interfaces`, `codex-integration` (`codex_tool.py`), the
long-read eval's provenance comment, and `motion.js`'s fold comment. The
runtime comment edits rebuild `kernel.json` only.

No behavior changes.

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