diff --git a/scripts/wt-memory-gate-batch b/scripts/wt-memory-gate-batch index 7636b5b..b13a7b3 100755 --- a/scripts/wt-memory-gate-batch +++ b/scripts/wt-memory-gate-batch @@ -20,15 +20,19 @@ # detached git worktree at that sha. The main working tree is worldtree-dev's # and is NEVER checked out, reset or committed to by this script; # - no git commit (worldtree-dev commits the run dirs); -# - no retry. A FAIL is reported the same day with its run stamp. +# - no retry. EVERY verdict (PASS and FAIL) goes to worldtree-dev the same +# day with its run stamp: both build the n for the U11b data-deletion gate +# (three consecutive PASS batches at off, or Prime's waiver). # # Exit codes (the runner acts on these): -# 0 PASS -# 1 FAIL → worldtree-dev, same day, with the run stamp +# 0 PASS → worldtree-dev, same day, with the run stamp +# 1 FAIL → worldtree-dev, same day, with the run stamp; no retry # 2 harness error / no verdict → infra-ops -# 3 refused before running (lock held, a batch already running, sha not -# resolvable, dependency drift between the deployed sha and the tree) +# 3 refused before running (sha not resolvable, dependency drift between +# the deployed sha and the tree, worktree trouble) # → infra-ops; do NOT work around it +# 4 busy: another batch is running (lock held, or a hand-run harness) +# → not a fault; try again later the same day # # Env overrides: # WT_TREE default ~/development/Worldtree @@ -60,18 +64,19 @@ case "${1:-}" in esac refuse() { echo "REFUSED: $*" >&2; echo "→ escalate to infra-ops; do not work around this." >&2; exit 3; } +busy() { echo "BUSY: $*" >&2; echo "→ not a fault: try again later today (never two batches at once)." >&2; exit 4; } now() { date -u +%Y-%m-%dT%H:%M:%SZ; } mkdir -p "$STATE_DIR" # ── 1. one batch at a time ────────────────────────────────────────────────── exec 9>"$LOCK_FILE" -flock -n 9 || refuse "another wt-memory-gate-batch holds $LOCK_FILE" +flock -n 9 || busy "another wt-memory-gate-batch holds $LOCK_FILE" if running="$(pgrep -af 'python -m core\.memory_acceptance\.live' || true)"; [[ -n "$running" ]]; then if [[ "$DRY_RUN" -eq 1 ]]; then echo " (a real run would REFUSE now: a harness batch is already running)" else - refuse "a harness batch is already running (worldtree-dev's?): + busy "a harness batch is already running (worldtree-dev's?): $running" fi fi @@ -164,7 +169,7 @@ echo " run stamp $stamp" echo " verdict ${verdict:-NONE}" echo " line ${verdict_line:-}" case "$verdict" in - PASS) exit 0 ;; + PASS) echo "→ report to worldtree-dev today with run stamp $stamp (PASS builds the n)."; exit 0 ;; FAIL) echo "→ report to worldtree-dev TODAY with run stamp $stamp. Do not retry." >&2; exit 1 ;; *) echo "→ no parseable verdict; escalate to infra-ops with $run_dir." >&2; exit 2 ;; esac