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
Description
On 0.1.15, a bash_delete permission prompt outlived its turn. The session aborted on its own while the prompt was displayed (I was away from the keyboard), and the prompt stayed on screen with every input path dead: Allow once, Reject, Esc and Ctrl+C did nothing. Recovered only by closing the whole terminal. On 0.1.14 the same workflow — unattended runs where a bash_delete ask waits for hours — never produced this: prompts waited 10 minutes to 2+ hours and stayed responsive.
What happened
Unattended run, agent Build, model GLM-5.3-Flash. The transcript showed:
Error
Tool execution aborted
Build · GLM-5.3-Flash · interruptedfollowed by the live prompt:
Permission required
✗ Confirm irreversible deletion
$ cd /home/cs/github/cxx-build-env && rtk shellcheck … && rm -f /home/cs/.cache/csbuild/clones/rezombie/.csbuild-marker && …
Detected deletions
- rm -f /home/cs/.cache/csbuild/clones/rezombie/.csbuild-marker
[Allow once] [Reject]Nobody pressed anything — the interrupt happened while the session was unattended (a provider stream error is the likely trigger; this machine's network flaps under it). Clicking Allow once or Reject, pressing Esc, pressing Ctrl+C: no visible effect. Killing the terminal was the only way out.
Regression
- 0.1.14:
bash_deleteasks wait indefinitely while unattended, buttons stay live. Weeks of this usage, zero failures. - 0.1.15: the first AFK run after the upgrade hit the dead prompt.
I could not reproduce it deterministically (it needs the turn to die while an ask is pending). The mechanism below is from reading the client code of the installed 0.1.15.
Analysis
The TUI removes a pending permission only on the permission.replied event (packages/opencode/src/cli/cmd/tui/context/sync.tsx, case "permission.replied"; the other path is session.deleted eviction). A teardown that doesn't emit that event leaves the store entry — and the rendered PermissionPrompt — in place. Every input path on the prompt funnels into void sdk.client.permission.reply({ requestID }) (packages/opencode/src/cli/cmd/tui/routes/session/permission.tsx): the Allow once / Reject options, the escapeKey reject, and the app_exit binding. When the server has already discarded the requestID, those calls fail and the failure is swallowed, so the dialog survives every interaction and eats all keyboard input — Ctrl+C included, because it routes through the same reply path.
So there are two halves:
- The server tears down a turn (marks it interrupted, aborts the pending tool call — hence "Tool execution aborted") without rejecting its pending permission ask, or emits
permission.repliedin a way the TUI misses. - The client has no defense: nothing prunes
store.permissionon turn teardown, and the reply calls have no error handling that would dismiss a prompt whose requestID is gone.
Suspected 0.1.15 changes
Not bisected, but the abort/retry rework in 0.1.15 is where a turn can first die under a displayed ask:
- #2424 (session abort cascades cancel to all same-session actors)
- #2407 (persistent exponential retry for recoverable errors) with #2406 (request-phase ladder rework)
- #2445 / #2441 (sweep orphaned running tool/question parts before idle)
- #2463 / #2487 (tool-batch flooding guard)
The bash_delete gate itself is older — introduced in #1566, rendering reworked in #2145 — and is not the suspect.
Workaround
MIMOCODE_AUTO_APPROVE_DELETE=trueskips the second prompt entirely (opt-out from #1566). Avoids the deadlock at the cost of auto-approving deletions.- When it hangs: kill only the TUI process from another terminal. The server keeps running and
mimo -creattaches with history intact.
Suggested fix
- Server: on turn teardown/interrupt, reject every pending permission ask for the session and emit
permission.repliedfor each. - Client: dismiss the prompt when
permission.replyfails with an unknown-request error, and/or prunestore.permission[sessionID]when the session's status leaves busy.
Environment
- MiMoCode version: 0.1.15 (regression; did not happen on 0.1.14)
- Operating System: Linux (Arch-based)
- Terminal: N/A — happened unattended; per the analysis this is input routing, not terminal I/O
Source: XiaomiMiMo/MiMo-Code