Repository navigation
fix: persist explicit goal cancellation across OpenCode lifecycles - #64
Merged
Merged
Conversation
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.
When OpenCode aborts a goal from an ACP client, the plugin can leave the goal active: V1 starts another continuation on the following idle, and V2 can restart it after an unrelated prompt or reload. Persist explicit user cancellation through an atomic active-only state mutation, invalidate continuation preparation and late results, and check goal/attempt ownership again immediately before delivery.
V1 recognizes the named session/assistant
MessageAbortedError; V2 recognizessession.execution.interruptedwith reasonuser. Paused and limited goals are preserved when an unrelated manual turn is cancelled; explicit goal stop still closes them. V2 shutdown, superseded and other interruptions retain their existing temporary suppression behavior. Ordinary error text is not treated as cancellation, and another location's events cannot cancel the owner's goal. Explicit new goals remain usable in the same session.Related to #59. This is the cancellation delivery; it does not close the broader ACP synchronization and phase-planning report.
Validation:
aa99843: lint, typecheck, build, 334 tests with coverage, and V2 lifecycle smoke. Run: https://github.com/prevalentWare/opencode-goal-plugin/actions/runs/37315558294opencode/claude-opus-5-5) returned APPROVE onaa99843after the paused/limited-goal finding was fixed. Review session:ses_ef3c9c41affewThQww1HjYtqiu. No blocking findings remain.stopReason: cancelled, terminated the worker, persistedcancelled, and produced zero automatic continuations after cancellation or an unrelated prompt. The same smoke against the base revision failed because cancellation was not persisted.status: complete,autoTurns: 1).Remaining boundaries:
/goalACP request in OpenCode 2.0.21 returnedend_turnwhile its submitted execution was still running. The host's command-action response/stream handling needs a separate fix; this plugin cannot keep that ACP request open or emit host ACP plan updates.smoke:v2script is incompatible with the installed 2.0.21 API (/api/plugin/await-activationreturns 404); the native ACP fixtures above were used instead. CI and the existing script are unchanged.Rollback: revert this PR as one behavior unit, including the source, generated server, regression tests and README behavior together. No persistence format or existing public state API changed.