#!/bin/sh # Night chain (2026-10-03), started detached so it survives the Claude Code session. # 1. When filter worker W6A (PID 57253) ends: start W7B (DeepSeek reruns, list in runs/stage1/w7b.txt). # 2. When the T01 test (PID 59414) and all DeepSeek workers end: check T01 in runs/stage1/baseline.json. # No harness error -> remove the T01 entry (it ran with the old budget 40) and run all 25 subset tasks. # 3. macOS notification at each end. Log: runs/stage1/night_chain.log cd "$(dirname "$0")/.." log() { echo "$(date '+%F %T') $*"; } while kill -0 57253 2>/dev/null; do sleep 30; done log "W6A ended; start W7B" nohup xargs python3 -m harness.empirical --model deepseek-v4.1-flash:cloud --run-base 18000 \ < runs/stage1/w7b.txt > runs/emp_deepseek7b.log 2>&1 & W7B=$! log "W7B xargs PID $W7B" while kill -0 59414 2>/dev/null || kill -0 59510 2>/dev/null || kill -0 $W7B 2>/dev/null; do sleep 60; done log "T01 test and DeepSeek workers ended" osascript -e 'display notification "DeepSeek reruns ended" with title "stage1"' OK=$(python3 -c " import json t=json.load(open('runs/stage1/baseline.json'))['tasks'].get('T01',{}) print('yes' if t and 'error' not in t and t.get('score') is not None else 'no')") log "T01 test result usable: $OK" if [ "$OK" != "yes" ]; then osascript -e 'display notification "T01 test failed: baseline not started" with title "stage1"' log "baseline NOT started"; exit 1 fi python3 - <<'PY' import json p='runs/stage1/baseline.json'; r=json.load(open(p)); r.setdefault('t01_test_budget40', r['tasks'].pop('T01')); json.dump(r,open(p,'w'),indent=1) PY log "start baseline, 25 tasks" python3 train/baseline.py --label baseline --run-base 20100 > runs/stage1/baseline.log 2>&1 log "baseline ended: $(python3 -c "import json;print(len(json.load(open('runs/stage1/baseline.json'))['tasks']))") tasks" osascript -e 'display notification "Baseline (25 tasks) ended" with title "stage1"'