diff --git a/tools/autoplay-batch.sh b/tools/autoplay-batch.sh index c8746350..eb45ee2c 100755 --- a/tools/autoplay-batch.sh +++ b/tools/autoplay-batch.sh @@ -140,6 +140,19 @@ echo "Parallel: $PARALLEL concurrent seed(s)" echo "Safety timeout: ${SAFETY_TIMEOUT}s per game" echo "============================================================" +# p1-45: Rebuild GDExtension before every local batch so the .so is never stale. +# Remote mode delegates to run_ap3.sh on the remote host, which is expected to +# have a fresh build already (or the caller ran build-gdext.sh manually). +# Uses a timestamped CARGO_TARGET_DIR to avoid collisions on multi-tenant hosts. +if [ -z "$AUTOPLAY_HOST" ]; then + echo "--- p1-45: rebuilding GDExtension before batch (CARGO_TARGET_DIR isolation) ---" + MC_BUILD_STAMP="$(date +%s)" + export CARGO_TARGET_DIR="/tmp/mc-build-${MC_BUILD_STAMP}/target" + (cd "$PROJECT_DIR/src/simulator" && bash build-gdext.sh) + unset CARGO_TARGET_DIR + echo "--- GDExtension rebuild complete ---" +fi + # Start the MCTS service (idempotent — no-op if already running). # Runs only for local batches; remote batches rely on the remote host's # run-services.sh invocation (or service already running on apricot).