Repository navigation
fix(disk-hygiene): warn a resumed session that the clean skill's guard is gone - #10091
kyle-sexton wants to merge 6 commits into
Conversation
…d is gone The skill-frontmatter belt is not registered after claude -p --resume, so a manual-lane delete approved before the resume ran unprompted. The /disk-hygiene:clean expansion hook now writes a per-session marker, and the existing SessionStart entry tells the model on a resume with that marker to make no delete or overwrite until the user types /disk-hygiene:clean again. The safety model and handoff docs state the belt's lifetime as observed. Closes #9853 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
Held ( |
|
#9853 is decided on the facts: option B. A SessionStart |
|
Correction from Issue Triage: |
Codex Review SummaryThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
|
claude-review reviewed Incremental review of a91f40c against f833fb4: no findings. What I checked
Not independently verified: I ran no tests. The pass counts in the PR body are the author's claims. Minor, not counted as a finding: the size-cap and deadline-timeout paths of Spend: none; no billed resources or review-lane changes. |
|
claude-security-review reviewed Security review (incremental since f833fb4)No security findings in the changes since the last review. I read the incremental diff and the full head
One limit carries over from before this increment and is not new: the resume notice is advisory and depends on the model following it. The PR description states this openly. Cost: nothing in this change can start a real charge. critical-findings: 0 |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: f833fb423d
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| const markerRoot = at >= 0 ? (argv[at + 1] ?? '') : '' | ||
| let payload | ||
| try { | ||
| payload = JSON.parse(readFileSync(0, 'utf8')) |
There was a problem hiding this comment.
Bound the resume notice's stdin read
When the hook's input pipe delivers the JSON but delays EOF, readFileSync(0, 'utf8') blocks until EOF instead of processing the payload. This stalls even unrelated startup events and can consume the handler's entire 10-second timeout, discarding the resume notice when it is needed. A local subprocess check confirmed that a complete payload with stdin left open keeps this handler running until the pipe closes. Use a bounded stdin buffer and add a delayed-EOF regression test, following rule 3 of the hook-precision convention linked from AGENTS.md.
AGENTS.md reference: AGENTS.md:L128-L129
Useful? React with 👍 / 👎.
There was a problem hiding this comment.
| Finding | Classification | Evidence |
|---|---|---|
| Bound the resume notice's stdin read | VALID (fix now) | readFileSync(0) waited for EOF. Fixed in a91f40c: readPayload stops at the first complete JSON payload, a 1 MiB cap or a 2 s deadline, and the process exits even with stdin open. A new test, "a payload whose pipe stays open is handled without waiting for EOF", writes the payload, leaves stdin open, and asserts the notice and an exit within 5 s. Against the old script, that test hangs. |
| **The belt does not survive a resume.** `claude -p --resume <id>` starts a new process on the same | ||
| session id, and in that process the belt is not registered: the same PowerShell delete that the belt | ||
| prompted (and the headless run denied) inside one process ran unprompted after `--resume`, and the file | ||
| was recycled. With the belt gone, the deny-by-default Bash lane and the PowerShell deletion prompts are | ||
| gone too; only the always-on engine gate, the permission mode and the auto-mode classifier remain. The |
There was a problem hiding this comment.
Keep upstream lifetime claims in pointer records
The new skill reference text restates Claude Code's hook-registration and resume behavior as standing facts, and the subsequent verification record repeats those claims with a pinned product version. AGENTS.md explicitly prohibits volatile upstream specifics in skill text even when accompanied by a dated record; its linked rule requires keeping the operational decision and a links-only pointer instead. Retain the instruction to re-run /disk-hygiene:clean before resumed mutations, but move the probe narrative and version details outside the skill and keep the exact upstream/probe pointers, as-of date, and recheck trigger. Apply the same correction to the changed handoff reference and setup skill.
AGENTS.md reference: AGENTS.md:L107-L109
Useful? React with 👍 / 👎.
…t to pointers The notice no longer waits for EOF: it stops at the first complete JSON payload, a size cap or a deadline. A sibling .test.sh lets CI's lanes run the Node suite. The safety model's resume text states our decision with a pointer record instead of restating upstream behavior and versions. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Closes #9853
Summary
The
/disk-hygiene:cleanskill-frontmatter belt (PowerShell deletion prompts, deny-by-default Bash lane) is registered only in the process that invoked the skill. A Windows probe showed that afterclaude -p --resumeit was gone, so a manual-lane delete the user had approved before the resume ran without a prompt. This PR implements the owner's decision D on the issue: a resume notice built from the existing hooks, plus doc corrections. It does not add a gate.Fix
UserPromptExpansionrow for/disk-hygiene:cleannow passes--marker-root ${CLAUDE_PLUGIN_DATA} --launch-marker clean-invokedto the launcher. The launcher already had this option (the guard-launch monitor uses it), and it writesclean-invoked/<session_id>.launched.SessionStartentry (same matcher group) gets a second, exec-form handler,hooks/resume-notice.mjs. Onsource: resumewith that session's marker present, it returnsadditionalContexttelling the model to make no delete or overwrite until the user types/disk-hygiene:cleanagain. In every other case it prints nothing. It is node only and spawns no bash or Python. Nothing is added on any per-tool-call path, and no new event or matcher is registered.safety-model.mdnow gives the belt's lifetime as the invoking process and adds a verification record citing the #5609 probe. The stale "Not probed: the Windows PowerShell tool" line is replaced with what the probe found.unsupported-platform-handoff.md, the README and the setup skill state the resume limit.Verification
node --test plugins/disk-hygiene/hooks/resume-notice.test.mjs: 8 pass. The notice fires only on a resume that has this session's marker. It stays quiet with no marker, with another session's marker, and on startup, clear, fork or compact. One end-to-end case runs the registeredUserPromptExpansionrow through the real launcher, then runs the registeredSessionStartrow.scripts/affected-tests.sh --runover the diff, includingrun-python-hook.test.sh(it now pins the twoSessionStarthandlers and the expansion's marker flags),engine_context.test.shandnode-notice-rows.test.sh. All pass.check-hook-exec-form,check-hook-slow-shapes,check-hook-userconfig-argv,check-hooks-descriptionandcheck-killswitch-hoist: all clean.failing, so they ran here in fresh-context subagents): fixed a main-module guard that skippedmain()when the plugin path is a symlink or junction (new test, which fails before the fix); corrected two wording points; noted that a marker survives a Python-less blocked expansion. Not fixed here: the launcher's predictable${TMPDIR:-/tmp}marker fallback, a pre-existing pattern shared with the four guard-launch-monitor rows (low severity, tracked separately).claude --resumeprobe on Windows, which needs the fleet host. The notice keys onsource: resume, so it covers interactive resume as well.Related
🤖 Generated with Claude Code