Repository navigation
Description
Summary
The question-preference-hook currently uses a helper named defer() for normal pass-through cases, but that helper returns:
{
"hookSpecificOutput": {
"hookEventName": "PreToolUse",
"permissionDecision": "defer"
}
}That is not equivalent to "no decision." In Claude Code's current hook contract, defer has a specific meaning: pause the tool call so an external caller can resume it later. Claude's docs describe it as intended for claude -p / SDK-style integrations, and say it is only honored in non-interactive mode.
For this hook's ordinary no-op paths, gstack should abstain instead: omit permissionDecision and optionally include additionalContext.
Relevant docs page: https://code.claude.com/docs/en/hooks
Affected local version
- gstack version:
1.56.0.0 - gstack commit:
cab774c(v1.56.0.0 Token-reduction Phase B + AUQ paranoid safety net (#1849)) - Branch:
main - Claude Code version observed locally:
2.1.177 - Hook file:
hosts/claude/hooks/question-preference-hook.ts - Hook wiring:
~/.claude/settings.json,hooks.PreToolUse, matcher(AskUserQuestion|mcp__.*__AskUserQuestion)
User-visible symptom
Every AskUserQuestion card rendered and then failed with:
Tool execution was interrupted
It happened regardless of model or conversation context.
The local patch changed only the pass-through helper so it no longer emits permissionDecision: "defer". After that, a real AskUserQuestion card rendered and accepted a click successfully.
Why this has broad impact
This hook is wired to all AskUserQuestion calls:
{
"matcher": "(AskUserQuestion|mcp__.*__AskUserQuestion)",
"command": "~/.claude/skills/gstack/hosts/claude/hooks/question-preference-hook"
}The helper is used for many normal cases, including:
- empty stdin
- JSON parse failure
- non-
AskUserQuestiontool names - questions with no marker
- no saved preference
always-askpreference- one-way safety override
- ambiguous recommendation parsing
- catch-all error handling
That means users can hit this even with zero saved /plan-tune preferences.
Root cause
In hosts/claude/hooks/question-preference-hook.ts, the pass-through helper used to be:
function defer(additionalContext?: string): void {
const out: Record<string, unknown> = {
hookEventName: 'PreToolUse',
permissionDecision: 'defer',
};
if (additionalContext) out.additionalContext = additionalContext;
process.stdout.write(JSON.stringify({ hookSpecificOutput: out }));
process.exit(0);
}That code appears to intend "no enforcement, let the question proceed." But permissionDecision: "defer" means "pause this tool call for later resume," not "let it proceed normally."
Claude Code docs say:
- PreToolUse supports
allow,deny,ask, anddefer. defermeans the tool call exits withstop_reason: "tool_deferred"so an external caller can collect input and resume later.deferis only honored in non-interactive mode withclaude -p.- For no-decision behavior, hooks should omit a decision or return no output.
Minimal proposed fix
Change the pass-through helper so it emits no permissionDecision:
function defer(additionalContext?: string): void {
const out: Record<string, unknown> = {
hookEventName: 'PreToolUse',
};
if (additionalContext) out.additionalContext = additionalContext;
process.stdout.write(JSON.stringify({ hookSpecificOutput: out }));
process.exit(0);
}The deny() helper should stay as-is, because permissionDecision: "deny" is valid and is the hook's intended enforcement path.
Cleaner proposed fix
Rename the helper from defer() to something like passThrough() or abstain() to avoid confusing the hook's "no enforcement" path with Claude Code's real permissionDecision: "defer" behavior.
Tests and docs that likely need updating
Search results in the installed gstack repo show no other live hook implementation still returning permissionDecision: "defer" after the local patch, but tests and one design note still expect/document it:
test/question-preference-hook.test.tstest/memory-cache-injection.test.tstest/skill-e2e-plan-tune-cathedral.test.tsdocs/spikes/claude-code-hook-mutation.md
Examples:
expect(r.parsed?.hookSpecificOutput?.permissionDecision).toBe('defer');Those expectations should become one of:
expect(r.parsed?.hookSpecificOutput?.permissionDecision).toBeUndefined();or, if the helper is changed to exit silently on paths without additionalContext, assert empty stdout for pure pass-through cases and assert additionalContext only where needed.
Verification from local incident
Confirmed locally:
- The hook was installed and wired to
AskUserQuestionin~/.claude/settings.json. - gstack was at
1.56.0.0, commitcab774c. - Claude Code was
2.1.177. - The old helper returned
permissionDecision: "defer"for normal no-op paths. - The user had no saved preferences, so the enforcement path was not involved.
- The hook error log was empty, so this was not a hook crash.
- After changing the helper to omit
permissionDecision, a realAskUserQuestioncard rendered and accepted a click.
Suggested labels
- bug
- hooks
- AskUserQuestion
- plan-tune
Activity
time-attack commentedon Jul 15, 2026
@16francej — recommend closing this issue only after a current-source fix derived from #1924 passes interactive CLI, print and SDK, Desktop, Conductor, deny-handling, and once-only logging checks. Explicit defer is not neutral pass-through and can interrupt question flows. Preserve the real-host isolation, affected paths, and silent-versus-additional-context contract.
fix(hooks): stop emitting permissionDecision defer from question-pref…
fix(hooks): tighten AUQ pass-through coverage and restore spike docs
v1.61.0.0 fix wave: guards failing open / silent failures (9 fixes, 4…