Skip to content

fix(opencode): cancel pending tool approvals with their owner - #61360

Open
WanderWang wants to merge 2 commits into
anomalyco:v1from
WanderWang:permission-cancellation
Open

WanderWang wants to merge 2 commits into
anomalyco:v1from
WanderWang:permission-cancellation

Conversation

@WanderWang

Copy link
Copy Markdown

Issue for this PR

Closes #61358

Type of change

  • Bug fix
  • New feature
  • Refactor / code improvement
  • Documentation

What does this PR do?

Cancelling a V1 session must end its tool's permission wait and remove the connected client's card. Bind the five tool Promise callbacks to their existing AbortSignal, including signals aborted before entry.

Bracket permission publication and waiting with owner-checked cleanup. Cleanup emits the existing permission.replied rejection when it removes the request. Normal replies keep their existing settlement and policy.

This targets the affected v1 maintenance branch. It does not change V2, permission policy, or the wire schema.

How did you verify your code works?

  • Regression tests failed before the fix. Afterward, 92 permission/tool tests and 4 bridge context tests pass; package bun typecheck passes.
  • Real V1 server and the same connected official TUI, using a real local model. Before: old approval 200, command executed, card retained. After: old approval 404, no execution, card removed.
  • Normal approval still executes once; a duplicate reply returns 404.

Screenshots / recordings

The client rendering code is unchanged. The live terminal check verified removal through the existing native event, without restarting or refreshing the TUI.

Checklist

  • I have tested my changes locally
  • I have not included unrelated changes in this PR

Bind all tool callback fibers to their owner signal, including a pre-aborted guard before synchronous evaluation. Cancellation must prevent old approvals from executing tools.

Register permission cleanup before Asked publication and publish the existing reject settlement only for an entry still owned by that ask. This removes online permission cards without duplicate replies or deleting replacement requests.

This branch has not been deployed

No deployments
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