Repository navigation
Print a user preview's findings beneath its URL, so the agent reads how to hear the page - #7251
Merged
Merged
Conversation
…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.
leaf-agent
approved these changes
Nov 26, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
In a session started normally, a checkout's
leaf-dev preview --userserves its page for no session, so only the checkout'sbin/leaf wait PAGEhears the user's replies. The preview'sserves-for-no-sessionadvice said so, but as the first line of the log, above the URL that agents read withtailorgrep 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
--userservice reading, the same recordleaf server startprints with itsurl, in one write with the bare URL line above it. The--userhelp and the module header lead with the unclaimed case. The bare URL line keeps its own line, sogrep -o 'http://[^ ]*' | head -1and 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 renamedPreviewService.note. It also suggested routing throughstarted_server, which was left out: that would add aloopback-onlyfinding to every preview, advising a--hostflag thatleaf-dev previewdoesn't have.Tests:
dev/tests/model/test_interact_preview.py(29 passed), and a live--userpreview before and after.