Skip to content

fix(tui): latch permission prompts and dismiss orphaned replies - #2607

Open
goakshit wants to merge 2 commits into
XiaomiMiMo:mainfrom
goakshit:fix/tui-permission-prompt-latch
Open

goakshit wants to merge 2 commits into
XiaomiMiMo:mainfrom
goakshit:fix/tui-permission-prompt-latch

Conversation

@goakshit

@goakshit goakshit commented Oct 4, 2026 •

Copy link
Copy Markdown

Permission prompts could re-POST the same requestID on every Enter/click (#2565) and, when a turn tore an ask down without permission.replied, the dialog stayed up and swallowed all input (#2502).

  • One-shot settle on Prompt / RejectPrompt / sendReply
  • Permission.reply returns false for an unknown (orphaned) requestID
  • TUI dismisses the prompt on false / error instead of waiting forever

Before / after

Scenario: bash_delete / “Confirm irreversible deletion”, orphaned ask (permission.reply → false), triple-Enter. Captured from the real PermissionPrompt via @opentui/solid testRender (100×24).

BEFORE main@6babeb0b AFTER this branch
Triple-Enter 3 × POST …/reply 1 × POST …/reply
Orphaned dialog still mounted, eats input dismissed

Before/after — permission prompt

Short recording (prompt → triple-Enter → result): permission-before-after.mp4

Verified with bun run typecheck and bun test test/cli/tui/permission-bash-delete.test.tsx test/permission/next.test.ts (112 pass) — covers single-reply latch, orphaned dismiss, and HTTP-error dismiss.

Fixes #2502
Related to #2565

One-shot settle on Prompt/RejectPrompt and sendReply so Enter/click cannot
POST the same requestID repeatedly (XiaomiMiMo#2565). Permission.reply returns false
for an unknown requestID and the TUI dismisses the dialog on false/error so
an ask orphaned by turn teardown cannot wedge input forever (XiaomiMiMo#2502).
Match the file's existing signal style instead of mutable let flags, and
indent the dismissed Show wrapper. No behavior change.
@goakshit

goakshit commented Oct 4, 2026

Copy link
Copy Markdown
Author

@yanyihan-xiaomi @lilei-xiaomi @JinyuXiang-Mimo — ready for review.

Small TUI fix for orphaned / re-fired permission prompts (#2502, related #2565). Typecheck + 112 permission tests pass locally; before/after capture is in the PR body.

Fork PR is sitting on action_required for typecheck / lint / test (first-time contributor workflow approval). Could you approve the workflow runs and review when you have a moment?

I only have pull access on this repo, so I can’t merge — happy to address review comments or rebase if you want it landed a certain way.

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.

bash_delete prompt is orphaned when the turn is auto-interrupted: all input (Allow once / Reject / Esc / Ctrl+C) dead until the terminal is killed

1 participant