Skip to content

Commit 1f74889

Browse files
hrygoclaude
andcommitted
fix: correct TIMESTAMP environment variable syntax in observe.sh
The inline environment variable syntax `TIMESTAMP="$timestamp" echo ...` does not work correctly because: 1. The pipe creates a subshell that doesn't inherit the variable 2. The environment variable is set for echo, not for the piped python Fixed by using `export` and separating the commands: - export TIMESTAMP="$timestamp" - echo "$INPUT_JSON" | python3 -c "..." This ensures the TIMESTAMP variable is available to the python subprocess. Fixes anomalyco#227 Co-Authored-By: Claude Opus 4.6 <[email protected]>
1 parent 4ff6831 commit 1f74889

1 file changed

Lines changed: 4 additions & 2 deletions

File tree

‎skills/continuous-learning-v2/hooks/observe.sh‎

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -103,7 +103,8 @@ PARSED_OK=$(echo "$PARSED" | python3 -c "import json,sys; print(json.load(sys.st
103103
if [ "$PARSED_OK" != "True" ]; then
104104
# Fallback: log raw input for debugging
105105
timestamp=$(date -u +"%Y-%m-%dT%H:%M:%SZ")
106-
TIMESTAMP="$timestamp" echo "$INPUT_JSON" | python3 -c "
106+
export TIMESTAMP="$timestamp"
107+
echo "$INPUT_JSON" | python3 -c "
107108
import json, sys, os
108109
raw = sys.stdin.read()[:2000]
109110
print(json.dumps({'timestamp': os.environ['TIMESTAMP'], 'event': 'parse_error', 'raw': raw}))
@@ -124,7 +125,8 @@ fi
124125
# Build and write observation
125126
timestamp=$(date -u +"%Y-%m-%dT%H:%M:%SZ")
126127

127-
TIMESTAMP="$timestamp" echo "$PARSED" | python3 -c "
128+
export TIMESTAMP="$timestamp"
129+
echo "$PARSED" | python3 -c "
128130
import json, sys, os
129131
130132
parsed = json.load(sys.stdin)

0 commit comments

Comments
 (0)