Skip to content

fix(install): resume Claude project native calls after an interrupt - #968

Merged
777genius merged 5 commits into
mainfrom
fix/claude-project-interrupt-recovery
Nov 17, 2026
Merged

777genius merged 5 commits into
mainfrom
fix/claude-project-interrupt-recovery

Conversation

@777genius

Copy link
Copy Markdown
Owner

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 a native_activation_attempt in the state with no pending intent. After that add, repair, update, remove and remove --external-uninstalled all answered "native activation attempt ... is unresolved", doctor said 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, and marketplace remove about 1 s, so the window is easy to hit. A second silent dead end: an update interrupted between uninstall and install left 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.json and 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_at marker is accepted by the install preflight. doctor now reports an unresolved attempt as an open recovery operation (journal-based clients such as OpenCode and Grok are excluded, their journal resolves the attempt), and docs/NATIVE_SETUP_COMPLETION.md describes 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 install or plugin uninstall still keeps the block and doctor shows 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, doctor only reports it honestly. That needs a separate explicit repair step.

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
777genius marked this pull request as ready for review November 17, 2026 01:52
@777genius
777genius merged commit 46ecb51 into main Nov 17, 2026
51 of 59 checks passed
@strix-security

Copy link
Copy Markdown

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.

@777genius
777genius deleted the fix/claude-project-interrupt-recovery branch November 17, 2026 01:52
@coderabbitai

coderabbitai Bot commented Nov 17, 2026 •

Copy link
Copy Markdown

Explain Change →

Caution

Review failed

The pull request is closed.

  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

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.

Share

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant