Repository navigation
Fail CI where Claude Code would refuse the hooks module, at the pin and daily at the newest release - #5952
Merged
Conversation
`pnpm run check:hooks` now also runs `claude plugin validate .` from a pinned `@anthropic-ai/claude-code` (2.1.325), which reports what Claude Code would refuse before loading `hooks/claude-code.ts`. Nothing in CI asked Claude Code before: the module's tests run in a Node stand-in, and hooks/tsconfig.json leaves the module out because its declarations aren't on npm. #5907 read the route variables with `$.env.get(name)` in a loop. Claude Code refuses a module whose `$.env.get` takes anything but a string literal (2.1.305 already did), so since #5907 landed every session that loaded the module from a current install had no band, no turn-end clerk and no thread forks, with the refusal only in Claude Code's debug log. On main this check fails with that refusal; on #5947, which spells each name out, it passes. The package's postinstall copies its platform binary into place, so pnpm-workspace.yaml allows its build.
leaf-agent
reviewed
Nov 14, 2026
leaf-agent
left a comment
Collaborator
There was a problem hiding this comment.
I found no problems in the diff. I'm holding approval only because the description says Merge after #5947, which is still open. This PR's test job fails with the expected refusal ($.env.get takes a literal name as its first argument … (got the variable name) at hooks/claude-code.ts), so the check catches the failure it was added for.
A new `newest-harnesses` job, on the daily schedule and on dispatch, installs `@anthropic-ai/claude-code@latest` and `@earendil-works/pi-coding-agent@latest` and runs `pnpm run check:hooks`. The pins move with Dependabot's weekly npm group, while a user's Claude Code updates itself as each release ships, so a release that refuses `hooks/claude-code.ts` or changes the API `hooks/pi.ts` uses now turns the daily run red for tend within a day. Rehearsed locally on this branch's tree with #5947's module: Claude Code 2.1.325 and Pi 1.5.2 installed, and the check passed.
…f its own Max asked for no new job. The daily scheduled `test` job now ends by installing the newest Claude Code and Pi and running `pnpm run check:hooks` again, after every step that reads `node_modules` has finished.
max-sixty
added a commit
that referenced
this pull request
Nov 14, 2026
…rom the main thread's usage (#5947) Claude Code refuses to load a hooks module whose `$.env.get` takes anything but a literal name, and #5907 read the route variables in a loop. Since #5907 landed, Leaf's Claude Code module hasn't loaded in any session: no band, no turn-end check, no thread-reply fork. `claude plugin validate` refuses main's module at 2.1.322, 2.1.323 and 2.1.325. `readRoute` now spells each name out. The claude-code journey passes with this branch, where it failed at setup on main (`hooks module did not load`). #5952 adds that validation to CI and should merge after this. The PR also tightens the effort learning from #5892/#5907, which keeps turn-end checks from rewriting the prompt cache on Vertex: - **Rewrite test.** A check at a changed effort now counts as a rewrite when it reads less from the cache than the main thread's last request left there (read + creation from the `turn.step` result, recorded as `request.cached` in each fork's diagnostics). Before, the test was "wrote more than it read", which misses a rewrite of a conversation shorter than the system prompt and tools the fork still reads (28k tokens on Vertex in #5904's repro). In 103 real checks where the cache held, plus 12 in the journey, every fork read at least `cached`. Only answered checks count: a refused fork reports zero reads. - **Lapse.** A stored answer was asked again only in a conversation of at most 20 messages. In practice that never happened: of 902 real checks, none came before message 46. So a stored answer never lapsed. Now the first check after the 7-day lapse asks at low whatever the size. Where the backend still lacks per-message effort, that costs one conversation rewrite per backend per week, about $1.50–3 at 300k tokens. That number is a call to weigh. The module's stale `session.append` door names, which 2.1.325's `claude plugin validate` reports, are left to #5816. Max asked whether the Vertex caching issue could be fixed. Codex reviewed the change; its two findings, the refused fork and a step racing the fork, are fixed here. `tests/process/test_interact_claude_code_module.py` passes (18); the new cases fail on main. > _This was written by Claude Code on behalf of max-sixty_
hooks/pi.ts depends on Pi's API, and the nightly scan read only Claude Code's and Codex's release notes.
leaf-agent
approved these changes
Nov 14, 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.
CI now fails wherever Claude Code would refuse to load
hooks/claude-code.ts.pnpm run check:hooksalso runsclaude plugin validate .from a pinned@anthropic-ai/claude-code(2.1.325), on every run. The daily scheduledtestjob then runs the same check again after installing the newest Claude Code and Pi. A release that refuses the module, or changes the APIhooks/pi.tsuses, then turns the daily run red for tend within a day, instead of waiting for Dependabot's weekly bump of the pin while users' Claude Code updates itself. Until now nothing in CI asked Claude Code: the module's tests run in a Node stand-in, andhooks/tsconfig.jsonleaves the module out.That gap let #5907's
$.env.get(name)loop through. Claude Code refuses a module whose$.env.gettakes anything but a string literal (2.1.305 already did), so every session that loaded the module from an install since #5907 has had no band, no turn-end clerk and no thread forks. The refusal shows only in Claude Code's debug log, so all Max saw was an empty band in a session he resumed today.#5947, now on main, spells each name out, so the check passes on this branch; before it merged, the check failed in CI with exactly that refusal.
The nightly harness scan in
running-tendnow reads Pi's releases too, sincehooks/pi.tsdepends on Pi's API.The package's postinstall copies its platform binary into place, so
pnpm-workspace.yamlallows its build; pnpm hard-links the 347 MB binary from its store, so a worktree adds no copy.Max asked why the band was missing, then for the nightly check against each harness's newest release, and for Pi in the nightly scan. Checks:
pnpm run check:hooksfailed in CI with only that refusal before #5947 and passes locally after it; the newest-release step's commands, rehearsed locally with #5947's module, installed Claude Code 2.1.325 and Pi 1.5.2 and passed;pnpm run test:browserand pre-commit pass. Thetestjob's one failure,test_receipts.py::test_ack_rearm_reports_when_its_only_page_transfers_after_selection, is inherited: a watchdog warning (InotifyEmitter.queue_events() called when the thread is inactive) on a waiter's stderr broke the test's JSON parse, in code this PR doesn't touch.