Skip to content

fix: pre-empt broken AskUserQuestion on the Claude Desktop host - #2146

Closed
kalpajit279 wants to merge 1 commit into
garrytan:mainfrom
kalpajit279:fix/auq-claude-desktop-transport-avoidance
Closed

kalpajit279 wants to merge 1 commit into
garrytan:mainfrom
kalpajit279:fix/auq-claude-desktop-transport-avoidance

Conversation

@kalpajit279

Copy link
Copy Markdown

Problem

In the Claude Desktop app, AskUserQuestion is advertised and enabled (CLAUDE_CODE_ENABLE_ASK_USER_QUESTION_TOOL=true, CLAUDE_CODE_ENTRYPOINT=claude-desktop) but its handler returns [Tool result missing due to internal error] — the same class of host bug already documented for Conductor. The model gets a raw dead-end error every time it tries to ask the user a question.

Why the existing fallbacks don't catch it

  • question-preference-hook (PreToolUse) only runs its transport-avoidance redirect for isConductor(), so a desktop session falls through to defer and the doomed call proceeds.
  • auq-error-fallback-hook (PostToolUse) is designed to inject the prose-fallback directive on this error — but Claude Code does not fire PostToolUse hooks on the missing-result/transport-error path (the hook's own header comment flags this as unverified; it's now confirmed on claude-desktop). So the only place that can intercept is PreToolUse.

Fix

Extend the existing PreToolUse transport-avoidance to also fire when CLAUDE_CODE_ENTRYPOINT === 'claude-desktop', redirecting to the same prose decision brief used for Conductor. The reason label is generalized ([conductor] / [claude-desktop]); all the existing prose-brief instructions are unchanged. isConductor() stays semantically pure (its test still asserts it only keys on CONDUCTOR_*).

Tests

  • Added a Claude Desktop prose redirect describe block in test/question-preference-hook.test.ts, paralleling the Conductor cases (two-way deny, one-way deny, never-ask auto-decide still wins, non-AUQ still defers).
  • Mirrored the existing ambient-Conductor-strip with delete env.CLAUDE_CODE_ENTRYPOINT in the two hook test runners (question-preference-hook.test.ts, memory-cache-injection.test.ts), so running the suite inside Claude Desktop doesn't flip every defer into the prose deny.

Verification

On claude.exe 2.1.197 (Windows): the identical AskUserQuestion call that previously returned [Tool result missing due to internal error] now returns the [claude-desktop] prose-redirect deny from PreToolUse, so the model renders a prose decision brief instead of hitting the error. Direct hook invocation confirms deny for AUQ and defer for non-AUQ tools on the desktop host.

🤖 Generated with Claude Code

The PreToolUse transport-avoidance in question-preference-hook only guarded
against Conductor. The Claude Desktop app (CLAUDE_CODE_ENTRYPOINT=claude-desktop)
advertises + enables AskUserQuestion (CLAUDE_CODE_ENABLE_ASK_USER_QUESTION_TOOL=true)
but its handler returns "[Tool result missing due to internal error]".

PostToolUse hooks do NOT fire on that transport-error path, so
auq-error-fallback-hook cannot rescue it after the fact — the model just sees the
raw error. Extend the existing PreToolUse deny to also fire when
CLAUDE_CODE_ENTRYPOINT=claude-desktop, redirecting to the same prose decision
brief. Generalize the reason label ([conductor] / [claude-desktop]).

Tests: mirror the ambient-env strip (delete CLAUDE_CODE_ENTRYPOINT) in the two
hook test runners so a suite run inside Claude Desktop stays deterministic, and
add a "Claude Desktop prose redirect" describe block paralleling the Conductor
cases.

Verified on claude.exe 2.1.197 (Windows): the identical AUQ call that returned
the missing-result error now returns the [claude-desktop] prose-redirect deny.

Co-Authored-By: Claude Opus 4.8 <[email protected]>
@trunk-io

trunk-io Bot commented Jul 1, 2026

Copy link
Copy Markdown

Merging to main in this repository is managed by Trunk.

  • To merge this pull request, check the box to the left or comment /trunk merge below.

After your PR is submitted to the merge queue, this comment will be automatically updated with its status. If the PR fails, failure details will also be posted here

@time-attack

Copy link
Copy Markdown
Contributor

@16francej Closing because blanket Desktop denial unnecessarily suppresses native questions; the neutral pass-through correction in #2165 addresses the failure without changing that flow.

@capy-ai

capy-ai Bot commented Oct 3, 2026

Copy link
Copy Markdown
Contributor

Thanks for this, @kalpajit279. The fix is now on main: the AskUserQuestion preference hook no longer returns permissionDecision 'defer'; it abstains with empty output (hosts/claude/hooks/question-preference-hook.ts) (already on main as of v1.91.16.0). Closing as superseded; if you still see the problem on the latest gstack, please open an issue with ./setup --status output.

@capy-ai capy-ai Bot closed this Oct 3, 2026
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.

2 participants