Repository navigation
fix: keep Claude Code wake tracking on main turns - #3511
Merged
Merged
Conversation
Drop the classic.Stop module link so managed Claude Code sessions do not bypass it. Track only main-loop turn starts and completions; a subagent turn after the main turn no longer suppresses the watch's wake. Replace the obsolete Stop-link test with a regression for that idle wake. Closes #3510
max-sixty
added a commit
that referenced
this pull request
Oct 22, 2026
…the hooks module's watch opt-in (#3512) Claude Code's watch between turns goes back to the background `asyncRewake` Stop hook, and the hooks module's watch becomes opt-in again behind the plugin's `hooks_module` option. The band above the prompt stays on in both cases. Since #3399 the module has been the only watcher. It wakes an idle session with `$.prompt.submit`, which Claude Code draws as a full user-styled prompt: "The leaf plugin sent a message: Leaf: <page path> has new input…" followed by the engine's paragraph on plugin prompts. The background hook's wake draws as one dim "Stop hook feedback" row. A survey of transcripts since 2026-10-13 also found two kinds of visible rows that only the module produces. One is a queued wake that fires as an empty turn after the user's own prompt has already taken the input (2 of 4 module wakes). The other is a pair of `leaf: Leaf: … exit code 143` notices when the session's children are terminated while it is idle. - `hooks/hooks.json` gets the background Stop registration back, and `hooks/scripts/background-watch.py` gets its supervisor back. The supervisor stands down when `CLAUDE_PLUGIN_OPTION_HOOKS_MODULE` is `true`, which Claude Code exports to each of the plugin's hooks. This replaces the `leaf_watch` payload mark, which relied on the module's `classic.Stop` link, a link #3511 found is bypassed in managed sessions. - `hooks/claude-code.ts` starts watches only while `options.hooks_module` is on, and draws the band either way. - `leaf-dev journey claude-code --hooks-module` is back, so both watchers run the same journey. On Claude Code 2.1.307 both pass every step. The default run shows 8 "Stop hook feedback" rows and 1 cross-session nudge. The module run shows 2 plugin prompts and 3 nudges, and its debug log shows no asyncRewake wake, which confirms the background hook stood down. - The shipped Claude Code reference, `session-lifetime.md`, the harness declarations, the README and the site's integration notes describe the background watch as the default again. Comparing the two watchers properly, and cutting what the module shows, comes in a follow-up. > _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.
Managed Claude Code sessions bypass the module's
classic.Stoplink, so Leaf cannot use that link to decide when a turn ends. The module now tracks main-loopturn.startandturn.completealone and ignores subagent starts; input arriving during Stop hooks stays for the watch started at turn completion. This removes the skipped-link notice and lets an idle main loop wake after a subagent starts.The regression test failed before the change because the subagent start suppressed the wake, and passes after it. Thirteen focused Claude Code module tests and
pnpm run checkpass. One other module test cannot create anAF_UNIXsocket in this runner; the live Claude Code journey could not start a session within 300 seconds, so that path remains unverified here.Closes #3510 — automated triage