#!/bin/bash # Queue watcher: launch the engine-math-fixes DSH job once no dsh-run is active # and the retire-planner tree is clean; retries on DSH_QUEUE_BUSY. cd /home/ubuntu/projects/retire-planner || exit 1 LOG=/home/ubuntu/projects/retire-planner/dsh-math-fix.log PROMPT='Read /home/ubuntu/projects/.hermes/plans/2026-10-09_engine-math-fixes-fire40.md FIRST — it is the complete spec for the engine math fixes (GIS age-65 floor, OAS clawback only when OAS payable, couple mixed-phase row footnote, FIRE retirement age 40 with fillDefaults guard). Execute it end-to-end including every acceptance check and the deploy. The user pre-approved every step: ask ZERO questions. When done, MATH-FIX-REPORT.md must exist in the workspace root and your FINAL output line must be exactly: MATH_FIX_DONE (or DSH_QUEUE_BUSY if the git tree was dirty at start).' for i in $(seq 1 240); do if pgrep -f "dsh-run" >/dev/null; then sleep 60; continue; fi if ! git diff --quiet || [ -n "$(git status --porcelain --untracked-files=normal | grep -v '^?? ')" ]; then sleep 60; continue; fi echo "[watcher] launching math-fix job (iteration $i)" | tee -a "$LOG" RUNLOG=$(mktemp /tmp/math-fix-run.XXXXXX) ~/.local/bin/dsh-run /home/ubuntu/projects/retire-planner "$PROMPT" > "$RUNLOG" 2>&1 rc=$? cat "$RUNLOG" >> "$LOG" if grep -q "DSH_QUEUE_BUSY" "$RUNLOG"; then echo "[watcher] queue busy, retrying" | tee -a "$LOG"; rm -f "$RUNLOG"; sleep 60; continue; fi rm -f "$RUNLOG" echo "[watcher] math-fix job finished rc=$rc" | tee -a "$LOG" exit $rc done echo "[watcher] gave up after 240 minutes" | tee -a "$LOG"; exit 1