Skip to content

Commit 96708e5

Browse files
committed
fix: add confirmation-prompt guard to start-observer.sh (issue anomalyco#400)
- Redirect observer output to temp log before appending to main log - Check temp log for confirmation/permission language immediately after start - Fail closed with exit 2 if detected, preventing retry loops
1 parent 8079d35 commit 96708e5

1 file changed

Lines changed: 12 additions & 3 deletions

File tree

‎skills/continuous-learning-v2/agents/start-observer.sh‎

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -153,8 +153,9 @@ case "${1:-start}" in
153153
exit 1
154154
fi
155155

156-
# The observer loop — fully detached with nohup, IO redirected to log.
157-
# Variables are passed via env; observer-loop.sh handles analysis/retry flow.
156+
# Add strict non-interactive instruction to system prompt (if prompt file or env is used, update there as well)
157+
# If observer output contains confirmation-seeking language, fail closed
158+
OBSERVER_LOG_TMP="${PROJECT_DIR}/.observer.tmp.log"
158159
nohup env \
159160
CONFIG_DIR="$CONFIG_DIR" \
160161
PID_FILE="$PID_FILE" \
@@ -167,11 +168,19 @@ case "${1:-start}" in
167168
MIN_OBSERVATIONS="$MIN_OBSERVATIONS" \
168169
OBSERVER_INTERVAL_SECONDS="$OBSERVER_INTERVAL_SECONDS" \
169170
CLV2_IS_WINDOWS="$IS_WINDOWS" \
170-
"$OBSERVER_LOOP_SCRIPT" >> "$LOG_FILE" 2>&1 &
171+
"$OBSERVER_LOOP_SCRIPT" > "$OBSERVER_LOG_TMP" 2>&1 &
171172

172173
# Wait for PID file
173174
sleep 2
174175

176+
# Check for confirmation-seeking output in the observer log
177+
if grep -E -i -q "Can you confirm|requires permission|Awaiting|confirm I should proceed" "$OBSERVER_LOG_TMP"; then
178+
echo "OBSERVER_ABORT: Confirmation or permission prompt detected in observer output. Failing closed."
179+
cat "$OBSERVER_LOG_TMP" >> "$LOG_FILE"
180+
rm -f "$OBSERVER_LOG_TMP"
181+
exit 2
182+
fi
183+
175184
if [ -f "$PID_FILE" ]; then
176185
pid=$(cat "$PID_FILE")
177186
if kill -0 "$pid" 2>/dev/null; then

0 commit comments

Comments
 (0)