Skip to content

fix: gracefully degrade AskUserQuestion in remote control mode#459

Open
manoj30075 wants to merge 1 commit intogarrytan:mainfrom
manoj30075:fix/remote-control-askuserquestion
Open

fix: gracefully degrade AskUserQuestion in remote control mode#459
manoj30075 wants to merge 1 commit intogarrytan:mainfrom
manoj30075:fix/remote-control-askuserquestion

Conversation

@manoj30075
Copy link

@manoj30075 manoj30075 commented Mar 24, 2026

Summary

  • Problem: When Claude Code is used via the Anthropic app's remote control feature, AskUserQuestion renders an interactive terminal UI (arrow keys + Enter to select) that the user cannot interact with.
  • Fix: The preamble instructions now tell Claude to detect remote control from the conversation context and fall back to plain text questions. Zero config — nothing for users to set up.

How it works

The preamble instructions (shared by all 23+ skills) now include:

Check if remote control is active by looking at BOTH:

  1. The REMOTE_CONTROL value from the preamble bash output
  2. The conversation history — if you see Remote Control connecting… without a subsequent Remote Control disconnected., remote control is active

When detected, Claude presents questions as plain text with numbered options instead of calling AskUserQuestion. This applies to all skill questions including telemetry, lake intro, and skill-specific prompts.

Why this approach

Approach Result
TTY detection (! tty) Always triggers — Claude Code's Bash tool never has a real TTY
JWT token ("application": "ccr") Persists after disconnect, not real-time
Env var from Anthropic Doesn't exist yet (anthropics/claude-code#38428)
CLAUDE.md instruction Works but clutters install prompt and needs upgrade patching
Conversation context detection Zero config, self-contained in preamble, works immediately

Changes

File What
scripts/resolvers/preamble.ts Remote control detection in bash + conversation-based detection in instructions + plain text fallback
*/SKILL.md (23 files) Auto-regenerated from preamble change

Test plan

  • bun run gen:skill-docs succeeds (both default and codex host)
  • bun test passes (329 pass, 11 pre-existing browse/playwright failures)
  • Manual test: Connected via remote control → Claude detected from conversation context → questions rendered as plain text
  • Manual test: Disconnected → Claude detected disconnect → back to normal AskUserQuestion
  • Verified no changes to README install prompt, CLAUDE.md, or upgrade flow

🤖 Generated with Claude Code

When Claude Code is used via the Anthropic app's remote control feature,
AskUserQuestion renders an interactive terminal UI that the user cannot
interact with. This adds remote control detection to the preamble and
instructs Claude to fall back to plain text numbered questions.

Detection is conversation-based: Claude checks for "Remote Control
connecting…" without a subsequent disconnect in the conversation history.
Also supports explicit opt-in via gstack-config or env var as fallback.

Zero config for users — fully self-contained in the preamble template,
auto-propagates to all 23+ skills.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@manoj30075 manoj30075 force-pushed the fix/remote-control-askuserquestion branch from ebf1489 to a5c8bd1 Compare March 24, 2026 21:56
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant