Skip to content

Print a user preview's findings beneath its URL, so the agent reads how to hear the page - #7251

Merged
max-sixty merged 1 commit into
mainfrom
diagnose-unheard-page-reply
Nov 26, 2026
Merged

max-sixty merged 1 commit into
mainfrom
diagnose-unheard-page-reply

Conversation

@max-sixty

Copy link
Copy Markdown
Owner

In a session started normally, a checkout's leaf-dev preview --user serves its page for no session, so only the checkout's bin/leaf wait PAGE hears the user's replies. The preview's serves-for-no-session advice said so, but as the first line of the log, above the URL that agents read with tail or grep http://. Two of the four sessions that handed such a preview over since #7061 missed the advice, and the user's replies sat unheard until they asked in chat. In one of them a reply waited 30 minutes.

The preview now holds what its start notes and prints it in the --user service reading, the same record leaf server start prints with its url, in one write with the bare URL line above it. The --user help and the module header lead with the unclaimed case. The bare URL line keeps its own line, so grep -o 'http://[^ ]*' | head -1 and the tests' startswith("http://") still find a clean URL.

Max asked for this diagnosis. Codex reviewed the change, and its findings are folded in: one write for URL and reading, and tests/journeys/test_codex_adapter.py's use of the renamed PreviewService.note. It also suggested routing through started_server, which was left out: that would add a loopback-only finding to every preview, advising a --host flag that leaf-dev preview doesn't have.

Tests: dev/tests/model/test_interact_preview.py (29 passed), and a live --user preview before and after.

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

…ow to hear the page

A checkout's `leaf-dev preview --user`, in a session started normally, serves its page for no session: the session's hooks never hear the user's replies, and only the checkout's `bin/leaf wait PAGE` does. The preview said so in its `serves-for-no-session` advice, but printed it as the first line of its log, ahead of the URL. Agents read that log for the URL (`tail -5`, `grep http://`), so they missed it.

Now the preview holds what its start notes and prints it in the `--user` service reading, which carries the URL as `leaf server start`'s record does, in the same write as the bare URL line beneath it. A reader that waits for the URL finds the reading already there. A plain preview prints `WATCHER_NOTE` in that write too. `PreviewService.note` becomes `reading(url)`. The `--user` help and the module header now lead with the unclaimed case, which is the usual one.

Evidence: four sessions started `--user` previews in the day after #7061. The two that missed the advice handed over pages the user then replied on, and heard nothing until the user asked in chat ("are you watching the leaf?", "what's up with the leaf?"). In one of them (e7ffd5b4), a 21:17 PT reply waited until 21:47. Of the two sessions that read the advice, one started `bin/leaf wait` at once and answered every reply. The other started none, on lab previews the user never wrote on. Replayed against the new output, every read of the log the two sessions that missed it made now meets the advice, except one that extracts only the URL (`grep -o 'http://[^ ]*' | head -1`).

Tests: the preview model tests (29), plus a live `--user` preview in a session whose hooks run the installed Leaf, before and after.
@max-sixty
max-sixty merged commit cb65e44 into main Nov 26, 2026
6 checks passed
@max-sixty
max-sixty deleted the diagnose-unheard-page-reply branch November 26, 2026 07:11
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