Repository navigation
fix: pre-empt broken AskUserQuestion on the Claude Desktop host - #2146
kalpajit279 wants to merge 1 commit into
Conversation
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]>
|
Merging to
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 |
|
@16francej Closing because blanket Desktop denial unnecessarily suppresses native questions; the neutral pass-through correction in #2165 addresses the failure without changing that flow. |
|
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. |
Problem
In the Claude Desktop app,
AskUserQuestionis 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 forisConductor(), so a desktop session falls through todeferand 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 onclaude-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 onCONDUCTOR_*).Tests
Claude Desktop prose redirectdescribe block intest/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).delete env.CLAUDE_CODE_ENTRYPOINTin 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 everydeferinto the prose deny.Verification
On
claude.exe 2.1.197(Windows): the identicalAskUserQuestioncall that previously returned[Tool result missing due to internal error]now returns the[claude-desktop]prose-redirectdenyfrom PreToolUse, so the model renders a prose decision brief instead of hitting the error. Direct hook invocation confirmsdenyfor AUQ anddeferfor non-AUQ tools on the desktop host.🤖 Generated with Claude Code