Skip to content

TUI: pending permission/question prompts lost after detach + reattach, wedging the session #36604

Description

@Mykhol

Description

If you detach the TUI while a permission prompt or interactive question is pending — or one is raised while you're detached — re-attaching leaves the session stuck. The agent is still blocked server-side waiting for a reply, but no prompt is shown and the input looks idle, so there's no way to answer. The only escape is forking the session, which discards the in-flight run.

The cause is that pending permission/question state is transient server memory (a Deferred the tool awaits), announced with a single permission.asked/question.asked event at ask time. The event stream doesn't replay pending state to a client that connects afterwards, and the TUI's bootstrap() hydrates everything on connect except these two stores — so a client that missed the live event never learns about the prompt.

Steps to reproduce

  1. Start a run that will trigger a permission prompt (e.g. an edit/bash on ask), or one that uses the question tool.
  2. Detach the TUI before answering (or detach, then let a subagent raise a prompt).
  3. Re-attach to the session.
  4. The session sits idle with no prompt; the agent is blocked and only forking recovers it.

Operating System

macOS

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions