Skip to content

fix(opencode): report an interrupt during native verification instead of success - #969

Merged
777genius merged 1 commit into
mainfrom
fix/opencode-interrupt-exit
Nov 17, 2026
Merged

777genius merged 1 commit into
mainfrom
fix/opencode-interrupt-exit

Conversation

@777genius

Copy link
Copy Markdown
Owner

Follow-up to #959, found by running the installer against a real OpenCode on Linux.

If add for OpenCode was interrupted (SIGINT or SIGTERM, to the whole process group or only to the CLI) while the client was checking the MCP server, the CLI exited with code 0 and "result":"success", status completed, activation prepared, and no "interrupted" message. The state was consistent and a rerun reached active, but scripts and the user could not tell that the run was cut short. Cursor reports the same situation as an interrupt with exit 1.

The cause is in the OpenCode skill observation: only "the process may still be running" was propagated. Any other error, including the cancelled command context closing a running query, was turned into a plain "could not verify", which leaves the setup prepared and returns no error. The observation now returns the context error right after that check, as the Cursor adapter does. A failure of the query itself, including its own time budget, still leaves the setup prepared, so a client that cannot be verified without any cancellation behaves as before.

Checked with a real OpenCode 1.19.4 and a stdio MCP server that delays its initialize answer: before the change SIGINT to the process group and to the CLI gave exit 0 and success; after it both give exit 1, stage canceled and "interrupted: run the same command again to resume", SIGTERM too. A rerun then reaches active, doctor shows no open operation, there are no leftover processes, and remove is clean. An MCP server that simply fails to start still gives exit 0 and prepared. The regression test covers the three query phases (debug config, debug skill, mcp list) and fails without the change.

Not covered: a cancellation that arrives right after a successful check is still reported as interrupted although the install is already active (Cursor does the same, and a rerun is a no-op).

Canceling `agentplugins add` while OpenCode ran its native discovery
queries (debug config, debug skill, mcp list) closed the query cleanly,
and the closed failure was read as "could not verify". The install then
finished as a prepared success with exit code 0 and no interruption
notice.

Return the command's cancellation after discovery, as the Cursor adapter
does, so the CLI exits 1 with the resume hint. Failures of the query
itself, including its own time budget, still leave the setup prepared.
@777genius
777genius marked this pull request as ready for review November 17, 2026 02:08
@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 merged commit 688c838 into main Nov 17, 2026
35 of 42 checks passed
@777genius
777genius deleted the fix/opencode-interrupt-exit branch November 17, 2026 02:08
@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