-
Notifications
You must be signed in to change notification settings - Fork 3.6k
fix: hooks reset no longer re-arms a disabled hook #551
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
SomSamantray
wants to merge
8
commits into
pbakaus:main
Choose a base branch
from
SomSamantray:fix/512-hooks-reset-rearms-disabled-hook
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from 7 commits
Commits
Show all changes
8 commits
Select commit
Hold shift + click to select a range
ee68b52
fix: default hook to disabled absent explicit consent (#512)
c41bf79
fix: reset prunes hook manifest entries, closing issue #512
441bf5b
fix: scope reset() manifest pruning to the local file only
51ec05f
docs(review): record residual review findings
ee65ced
fix: keep the CLI installer and context.mjs consistent with the new e…
c207e97
fix: make reset() fully all-or-nothing for config, and resilient for …
8eb4b8c
fix: skills install/update no longer overrides an explicit hooks off
45547f0
fix: reset() reports failure when manifest pruning fails, not just co…
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
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
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
172 changes: 172 additions & 0 deletions
172
docs/plans/2026-08-10-001-fix-hooks-reset-rearms-disabled-hook-plan.md
Large diffs are not rendered by default.
Oops, something went wrong.
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,12 @@ | ||
| # Residual Review Findings | ||
|
|
||
| Source: `ce-code-review` (correctness, testing, adversarial, project-standards) on branch `fix/512-hooks-reset-rearms-disabled-hook`, head `441bf5b0`. | ||
|
|
||
| Applied findings are in the commit history (see `ee68b52a`, `c41bf797`, `441bf5b0`). The following were surfaced but consciously **not** applied in this PR — each is either pre-existing behavior this fix did not introduce, or disproportionate scope for a targeted bug fix. | ||
|
|
||
| ## Residual Review Findings | ||
|
|
||
| - **P2 (adversarial, confidence 70, pre-existing)** — `skill/scripts/hook-admin.mjs:489` `stripImpeccableHookEntry` uses substring matching (`valueHasImpeccableHookMarker`) to decide whether a manifest hook entry belongs to Impeccable, and nulls the *entire* entry on a match. A hand-authored entry that chains Impeccable's hook with the user's own command in the same `command`/`args` string (e.g. `node "a.mjs" && node ".claude/skills/impeccable/scripts/hook.mjs"`) would have the user's portion silently deleted along with Impeccable's. This behavior predates this PR (both `repairHookManifests()`'s existing prune-on-reinstall path and the new `reset()` path share it) — not introduced here, and fixing it correctly (partial-string editing instead of whole-entry deletion) is a larger, separate change. | ||
| - **P2 (adversarial, confidence 60)** — `reset()`, `setEnabled()` (`on`/`off`) all perform multiple non-atomic file reads/writes across config, cache, and manifest files with no locking. Two concurrent `hooks` invocations on the same project (two agents, or an agent and a human) could interleave and leave config/manifest state inconsistent. This is a pre-existing architectural property of the whole `hook-admin.mjs` module (not unique to `reset()`), and introducing a lock file is out of scope for this targeted fix. | ||
| - **Advisory (adversarial residual risk)** — `fileHasImpeccableHookMarker` scans every string value under a manifest's `hooks` key for the marker substring, while `stripImpeccableHookEntry` only nulls entries whose `command`/`args`/`bash`/`powershell` fields match. A marker substring living in an unrelated field (e.g. a custom `statusMessage`) would make the prune function report `true` (rewrite the file, claim success) without actually removing anything. Low likelihood given how manifests are actually generated; noted for awareness, not actioned. | ||
| - **Advisory (adversarial residual risk)** — `pruneImpeccableHookFromManifest` silently no-ops on a manifest that fails `JSON.parse`, with no user-visible signal. If a provider's own hook loader is more lenient (tolerates trailing commas/comments) than this admin tool's strict parser, a manifest could stay live and un-prunable with no warning. Not actioned — matches this function's pre-existing error-handling posture everywhere else it's called. |
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
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
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
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
Oops, something went wrong.
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.
Uh oh!
There was an error while loading. Please reload this page.