Repository navigation
Leave the Skill-body door out of the Claude Code module's session.append doors - #5816
Merged
Merged
Conversation
…son's plugin The Claude Code module's session.append handler records the newest main-thread row for a fork's diagnostics. #5788 registered it on `model`, `prompt`, `tool-message`, `queue` and `note`, to keep it out from under cc-plugin-sec-default: on a machine with managed settings that plugin sends some rows past a person's plugins, and Claude Code then tells the user the hook was skipped. Measured at 2.1.318 on such a machine, that list had two faults. The security plugin also sends a Skill call's body, a `tool-message` row, past the handler, so the notice moved from session start to the session's first Skill call. And `model` is a row's origin kind, not a door: replies arrive by `response` and tool results by `tool-result`, so the handler ran on 4 of the 14 rows a probe registered on the other doors was handed, and a fork's `row` stopped at the last prompt. The handler now registers on every door except the four the security plugin sends rows past: `attachment`, `hook-context`, `compaction` and `tool-message`. A fork's `row` advances on replies, tool results, commands, deliveries and notices again, and no longer on `tool-message` rows. With this tree loaded by --plugin-dir in a headless session that calls Skill and Bash, the handler ran on 11 rows and no notice came. The test's row fixture names the `response` door. The driver raises every event into every handler, so the door it named decided nothing.
leaf-agent
previously approved these changes
Nov 10, 2026
max-sixty
added a commit
that referenced
this pull request
Nov 14, 2026
#5816 settles the same list with evidence from a machine with managed settings, where the security plugin sends Skill bodies on `tool-message` past a person's handlers, so this branch keeps main's list.
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_
Main's #5961 already registers session.append on response and tool-result and leaves out queue and notice. What this branch still changes is dropping tool-message, whose Skill bodies cc-plugin-sec-default sends past a person's plugins on a machine with managed settings. The test's fixture now appends a tool-message row, which must not move the cut.
leaf-agent
approved these changes
Nov 18, 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.
The Claude Code module's
session.appendhandler no longer registers on thetool-messagedoor. On a machine with managed settings, Claude Code seatscc-plugin-sec-defaultoutermost, and that plugin sends the body a Skill call loads, atool-messagerow, past a person's plugins. Claude Code then told the user, at each session's first Skill call:its session.append hook was skipped. "cc-plugin-sec-default" runs first and sent the event on past it.The rest of the door list stays as #5961 left it:
prompt,command,response,tool-result,deliveryandnote.Behavior change: a fork's diagnostic
rowno longer advances ontool-messagerows, the messages a tool adds beside its result; it stays on that result until the model next answers.rowfeeds only a fork's diagnostics.Verification:
cc-plugin-sec-default, read from the binary, sends past a person's plugins everyattachment,hook-contextandcompactionrow, atool-messagerow from the Skill tool, and anotean organization's plugin appends./etc/claude-code/managed-settings.json, where Claude Code 2.1.327 loggedcc-plugin-sec-default@builtin seated outermost: this machine has managed settings, a headless session against a scripted Messages API called Skill once. With main's hooks module loaded by--plugin-dir, the debug log had oneleaf: session.append bypassed by cc-plugin-sec-defaultand the session showed the notice; with this branch's, neither. The container had no organization plugin, so it doesn't exercise thenotecase; this wasn't run on the managed machine where the notice was reported.tests/process/test_interact_claude_code_module.pypasses (21 tests). Its fixture now appends atool-messagerow that must not move the cut, and putting the door back fails 3 of them.