Skip to content

Fail CI where Claude Code would refuse the hooks module, at the pin and daily at the newest release - #5952

Merged
max-sixty merged 6 commits into
mainfrom
leaf-mod-display-missing
Nov 14, 2026
Merged

max-sixty merged 6 commits into
mainfrom
leaf-mod-display-missing

Conversation

@max-sixty

@max-sixty max-sixty commented Nov 14, 2026 •

Copy link
Copy Markdown
Owner

CI now fails wherever Claude Code would refuse to load hooks/claude-code.ts. pnpm run check:hooks also runs claude plugin validate . from a pinned @anthropic-ai/claude-code (2.1.325), on every run. The daily scheduled test job then runs the same check again after installing the newest Claude Code and Pi. A release that refuses the module, or changes the API hooks/pi.ts uses, 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, and hooks/tsconfig.json leaves the module out.

That gap let #5907's $.env.get(name) loop through. Claude Code refuses a module whose $.env.get takes 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-tend now reads Pi's releases too, since hooks/pi.ts depends on Pi's API.

The package's postinstall copies its platform binary into place, so pnpm-workspace.yaml allows 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:hooks failed 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:browser and pre-commit pass. The test job'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.

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

`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 leaf-agent left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.
@max-sixty max-sixty changed the title Fail the hooks check where Claude Code would refuse to load the module Fail CI where Claude Code would refuse the hooks module, at the pin and daily at the newest release Nov 14, 2026
…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.
@max-sixty
max-sixty merged commit 7365c35 into main Nov 14, 2026
5 of 6 checks passed
@max-sixty
max-sixty deleted the leaf-mod-display-missing branch November 14, 2026 19:55
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