[Bug] AskUserQuestion auto-advances while user is actively typing, discarding input

Open 💬 3 comments Opened Jul 3, 2026 by mpkogli

Bug Description
Title: AskUserQuestion AFK auto-advance auto-submits default answers while the user is actively typing

Summary

Interactive AskUserQuestion dialogs now show an "auto-continue in Ns · any key to stay" countdown and, on timeout, auto-submit the currently-selected (default) answers. Two problems: (1) this is a behavior change that's on by default, undocumented, and has no settings.json toggle — I never opted in; (2) the idle timer is not reset by typing into the dialog, so it auto-advances while I'm actively answering, discarding my in-progress input and recording the defaults.

Repro

  1. macOS, fullscreen TUI, permissions.defaultMode: "auto".
  2. Have the assistant call AskUserQuestion.
  3. Start selecting/typing an answer. The "auto-continue in Ns" countdown keeps running and fires mid-answer — it does not reset when I interact with the dialog. The default/first option gets submitted; the recorded result is stamped with afkTimeoutMs.

Expected

  • The auto-advance should be opt-in, or at minimum have a documented settings.json setting (not only an undocumented env var).
  • If enabled, any interaction with the dialog (selecting an option, typing) must reset the countdown. It should never submit while the user is actively answering.

Why it's a bug (not just a preference)

  • Unrequested default: it's enabled with enabled: true hardcoded at the call site — not gated on permission mode — and controllable only via the undocumented env vars CLAUDE_AFK_TIMEOUT_MS (default 60000) / CLAUDE_AFK_COUNTDOWN_MS (default 20000). Nothing in docs or settings.json exposes it.
  • Idle detection ignores dialog input: the timer computes idle from a single global lastInteractionTime, which is only refreshed by the main input loop. Keystrokes handled by the AskUserQuestion dialog itself (option selection / freeform text) don't refresh it, so the countdown advances and fires even while the user is typing an answer.

Impact: silently records wrong (default) answers the user did not choose — corrupts decisions in planning/clarification flows and erodes trust in every recorded answer.

Environment

  • Claude Code v2.1.198
  • macOS 15.7.7 (Darwin 24.6.0), fullscreen TUI ("tui": "fullscreen")
  • permissions.defaultMode: "auto"

Requested fix

  1. Make AFK auto-advance opt-in with a documented settings.json toggle TY is attached).
  2. Reset the countdown on any dialog interaction; never auto-submit while the user is mid-answer.

Environment Info

  • Platform: darwin
  • Terminal: ghostty
  • Version: 2.1.198
  • Feedback ID: 9f4e9350-9fae-4dfa-95a3-8adc1eb7dce6

Errors

[]

View original on GitHub ↗

This issue has 3 comments on GitHub. Read the full discussion on GitHub ↗