Skip to content

fix(core): dismiss interrupted permission prompts - #55977

Open
zonemeen wants to merge 1 commit into
anomalyco:devfrom
zonemeen:fix/permission-interrupt
Open

zonemeen wants to merge 1 commit into
anomalyco:devfrom
zonemeen:fix/permission-interrupt

Conversation

@zonemeen

@zonemeen zonemeen commented Oct 16, 2026 •

Copy link
Copy Markdown

Issue for this PR

Closes #55678

Type of change

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

What does this PR do?

Interrupting a tool removed its pending permission request without notifying clients, leaving the Desktop dialog stuck and replies returning 404.

Publish the existing permission.replied event with reject when the permission wait is interrupted so clients dismiss the prompt and restore the composer.

How did you verify your code works?

  • All 108 permission tests pass. The new interruption test fails before the fix and verifies that other pending requests remain unaffected.
  • bun typecheck in packages/core and bun run check at the repository root pass.
  • Reproduced the stale dialog and 404 using the real Web UI and backend with a simulated model. After the fix, the prompt disappears on interruption and a follow-up message can be sent successfully.

Screenshots / recordings

Before/after TUI screenshots from the bot's separate reproduction are included in this review.

Checklist

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

@github-actions github-actions Bot added the needs:compliance This means the issue will auto-close after 2 hours. label Oct 16, 2026
@github-actions

Copy link
Copy Markdown
Contributor

The following comment was made by an LLM, it may be inaccurate:

@opencode-agent opencode-agent Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good. I reproduced the stuck prompt on the base with the issue's script (simulated model, shell ask rule, interrupt while the prompt is pending): the TUI kept showing "Permission required" and the reply returned PermissionNotFoundError. With this change, the prompt is dismissed right after the interrupt and the composer comes back. permission.test.ts passes (108), the new interrupt test fails on the base code, and packages/core type-checks.

Public API: no schema changes. The existing permission.replied event (reply: "reject") is now also published when a pending assert wait is interrupted. Clients already handle it by removing the prompt by ID, so this is backwards compatible.

No blocking concerns. The close finalizer rejects pending requests through their deferreds rather than by interruption, so the new handler doesn't send a second event on shutdown. A reply racing an interrupt could at worst produce a second permission.replied for the same ID, which is harmless for current clients. The new interrupt test is enough to cover this fix. The loop over once / always / reject that replaces the old "resolves once" test isn't needed and could be dropped to keep the change minimal.

Related: #52846

Before

After

@github-actions github-actions Bot removed the needs:compliance This means the issue will auto-close after 2 hours. label Oct 16, 2026
@github-actions

Copy link
Copy Markdown
Contributor

Thanks for updating your PR! It now meets our contributing guidelines. 👍

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.

desktop: permission dialog stuck after tool interrupt/timeout; Deny/Allow replies 404 forever, composer blocked

1 participant