Repository navigation
Print a command's findings in its JSON on stdout, and leave stderr to everything else - #5964
Merged
Merged
Conversation
…ne of its records watchdog logs through `logging` and attaches no handler, so in a Leaf process, which configures no logging, Python's last-resort handler printed its records on stderr, where a command prints only JSON. On Linux its inotify emitter logs "InotifyEmitter.queue_events() called when the thread is inactive" when a directory is unscheduled just as an event for it arrives, which file_changes' sweep does in ordinary use. That line reached a waiter's stderr and failed test_receipts.py::test_ack_rearm_reports_when_its_only_page_transfers_after_selection on CI, and reaches any agent reading `leaf wait`. Reproduced on Linux (watchdog 7.1.0) by opening and closing FileChanges subscriptions on a directory being written: 89 such lines in 10 s before, none after. Records still propagate, so a process that configures logging (pytest) still receives them. A root NullHandler at Leaf's entry was rejected: it would hide every library's reports of real failures and load `logging` into every hook, which nothing else there imports. Behavior changed: a process that watches files no longer prints watchdog's warnings, including its inotify queue overflow warning.
leaf-agent
previously approved these changes
Nov 14, 2026
One line at module level replaces the handler set up beside the first observer, and a comment replaces the header paragraph. file_changes is imported at module level only by session, which only the Codex adapter imports at module level, so hooks still load no `logging`. The subprocess test emitted a fake record to the logger the fix configures, so it mirrored the implementation; the Linux reproduction verified the fix directly.
leaf-agent
previously approved these changes
Nov 14, 2026
… watchdog handler stderr is shared with the launcher, the interpreter and Leaf's dependencies: Python's warnings, tracebacks and logging's last-resort handler all write there. No production reader parses it as JSON: Claude Code's background watch discards it after a clean exit and quotes it as text otherwise, the hooks module keeps it as text for a failure message, and agents read it as text. The only strict parser was the suite's `said`, which failed on watchdog's "InotifyEmitter.queue_events() called when the thread is inactive" line in a waiter's stderr. So `said` now reads the lines that are JSON objects, cli.py's header says stderr also carries what the runtime prints, and the NullHandler on watchdog's logger is gone. Behavior changed: a watching process may again print watchdog's records on stderr, which an agent reading a shell's output sees as text.
leaf-agent
previously approved these changes
Nov 14, 2026
max-sixty
marked this pull request as draft
November 14, 2026 22:36
… everything else
stderr is shared with the launcher, the interpreter and Leaf's dependencies. On
Linux, watchdog's inotify emitter logs a line there when a watch is unscheduled
while an event arrives, and the suite, which parsed every stderr line as JSON,
failed on it (test_receipts' ack-rearm test, three CI failures since 7 Nov).
Now a command prints one JSON object on stdout: its result, with what it noted
beside it added to `findings`, or its refusal, {"error", "findings"}. `note`
holds findings for the record the command prints (`findings.with_held`); a
foreground server's URL line and a wait's delivery carry what was noted before
them, and a wait that ends prints {"findings": [...]}. A command whose stdout
carries something else (hooks, `page events`, `page interactions`, `package
run`, the detached server and Codex adapter) is a `PrintsItself`, and its notes
and refusal stay on stderr.
`page list`, `page media` and `thread edit` print one object (`pages`, `files`,
`records`) instead of a line per item, so their result has room for findings;
`page interactions` prints itself, a record per line, as `page events` does.
Behavior that changed: a reader piping stdout now meets findings in the pipe
rather than beside it, and a refusal arrives on stdout. The cli.py header records
the reversed decision. Tests read findings and refusals from stdout; `said`
parses the printed object.
max-sixty
marked this pull request as ready for review
November 15, 2026 19:21
leaf-agent
reviewed
Nov 15, 2026
leaf-agent
left a comment
Collaborator
There was a problem hiding this comment.
page media now prints {"files": [...]}, but the Playwright package's trace importer still reads its stdout a line at a time, so importing any trace that holds a screenshot raises KeyError: 'path'. The reader is _media in packages/playwright/scripts/import_trace.py:
urls += [json.loads(line)["path"] for line in completed.stdout.splitlines()]I reproduced it by calling _media at this head with one PNG: it fails with KeyError: 'path'. tests/model/test_playwright_trace_import.py passes because none of its traces carries an image, so CI won't catch this. Reading files fixes it, the way dev/leaf_dev/commands/eval/report.py already does in this PR:
urls += [record["path"] for record in json.loads(completed.stdout)["files"]]The line is outside the diff, so I can't attach a suggestion to it. I can push that one-line fix if you'd like.
…d server's interrupt from stdout The Playwright trace importer read `page media` a line at a time, so any trace holding a screenshot raised KeyError once the command printed one object. The model test's synthetic trace now carries a screenshot, so the default tier runs the importer's media step. A temporary `server run` interrupted by SIGINT prints its refusal on stdout like any command.
leaf-agent
approved these changes
Nov 15, 2026
max-sixty
added a commit
that referenced
this pull request
Nov 16, 2026
… it (#6107) Ten nightly-tier cases have failed on main since Nov 15, because two changes moved what the tests read and the push and PR selections don't run that tier. A macOS run of the nightly suite found them, and each passes locally at its cause's parent and fails at the cause: - #5964 put a command's findings and refusals in its JSON on stdout. Two `test_wait.py` cases still asserted an empty stdout, `test_codex_adapter.py`'s later-claim case read its refusal from stderr, and `test_interact_anchors.py`'s unsectioned-quote case read the advice as a line of its own. The wait cases still check that a waiter that lost its page prints only why it stopped. - #6025 writes the theme's neutrals in oklab, and `test_the_gutter_runs_beside_the_exhibit_and_no_further` (six cases) parsed the bar's colour from the integers in its computed style. It now paints the colour on a canvas, as #6075 did for two other readings. No product code changes. Max asked whether anything was working on the nightly failures; nothing was on these. Tests: the ten cases pass locally with `--run-nightly`. > _This was written by Claude Code on behalf of max-sixty_
max-sixty
added a commit
that referenced
this pull request
Nov 18, 2026
…ey read (#6374) Ten tests under `dev/tests` failed on main because five main commits changed what they read, and nothing in CI runs `dev/tests`. Each test still protects behavior that holds, so the fix is in the tests' fixtures and expectations; no developer tool changes. - #5964 put a `leaf` command's refusal in its stdout JSON. The desktop Codex `server start` cases and the unavailable-delivery `start`/`run` handoffs in `test_interact_preview.py` now read it there. - #4198 made the preview follow more files in its checkout. The assets-pin test's fake checkout now creates every file `worker_inputs` names, so the preview no longer subscribes the whole checkout recursively. - #6237 re-indented `docs/index.html`, and the composed-image case in `test_product_page.py` matched on the old indentation. It now matches on `alt` alone. - #5228 changed the journey's page-text read, and #6090 shortened the release marker to seven characters. `test_website_server.py`'s fake page and its expected marker follow both. To weigh: these breaks went unseen for up to three weeks because `dev/AGENTS.md` keeps `dev/tests` out of every CI selection. This PR leaves that rule unchanged. Dispatched by max-sixty from the session that landed #6014. Tests: the three changed modules, 91 passed on macOS. > _This was written by Claude Code on behalf of max-sixty_
max-sixty
added a commit
that referenced
this pull request
Nov 18, 2026
…e tools and ten tests they caught (#6412) Nothing in CI ran `dev/tests`, so main commits broke those tests without anyone seeing (#6374 fixed ten of them). This adds every developer-tool test, the Python and the Node ones, to the daily scheduled run, after the product suite, where a failure reaches Tend like any other failure on main. Pull requests, pushes to main and landing gates still don't run them. On the Ubuntu runner they took 8 minutes 43 seconds (235 passed, and the one macOS-only test skipped). Three of the 13 other failures were tools that had stopped working: - `leaf-dev preview` kept serving the runtime and layer its process first read, so an edit to `browser/leaf.js`, `browser/base.css` or a bundled package reached neither an open tab nor a fresh one. It also decided when to restart from its own copy of the runtime's identity, which had lost the kernel's stylesheets and the bundled packages, so editing those never restarted even a `--user` preview's server. The preview now reads the runtime's own identity, and replacing its in-process server first drops what the process holds of the tree (`runtime_selection.forget_tree`, which is new). - `leaf-dev site demo` stopped getting a title for its thread after #5835, because its own session has no hooks module to answer the request. It now answers with a staged title through the suite's stand-in for that module, which moves to `leaf_dev.claude_code_module`. - `leaf-dev trace-server` called a Playwright export that 1.65 removed. The other ten had stale expectations: #5964's stdout refusals, #4325's recovery words, #6154's recovery reload, the layer record's dropped `fingerprint`, and a preview identity that moved to About this page. Two more tests started a second Playwright driver on a worker thread that already held one. To weigh: the demo's thread title is now the same every run, rather than worded fresh by a model each time. Asked for by max-sixty, as a follow-up to #6374. Tests: all of `dev/tests` locally and, through a commit since reverted, on this PR's runner; the product modules the stand-in move and the layer change touch (225 passed). > _This was written by Claude Code on behalf of max-sixty_
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.
A Leaf command now prints one JSON object on stdout: its result with whatever it said beside it in
findings, or its refusal,{"error", "findings"}. stderr is left to the launcher, the interpreter and Leaf's dependencies, and nothing parses it. On Linux, watchdog's inotify emitter logsInotifyEmitter.queue_events() called when the thread is inactivewhen a watch is unscheduled as an event arrives; the suite parsed every stderr line as JSON, so that line failedtest_receipts.py::test_ack_rearm_reports_when_its_only_page_transfers_after_selectionthree times since 7 Nov (e.g. this run). Filed upstream as gorakhargosh/watchdog#1462.findings.noteholds what a command notes for the record it prints (with_held). A wait's delivery and a foreground server's URL line carry what was noted before them, and a wait that ends prints{"findings": [...]}. Commands whose stdout carries something else are aPrintsItself(hooks,page events,page interactions,package run, the detached server and Codex adapter), and their notes and refusals stay on stderr, since the TS hooks module andbackground-watch.pyquote stderr on failure.To weigh: an agent piping a command through
jqnow filters its findings out, where stderr used to show them beside the output. Over four days of transcripts, about 4 of 817 pipedleafcalls printed a finding that would be lost this way.page list,page mediaandthread editnow print one object (pages,files,records) rather than a line per item, so they have room for findings.Requested by max-sixty, who picked this design over keeping findings on stderr. Tests: the 37 model and process modules that read a command's stderr (1,456 passed) and the edited journey tests, on macOS.