Make AskUserQuestion non-blocking / asynchronous (notification-driven, yield the turn)

Open 💬 0 comments Opened Jun 17, 2026 by gbmaizol

Problem

AskUserQuestion holds the interactive session in a wait-state until the question is answered. In practice this causes two issues:

  1. Terminal blocking — the REPL is occupied, so I can't run other commands in that terminal (e.g. claude update, git, etc.) while a question is pending.
  2. Session/idle accounting — if I need time to think and step away, the open-ended wait appears to keep the session active, which can inflate session/tool time and risk idle timeouts that break the workflow.

(Note: I'm describing observed behavior — the internal wait-state accounting isn't documented, so point 2 may not be exactly right.)

Proposed solution

Make the question asynchronous, mirroring how background / long-running tasks already notify on completion via the existing PushNotification mechanism:

  • When the assistant asks, push a notification and immediately yield the turn back to the user — exactly as when a normal turn ends — freeing the terminal.
  • Opening/clicking the notification routes the user to the question dialog; answering resumes the agent loop.

Why this is low-risk

The notify-and-resume plumbing already exists for background tasks; this extends it to interactive questions. It also generalizes the current fallback (assistant asks in plain text and ends its turn), while preserving the structured multiple-choice UX of AskUserQuestion.

Related

  • #37113 (closed/stale) — "Allow AskUserQuestion to be dismissed programmatically or with a timeout" — adjacent (also about not being stuck on the prompt) but proposes timeout/dismiss rather than a notification-driven async model.

View original on GitHub ↗