diff --git a/.agents/scripts/pulse-wrapper.sh b/.agents/scripts/pulse-wrapper.sh index cbd568491..a62df2d91 100755 --- a/.agents/scripts/pulse-wrapper.sh +++ b/.agents/scripts/pulse-wrapper.sh @@ -125,6 +125,8 @@ _sanitize_log_field() { PIDFILE="${HOME}/.aidevops/logs/pulse.pid" LOGFILE="${HOME}/.aidevops/logs/pulse.log" +SESSION_FLAG="${HOME}/.aidevops/logs/pulse-session.flag" +STOP_FLAG="${HOME}/.aidevops/logs/pulse-session.stop" OPENCODE_BIN="${OPENCODE_BIN:-/opt/homebrew/bin/opencode}" PULSE_DIR="${PULSE_DIR:-${HOME}/Git/aidevops}" PULSE_MODEL="${PULSE_MODEL:-anthropic/claude-sonnet-4-6}" @@ -1151,7 +1153,7 @@ ${state_content} local kill_reason="" # Check 0: Stop flag — user ran `aidevops pulse stop` during this cycle (t2943) - if [[ -f "${HOME}/.aidevops/logs/pulse-session.stop" ]]; then + if [[ -f "$STOP_FLAG" ]]; then kill_reason="Stop flag detected during active pulse — user requested stop" # Check 1: Wall-clock stale threshold (hard ceiling) elif [[ "$elapsed" -gt "$PULSE_STALE_THRESHOLD" ]]; then @@ -2422,17 +2424,14 @@ _Auto-generated by pulse-wrapper.sh daily quality sweep. The supervisor will rev # Returns: 0 if pulse should run, 1 if not ####################################### check_session_gate() { - local session_flag="${HOME}/.aidevops/logs/pulse-session.flag" - local stop_flag="${HOME}/.aidevops/logs/pulse-session.stop" - # Stop flag takes priority — user explicitly paused - if [[ -f "$stop_flag" ]]; then + if [[ -f "$STOP_FLAG" ]]; then echo "[pulse-wrapper] Pulse paused (stop flag present) — resume with: aidevops pulse start" >>"$LOGFILE" return 1 fi # Session start flag — explicit user action, always allowed - if [[ -f "$session_flag" ]]; then + if [[ -f "$SESSION_FLAG" ]]; then return 0 fi @@ -2469,8 +2468,7 @@ main() { # Re-check stop flag immediately before run_pulse() — a stop may have # been issued during the prefetch/cleanup phase above (t2943) - local stop_flag_recheck="${HOME}/.aidevops/logs/pulse-session.stop" - if [[ -f "$stop_flag_recheck" ]]; then + if [[ -f "$STOP_FLAG" ]]; then echo "[pulse-wrapper] Stop flag appeared during setup — aborting before run_pulse()" >>"$LOGFILE" return 0 fi