Skip to content

Commit 749a11d

Browse files
web-flowclaude
andcommitted
fix(hooks): pass phase argument from hook ID to observe.sh
The shell wrapper run-with-flags-shell.sh was not extracting the phase prefix from the hook ID (e.g., "pre:observe" -> "pre") and passing it as $1 to the invoked script. This caused observe.sh to always default to "post", recording all observations as tool_complete events with no tool_start events captured. Fixes #1018 Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
1 parent f7f91d9 commit 749a11d

1 file changed

Lines changed: 5 additions & 1 deletion

File tree

scripts/hooks/run-with-flags-shell.sh

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,4 +29,8 @@ if [[ ! -f "$SCRIPT_PATH" ]]; then
2929
exit 0
3030
fi
3131

32-
printf '%s' "$INPUT" | "$SCRIPT_PATH"
32+
# Extract phase prefix from hook ID (e.g., "pre:observe" -> "pre", "post:observe" -> "post")
33+
# This is needed by scripts like observe.sh that behave differently for PreToolUse vs PostToolUse
34+
HOOK_PHASE="${HOOK_ID%%:*}"
35+
36+
printf '%s' "$INPUT" | "$SCRIPT_PATH" "$HOOK_PHASE"

0 commit comments

Comments
 (0)