Repository navigation
feat(install): confirm a killed Claude project change with repair or remove --yes - #974
Merged
Merged
Conversation
When agentplugins itself is killed (SIGKILL, OOM, power loss) while a Claude Code project command runs, nothing re-reads Claude's registry: the binding keeps a native activation attempt without an intent, every add, update, repair and remove refuses it, and doctor could only point to a manual edit of state-v2.json. `repair` and `remove` with --yes now confirm such an attempt first, under the mutation lock: - the process census refuses while a `claude plugin` command, or a Claude process bound to the same profile through CLAUDE_CONFIG_DIR, is still alive, because an orphaned command from the killed run can still change the registry (Windows jobs are kill-on-close, so none survives there); - Claude's own state is then read once, the same read the interrupt settle uses: an exact install of the installed package records that cache ownership, a state in which every recorded object is still exact keeps the recorded ownership, anything else keeps the attempt; - only the attempt and the confirmed ownership change, the binding is marked failed and the same command continues and finishes the job. --dry-run performs the same checks, writes nothing and stops, since nothing can be planned while the attempt is open. Without --yes the commands ask for it. Doctor names both commands for this case. The update, repair and remove commands share their option preamble, which also brings update back under the cognitive complexity limit.
…rvives The confirming removal now proves that no command of the interrupted run is alive before it reads Claude's state. The unclosed-interrupt case models that child as still running, so the removal keeps refusing the attempt.
…'s guards A Claude Code process whose arguments and environment are both unreadable can no longer be ruled out, so the confirmation of a killed attempt refuses it, as the process census promises. An unrecognized client state now says how to recover by hand instead of sending the user back to the same command, and the listed command is shortened by runes. Tests pin the remaining guards: a failed or missing process listing keeps the attempt, a held mutation lock refuses with ErrActive and leaves it untouched, and a confirmed binding is closed as failed, never active. The native setup rule now names both exceptions to "no probe after an uncertain effect": the read after a proven closed process tree, and the explicit confirmation after a killed run, whose process census is a heuristic on macOS and Linux and relies on kill-on-close jobs on Windows.
777genius
marked this pull request as ready for review
November 17, 2026 07:47
|
Strix is installed on this repository, but we couldn't run this PR security review because this workspace's trial has ended. Add a card to resume code reviews here. So far, Strix has reviewed 392 pull requests, surfaced 113 security issues (1 critical/high) and blocked 3 risky merges across this workspace. |
|
Caution Review failedThe pull request is closed.
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. |
This was referenced Nov 17, 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.
Follow-up to #968, found by running the installer against a real Claude Code on Linux.
#968 clears the attempt marker after Ctrl+C or SIGTERM, because by then the CLI is alive and knows that Claude's process tree is closed. If the CLI itself is killed (kill -9, out of memory, power loss) during one of Claude's native commands in project scope, nobody re-reads Claude's state: the state keeps a
native_activation_attemptwith no pending intent, andadd,update,repairandremoveall answered "native activation attempt ... is unresolved" with no way out except editing the state by hand.repair --yesandremove --yesnow confirm the interrupted change first and then do their usual work;doctornames both commands. The confirmation runs under the same mutation lock as any mutation and:claude ... plugin ...process or any Claude process with the sameCLAUDE_CONFIG_DIRis still alive (read from the kernel on macOS and Linux; a Claude process whose arguments and environment cannot both be read counts as alive; the process list failing to read is a refusal, not a skip; on Windows the commands run in a job that dies with the CLI, so there are no orphans to find; other systems refuse);--dry-runmakes the same checks and writes nothing; without--yesthe command asks for it; anything unrecognised keeps the block and the refusal says how to check Claude's state by hand.docs/NATIVE_SETUP_COMPLETION.mdnow states the two exceptions to "an uncertain effect is never reported as unchanged": the #968 re-read after a proven-closed process tree, and this explicit confirmation, which does not prove closure (the process check is a heuristic) and never records "unchanged" (committed effect, binding failed).One existing #968 test changed: an unproven interrupt used to refuse
remove --yesfor good; now it is cleared when no Claude process is alive, so the test models a live child process and keeps asserting the refusal. Process reading is the largest part of the diff (about 250 lines, macOS and Linux, plus a Windows stub); a simpler signal could replace it later, for example recording the process group of each native command.Checked with real Claude Code 2.1.325 (19 of 19): kill -9 of the CLI during
plugin installandplugin uninstall; while the orphanedclaudelivesrepairandremove(with--yesand with--dry-run) refuse and name its PID; after it exits--dry-runwrites nothing,--yescompletes,doctorshows no open operation and a followingaddandremovework. Go tests fail without the change (5 scenarios) and cover the four safety properties by mutation (process list error, no process listing, no lock, wrong binding state). Tests of the touched packages pass; lint is clean in all three modules.Not covered here: the Linux process reading is checked only by compilation, tests and lint (no Linux run); the Linux supervisor edge, and a few DRY and comment follow-ups from the review.