#!/usr/bin/env bash
# Runs N Replay turns in the drifted repo and prints wall time per turn.
cd /home/user/wt/factory-issue-37437-triage/apps/server
B=/home/user/wt/factory-issue-37437-triage/.t3
N=${1:-5}
for i in $(seq 1 "$N"); do
  s=$(date +%s.%N)
  node src/bin.ts thread start --base-dir "$B" --provider devReplay --model showcase --wait \
    /tmp/factory-issue-37437-triage/repo "go $i" > /tmp/factory-issue-37437-triage/turn$i.out 2>&1
  rc=$?
  e=$(date +%s.%N)
  printf 'turn %s rc=%s wall=%.1fs\n' "$i" "$rc" "$(echo "$e - $s" | bc)"
done
