claude-code - 💡(How to fix) Fix Feature request: async AskUserQuestion — queue new forms behind the active one [1 participants]

Official PRs (…)
ON THIS PAGE

Recommended Tools

×6

Utilities matched from this issue’s tags and category — try them while you read without losing context.

GitHub issue graph ai analysis

Paste a GitHub issue URL. We fetch that issue, discover linked issues from bodies/comments/timeline, collect linked pull requests, and produce a structured English report.

The report is written in English Markdown for sharing and archival.

Helpful · Quick feedback

Loading…
GitHub stats
anthropics/claude-code#52378Fetched 2026-04-24 06:08:47
View on GitHub
Comments
0
Participants
1
Timeline
3
Reactions
0
Author
Participants
Timeline (top)
labeled ×3

When an agent invokes AskUserQuestion while the operator still has a previous form open, the second call blocks at the tool layer and the agent sits idle until the first form is answered. Propose making AskUserQuestion async by queueing subsequent forms behind the active one (FIFO). The agent's turn completes immediately on submission; the operator sees the next form only when they dismiss the current one.

Root Cause

  1. Agent idle time. The agent's tool call hangs until the user answers. Any parallel work it wanted to do (more tools, more reasoning, writing to disk) stalls behind the form.
  2. Expressive floor. The tool is effectively restricted to "ask one question at a time that gates the next step." Streams of information — research notes, decision summaries, SDR drafts, screenshot-backed context packages — have to go into the transcript as scrollable text, because sending them as a sequence of AskUserQuestion forms would serialize the agent behind every "Proceed".
RAW_BUFFERClick to expand / collapse

Summary

When an agent invokes AskUserQuestion while the operator still has a previous form open, the second call blocks at the tool layer and the agent sits idle until the first form is answered. Propose making AskUserQuestion async by queueing subsequent forms behind the active one (FIFO). The agent's turn completes immediately on submission; the operator sees the next form only when they dismiss the current one.

Problem

Today's blocking behavior costs two things at once:

  1. Agent idle time. The agent's tool call hangs until the user answers. Any parallel work it wanted to do (more tools, more reasoning, writing to disk) stalls behind the form.
  2. Expressive floor. The tool is effectively restricted to "ask one question at a time that gates the next step." Streams of information — research notes, decision summaries, SDR drafts, screenshot-backed context packages — have to go into the transcript as scrollable text, because sending them as a sequence of AskUserQuestion forms would serialize the agent behind every "Proceed".

Proposal

Make AskUserQuestion submissions non-blocking:

  • Every call goes onto a per-session FIFO queue.
  • The operator sees one form at a time. Answering/dismissing the current form pops the next queued form into view.
  • The agent's tool call returns immediately with a queued or accepted ack — the operator's answer arrives later as a separate inbound signal (same way tool results land today, just decoupled from send-time).

Knobs

  • collapse_if_duplicate: true — if a queued form has the same question text as one already in the queue, merge it instead of adding another entry. Prevents a runaway loop from flooding the operator with 40 identical prompts.
  • Allow single-option forms. The schema today enforces a minimum of 2 options. For the "long question, only action is Proceed" pattern (which this feature enables), a single option (or zero, i.e. acknowledge-and-dismiss) is the natural shape. The screenshot below had to include a filler second option ("Dismiss") just to satisfy the schema — that's a visible footgun.

Use cases unlocked

  • Streaming read-only context. Subagent collects 5 pieces of research evidence, sends each as a long-text Proceed form. Operator reads them at their own pace; main agent keeps working.
  • Non-blocking acknowledgments. Agent posts "Dashboard is up at http://127.0.0.1:4646\" as a dismissible form instead of a transcript line the user has to scroll back to find.
  • Decision summaries before big actions. Agent drafts a destructive-action summary as a form with "Confirm / Cancel" — but the agent continues with low-risk work until the operator answers.

Demo / character-ceiling test

Screenshot below is from a current-gen AskUserQuestion with ~1,800 chars in the question field. Renders cleanly without truncation (the 6 sentences the test prompt asked for all display). This is a data point for how much content a single form can carry today — useful for sizing the streaming-context use case above.

Async AskUserQuestion demo

Environment

  • Claude Code Desktop, Thu Apr 23 2026
  • Opus 4.7 (1M context)
  • macOS arm64

Priority notes

Async behaviour is the headline ask. The collapse_if_duplicate knob and single-option relaxation are two smaller quality-of-life items that naturally pair with it — none are blocking each other.

extent analysis

TL;DR

Implementing an asynchronous AskUserQuestion feature with a FIFO queue can resolve the blocking behavior and allow agents to continue working while waiting for operator responses.

Guidance

  • To achieve non-blocking behavior, consider modifying the AskUserQuestion function to return immediately after queuing the question, rather than waiting for the operator's response.
  • Implement a FIFO queue to store subsequent questions, ensuring that the operator sees one form at a time and that the next form is displayed only after the current one is answered or dismissed.
  • Introduce a collapse_if_duplicate feature to prevent duplicate questions from flooding the queue and to merge identical questions instead of adding new entries.
  • Relax the schema to allow single-option forms, enabling the use of "Proceed" or acknowledgement forms without requiring a second option.

Example

class AskUserQuestion:
    def __init__(self):
        self.queue = []

    def ask(self, question):
        self.queue.append(question)
        # Return immediately with a 'queued' or 'accepted' acknowledgement
        return {'status': 'queued'}

    def process_queue(self):
        if self.queue:
            current_question = self.queue[0]
            # Display the current question to the operator
            # ...
            # Remove the current question from the queue after it's answered or dismissed
            self.queue.pop(0)

Notes

The proposed solution assumes that the existing AskUserQuestion function can be modified to support asynchronous behavior. Additional considerations may be necessary to handle cases where the operator dismisses a question or the agent times out while waiting for a response.

Recommendation

Apply the proposed workaround by implementing the asynchronous AskUserQuestion feature with a FIFO queue, as it addresses the blocking behavior and enables agents to continue working while waiting for operator responses.

Vote matrix · Quick signals

Works
Did the solution work? Tap to confirm.
Easy Fix
Was it a quick fix?
Time Saver
Did it save you time?
Blocking
Was it severely blocking?
Common Issue
Are others likely hitting this too?
Flaky / Intermittent
Is it intermittent?
Verified / Reproducible
Can you reproduce it reliably?
Loading…

Still need to ship something?

×6

Another batch ranked right after the header list — different links, same matching logic.

Back to top recommendations

TRENDING

claude-code - 💡(How to fix) Fix Feature request: async AskUserQuestion — queue new forms behind the active one [1 participants]