Skip to content

Commit a04b0ba

Browse files
committed
Benchmarks: bound orphaned infrastructure from killed runs
Killing the outer harbor process leaves the compose topology and any in-flight Modal sandboxes running (each layer's cleanup lives in the layer above). Cap sandbox idle lifetime at 1h via --ek, and add scripts/cleanup_orphans.sh to tear down task__* containers and terminate sandboxes in the dedicated Modal app.
1 parent 9c9400b commit a04b0ba

5 files changed

Lines changed: 54 additions & 4 deletions

File tree

harness-engineering-bench/gaia/baseline/build.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ rescore_attempts: 1
4646
model: openai/gpt-5.4-mini-2026-03-17
4747
environment_name: ${inner_env:-modal}
4848
# inner eval sandboxes share a dedicated Modal app instead of the __harbor__ default
49-
extra_harbor_args: ["--ek", "app_name=harness-engineering-bench"]
49+
extra_harbor_args: ["--ek", "app_name=harness-engineering-bench", "--ek", "sandbox_idle_timeout_secs=3600"]
5050
harbor_python_version: "3.12"
5151
n_attempts: 1
5252
max_retries: 1

harness-engineering-bench/officeqa/baseline/build.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ model: openai/gpt-5.4-mini-2026-03-17
5454
environment_name: modal
5555
# --no-force-build pulls the prebuilt officeqa-corpus image (see task_source
5656
# note above); the --ek groups inner sandboxes under one dedicated Modal app.
57-
extra_harbor_args: ["--no-force-build", "--ek", "app_name=harness-engineering-bench"]
57+
extra_harbor_args: ["--no-force-build", "--ek", "app_name=harness-engineering-bench", "--ek", "sandbox_idle_timeout_secs=3600"]
5858
harbor_python_version: "3.12"
5959
n_attempts: 1
6060
max_retries: 1
Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,50 @@
1+
#!/usr/bin/env bash
2+
# Tear down orphaned benchmark infrastructure after a killed `vero harbor run`.
3+
#
4+
# Killing the outer harbor process orphans everything below it: the docker
5+
# compose topology (daemon-owned, survives its creator) and any in-flight
6+
# Modal sandboxes (server-side, default 24h timeout). This removes both.
7+
# Scope is strictly ours: `task__*` compose containers locally, and sandboxes
8+
# in the dedicated `harness-engineering-bench` Modal app.
9+
#
10+
# Usage: bash scripts/cleanup_orphans.sh [--dry-run]
11+
# Requires MODAL_TOKEN_ID/MODAL_TOKEN_SECRET in the environment (or a dotenv
12+
# sourced beforehand); skips Modal cleanup if they are absent.
13+
set -euo pipefail
14+
15+
dry_run=false
16+
[ "${1:-}" = "--dry-run" ] && dry_run=true
17+
18+
containers=$(docker ps --format '{{.Names}}' | grep -i '^task__' || true)
19+
if [ -n "$containers" ]; then
20+
echo "orphaned containers:"; echo "$containers"
21+
if ! $dry_run; then
22+
echo "$containers" | xargs docker rm -f
23+
fi
24+
else
25+
echo "no orphaned task__* containers"
26+
fi
27+
28+
if [ -z "${MODAL_TOKEN_ID:-}" ]; then
29+
echo "MODAL_TOKEN_ID not set; skipping Modal sandbox cleanup"
30+
exit 0
31+
fi
32+
33+
uv run --quiet --python 3.12 --with modal python - "$dry_run" <<'PY'
34+
import sys
35+
import modal
36+
37+
dry_run = sys.argv[1] == "true"
38+
try:
39+
app = modal.App.lookup("harness-engineering-bench", create_if_missing=False)
40+
except Exception as error:
41+
print(f"no harness-engineering-bench app: {error}")
42+
raise SystemExit(0)
43+
count = 0
44+
for sandbox in modal.Sandbox.list(app_id=app.app_id):
45+
print(("would terminate" if dry_run else "terminating"), sandbox.object_id)
46+
if not dry_run:
47+
sandbox.terminate()
48+
count += 1
49+
print(f"{count} running sandbox(es) in harness-engineering-bench")
50+
PY

harness-engineering-bench/swe-atlas-qna/baseline/build.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ rescore_attempts: 1
4848
model: openai/gpt-5.4-mini-2026-03-17
4949
environment_name: modal
5050
# inner eval sandboxes share a dedicated Modal app instead of the __harbor__ default
51-
extra_harbor_args: ["--ek", "app_name=harness-engineering-bench"]
51+
extra_harbor_args: ["--ek", "app_name=harness-engineering-bench", "--ek", "sandbox_idle_timeout_secs=3600"]
5252
harbor_python_version: "3.12"
5353
n_attempts: 1
5454
max_retries: 1

harness-engineering-bench/tau3/baseline/build.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ rescore_attempts: 1
4747
model: openai/gpt-5.4-mini-2026-03-17
4848
environment_name: modal
4949
# inner eval sandboxes share a dedicated Modal app instead of the __harbor__ default
50-
extra_harbor_args: ["--ek", "app_name=harness-engineering-bench"]
50+
extra_harbor_args: ["--ek", "app_name=harness-engineering-bench", "--ek", "sandbox_idle_timeout_secs=3600"]
5151
harbor_python_version: "3.12"
5252
n_attempts: 1
5353
max_retries: 1

0 commit comments

Comments
 (0)