From 1f74889dbfe22c8e264c38525cfafba7c7b3da47 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=BB=84=E9=A3=9E=E8=99=B9?= Date: Sat, 14 Feb 2026 21:25:50 +0800 Subject: [PATCH] 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 #227 Co-Authored-By: Claude Opus 4.6 --- skills/continuous-learning-v2/hooks/observe.sh | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/skills/continuous-learning-v2/hooks/observe.sh b/skills/continuous-learning-v2/hooks/observe.sh index 98b6b9d2..3169aab2 100755 --- a/skills/continuous-learning-v2/hooks/observe.sh +++ b/skills/continuous-learning-v2/hooks/observe.sh @@ -103,7 +103,8 @@ PARSED_OK=$(echo "$PARSED" | python3 -c "import json,sys; print(json.load(sys.st if [ "$PARSED_OK" != "True" ]; then # Fallback: log raw input for debugging timestamp=$(date -u +"%Y-%m-%dT%H:%M:%SZ") - TIMESTAMP="$timestamp" echo "$INPUT_JSON" | python3 -c " + export TIMESTAMP="$timestamp" + echo "$INPUT_JSON" | python3 -c " import json, sys, os raw = sys.stdin.read()[:2000] print(json.dumps({'timestamp': os.environ['TIMESTAMP'], 'event': 'parse_error', 'raw': raw})) @@ -124,7 +125,8 @@ fi # Build and write observation timestamp=$(date -u +"%Y-%m-%dT%H:%M:%SZ") -TIMESTAMP="$timestamp" echo "$PARSED" | python3 -c " +export TIMESTAMP="$timestamp" +echo "$PARSED" | python3 -c " import json, sys, os parsed = json.load(sys.stdin)