Repository navigation
fix(install): resume Claude project native calls after an interrupt - #968
Merged
Merged
Conversation
Ctrl+C or SIGTERM during any of the four Claude Code project calls (plugin marketplace add, plugin install, plugin uninstall, plugin marketplace remove) left the binding with a native activation attempt and no persisted intent. Every later add, update, repair and remove was refused for good, doctor showed no open recovery and suggested commands that were refused as well. When such a call fails and its process tree was reaped, the Claude adapter now reads Claude's own registry once more in a short context detached from the cancellation. An exact install or any state the next install or removal accepts (registration, installation index and owned cache all verified) becomes a certain effect, so the attempt is closed and the same command continues. A partial removal is reported as settled progress: the core keeps the recorded ownership, marks the binding failed and clears the attempt. A child whose cleanup is not proven, a failed re-read or an unrecognized state keep the attempt blocked as before; a CLI killed with SIGKILL stays blocked too. The install preflight also accepts the owned cache Claude marks orphaned on uninstall, so an update interrupted between uninstall and install resumes. Doctor now counts an unresolved native attempt as an open recovery operation and stops suggesting commands that refuse it.
…ledgement An interrupted Claude project removal whose client cleanup is not proven must keep its attempt, both before and after the native uninstall landed; the removal settle has no later verification to fall back on. The core acknowledgement of a settled partial removal is covered directly: it clears the attempt, marks the binding failed and keeps its ownership and package, while an uncertain effect, a committed effect without the settled proof or a changed predecessor keep the attempt.
…octor OpenCode and Grok record native transitions in a journal that the next mutation replays, so their attempts are not stuck and the manual recovery advice was wrong for them. Doctor now skips attempts the native transition observer reports with a journal root.
…e interrupts The single read after an interrupted Claude command used its own 15 second limit, shorter than the usual 60 second listing budget, so a slow machine could keep the attempt blocked. It now uses the ordinary probe bound and only detaches the caller's cancellation. After the first interrupt the CLI says it is finishing the current client step and restores default signal handling, so another interrupt stops it at once instead of being silently ignored. The native setup rule now names the one exception to "no probe after an uncertain effect": one read-only registry read after a proven closed process tree, reporting only an exactly recognized state.
Writing a notice to stderr on the first interrupt could raise SIGPIPE when stderr is piped (for example `2>&1 | tee`) and stop the CLI before it recorded the client state, and restoring default handling after the first signal let a later SIGTERM or SIGHUP kill it the same way. Interrupt handling is back to a single cancellation for every signal; the closing hint is still printed only after the command has returned.
777genius
marked this pull request as ready for review
November 17, 2026 01:52
|
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 #959, found by running the installer against a real Claude Code on Linux.
In project scope, Ctrl+C or SIGTERM (or any non-zero exit) during one of the four native Claude calls (
plugin marketplace add,plugin install,plugin uninstall,plugin marketplace remove) left anative_activation_attemptin the state with no pending intent. After thatadd,repair,update,removeandremove --external-uninstalledall answered "native activation attempt ... is unresolved",doctorsaid there were no open recovery operations, and the CLI told the user to run the same command again. Each of these calls takes about 0.2 s, andmarketplace removeabout 1 s, so the window is easy to hit. A second silent dead end: anupdateinterrupted betweenuninstallandinstallleft a cache marked.orphaned_at, which the next command rejected as modified outside agentplugins.The Claude adapter now re-reads Claude's state once, read-only, right after an interrupted or failed native call, when the process tree is confirmed closed. The re-read runs on its own context with the usual probe timeout (
claude plugin list --json,known_marketplaces.json,installed_plugins.jsonand the cache digest). If the state matches either the source or the target state, or one that the next install or removal accepts, the effect counts as known and the attempt marker is cleared; a confirmed partial removal keeps the recorded native objects and marks the binding failed. Anything else, including a kill -9 of the CLI itself, keeps the block exactly as before. The cache with Claude's own.orphaned_atmarker is accepted by the install preflight.doctornow reports an unresolved attempt as an open recovery operation (journal-based clients such as OpenCode and Grok are excluded, their journal resolves the attempt), anddocs/NATIVE_SETUP_COMPLETION.mddescribes the one allowed read-only re-read.Checked with real Claude Code 2.1.325: add, update and remove, each interrupted by SIGINT and SIGTERM before and after each of the four native calls, 24 of 24 recover on a plain rerun on macOS and 24 of 24 on Linux, with no leftovers. A kill -9 of the CLI during
plugin installorplugin uninstallstill keeps the block anddoctorshows it as an open operation. Go regression tests fail without the change (7 CLI scenarios, an unclosed-process control for add and remove, and the usecase acknowledgement for a confirmed partial removal).Not covered: there is still no command that clears the block after a kill -9,
doctoronly reports it honestly. That needs a separate explicit repair step.