#!/usr/bin/env bash
# gate-w1c.sh — mutation arms by hand (B's completion witness is a known test defect: it times out
# after serving, so WAIT=60 caps that; A's cells are the verdict) then the cross-box baseline.
set -u
GW=/c/Users/decid/Documents/projects/spt-core/.worktrees/gate-w1-26a96d58
OUT=$GW/.spt/gate-doyle; cd "$GW" || exit 9
export CARGO_TARGET_DIR='C:\Users\decid\Documents\projects\spt-core\.worktrees\ws272-w1\target'
unset OWL_SESSION_ID SPT_AGENT_ID SPT_ENDPOINT_ID SPT_HOME SPT_POOL_UNCHECKED
leg() { local n=$1; shift; echo "[$(date -u +%H:%M:%SZ)] LEG $n START" >> "$OUT/driver.log"; "$@" > "$OUT/$n.raw" 2>&1; local e=$?; echo "$e" > "$OUT/$n.exit"; echo "[$(date -u +%H:%M:%SZ)] LEG $n EXIT $e free_gb=$(df -BG --output=avail /c 2>/dev/null | tail -1 | tr -dc 0-9)" >> "$OUT/driver.log"; }
echo "gate-w1c arms+xbox at $(git rev-parse --short HEAD) dirty=$(git status --short -uno | wc -l) $(date -u +%FT%TZ)" >> "$OUT/driver.log"
WAIT=60 leg pair-mutA2 bash .spt/twohost-web-local.sh "$GW" mutA2 A
WAIT=60 leg pair-mutB  bash .spt/twohost-web-local.sh "$GW" mutB B
WAIT=120 leg xbox-none bash .spt/twohost-web-xbox.sh "$GW" /home/reavus/spt-w1/.worktrees/ws272-w1 none none
echo "[$(date -u +%H:%M:%SZ)] ARMS+XBOX DONE dirty=$(git status --short -uno | wc -l)" >> "$OUT/driver.log"
