Repository navigation
fix(hooks): question-preference-hook breaks AskUserQuestion in non-interactive sessions (explicit permissionDecision 'defer') - #2165
Closed
dpnascimento wants to merge 1 commit into
Conversation
…rence-hook 'defer' is a real permissionDecision value in Claude Code, but it means 'pause this tool call and hand control back' and is honored in print/non-interactive mode (interactive mode warns and ignores it). The hook emitted it as its 'no opinion' outcome, which made every AskUserQuestion call get deferred in non-interactive sessions (e.g. the Claude Code desktop app): the question UI never rendered and AUQ appeared completely broken after gstack setup registered the hook. The neutral outcome for a PreToolUse hook is a silent exit 0 — so defer() now emits nothing, or only additionalContext (without any permissionDecision) when there is plan-tune memory context to inject. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
|
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 |
This was referenced Jul 14, 2026
Contributor
|
@dpnascimento Please rewrite this version to include the accurate documentation and strict output coverage from PR 1924. Its implementation is otherwise the best current foundation. |
manhit96
pushed a commit
to manhit96/gstack
that referenced
this pull request
Jul 22, 2026
…erence-hook Silent pass-through (exit 0, optional additionalContext only) instead of explicit permissionDecision: 'defer'. Claude Code treats defer as a real pause/resume decision and honors it in print/non-interactive mode, which swallowed every AskUserQuestion (no tool_result, resume replay loops). Fixes the root cause behind garrytan#2006/garrytan#2035/garrytan#2207/garrytan#2292/garrytan#2310. Merges PR garrytan#2165 (print-mode why comment + foundation) with PR garrytan#1924 (passThrough rename, accurate docs, stricter empty-stdout assertions). deny paths (never-ask auto-decide, Conductor prose redirect) unchanged. Co-authored-by: dpnascimento <dpnascimento@users.noreply.github.com> Co-authored-by: jacksondc <jacksondc@users.noreply.github.com>
Contributor
|
Thank you for this fix! The bug it addresses (#2340) has since been fixed on main and the issue is closed, so I'm closing this PR as done. Re-verified against current main (v1.91.12.0). If you think part of your change is still missing, reply and we'll reopen. Really appreciate the contribution. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
After running gstack setup,
AskUserQuestionstops working entirely in non-interactive Claude Code sessions (e.g. the desktop app): the question UI never renders.Root cause: the
question-preference-hookPreToolUse hook emitspermissionDecision: 'defer'as its "no opinion" outcome. Butdeferis a real value in Claude Code with a specific meaning — "pause this tool call and hand control back" — and it is honored in print/non-interactive mode. Claude Code's own strings confirm the split:returned permissionDecision=defer in interactive mode; ignoring (defer is print-mode only)tengu_pre_tool_hook_deferred/hook_deferred_tool)So in any non-interactive session, every AUQ call the hook doesn't auto-decide gets swallowed. Reproduced on Claude Code 2.1.187 (desktop app).
Fix
The neutral outcome for a PreToolUse hook is a silent exit 0.
defer()now:hookSpecificOutput.additionalContext(nopermissionDecisionat all) when plan-tune memory context exists.The
denypaths (never-ask auto-decide, Conductor prose redirect) are unchanged.Tests
Updated assertions across
test/question-preference-hook.test.ts,test/memory-cache-injection.test.tsandtest/skill-e2e-plan-tune-cathedral.test.ts(defer now = nopermissionDecisionin output; additionalContext-only output still covered).bun test test/question-preference-hook.test.ts test/memory-cache-injection.test.ts→ 27 pass / 0 fail.🤖 Generated with Claude Code