fix(hooks): Prevent PreToolUse hook from running before attempt_completion tool (#7450)

This commit is contained in:
CandiedUniverse authored and GitHub committed 2025-11-13 16:14:13 -08:00
1 parent 31af254f0a
commit bb375b78ca
2 files changed
+5 -1

No files matched your search

@@ -93,7 +93,7 @@ export class AttemptCompletionHandler implements IToolHandler, IPartialBlockHand
}
// Remove any partial completion_result message that may exist
// PreToolUse hook inserts messages after the partial, so we need to search backwards to find it
// Search backwards since other messages may have been inserted after the partial
const clineMessages = config.messageState.getClineMessages()
const partialCompletionIndex = findLastIndex(
clineMessages,
@@ -25,6 +25,10 @@ export class ToolHookUtils {
return true // Hooks disabled, continue execution
}
if (block.name == "attempt_completion") {
return true // Skip this hook
}
// Import the hook executor dynamically
const { executeHook } = await import("@core/hooks/hook-executor")