claude-code icon indicating copy to clipboard operation
claude-code copied to clipboard

[FEATURE] askUserQuestionTimeout should still apply when a session is connected to Remote Control

Open 1vecera opened this issue 1 month ago • 1 comments

Problem

I run Claude Code sessions unattended for hours, often overnight, in terminal panes on a Mac mini and a Linux laptop. A minor question from the model can stall a session until morning. So I set this in ~/.claude/settings.json:

"askUserQuestionTimeout": "60s"

On the Mac I also have "remoteControlAtStartup": true, so I can check on sessions from my phone. The Remote Control docs say questions in a Remote Control session stay open until someone answers them. So with both settings on, the timeout never applies, and nothing in /config or claude doctor tells you so.

I now have to choose between the two:

  • keep Remote Control, and accept that unattended sessions block on questions;
  • or turn Remote Control off, so that the timeout works.

The two features answer the same need, getting a session unstuck while I'm away, so they shouldn't cancel each other out. Remote Control is how I'd answer when I can. When I don't answer, the session should still continue after the timeout I configured.

Expected

  • askUserQuestionTimeout applies whether or not the session is connected to Remote Control. The countdown shows on every connected surface, and an answer from any surface stops it.
  • If the Remote Control case needs to stay separate, give it a documented setting of its own. Show a clear notice in /config when Remote Control turns the timeout off.

Related

  • #94372: "60s" never auto-continues. Remote Control wasn't checked there, and it may be the same cause.
  • #77602 / #77603: in v2.1.209, Remote Control sessions behaved the other way round (auto-resolving).
  • An invalid askUserQuestionTimeout value is silently treated as "never", and claude doctor doesn't report it.

Environment

  • Claude Code 2.1.306 on macOS 26.3 (Remote Control at startup), and 2.1.309 on Arch Linux (no Remote Control).
  • Both settings are in user settings (~/.claude/settings.json).

1vecera avatar Oct 23 '26 10:10 1vecera

Until the setting covers this, a hook can give you the same timeout. AskUserQuestion also goes through PermissionRequest, and a hook can answer it there — it has to return allow with updatedInput.answers (plain allow leaves the question open).

Delayed version — wait 60 s, then pick the first option of each question:

"hooks": {
  "PermissionRequest": [{
    "matcher": "AskUserQuestion",
    "hooks": [{ "type": "command", "timeout": 120,
      "command": "sleep 60; ~/.claude/hooks/answer-ask-user-question.sh" }]
  }]
}

The script is ~30 lines of sh + python3: https://github.com/whereisdw/claude-code-hooks-recipes/blob/main/recipes/answer-ask-user-question.sh. Edit choose() if "first option" is the wrong default for you (for example, prefer the label containing "Recommended"). Keep timeout above the sleep, otherwise the hook is killed and nothing gets answered.

What's tested and what isn't: answering immediately from the hook works in an interactive terminal session (2.1.283; the transcript shows User answered Claude's questions). I haven't tried the delayed variant with Remote Control connected. In #102055 someone reports that on Desktop a PermissionRequest hook runs alongside the card and whichever answer arrives first wins; if that also holds for terminal + Remote Control, a tap on your phone inside the 60 s still takes precedence. If it doesn't, the worst case is that the phone card can't be answered during the wait — the session still moves on after it, which is the part you need overnight.

Disclosure: I build Lidnight, a Mac menu bar app that answers these questions from your phone through the same hook path and keeps the Mac awake while sessions run: https://lidnight.app/en/

whereisdw avatar Oct 26 '26 02:10 whereisdw