"""Build submission.json for the OpenEnv Arena. Reads the schema from a running server, so the submitted schema is exactly what GET /schema returns. Tasks come from --tasks (comma list) or a file with one id per line. Usage: python tools/make_submission.py --url http://localhost:18001 --image ghcr.io/syndicate604/science-desk@sha256:... \ --tasks-file runs/selected.txt --id science-desk-v5 --out submission.json """ import argparse import json import sys import httpx sys.path.insert(0, ".") from terminal_desk.families import parse_task_id # noqa: E402 # Copied verbatim from the arena operator's own smoke submission (benchflow/openenv-smoke-fix-git), # so training runs under the budgets the private tasks are believed to use. LIMITS = { "split": "train", "cleanup_grace_s": 30, "completion_tokens": 4096, "context_tokens": 8192, "cpu_floor_vcpus": 1.0, "memory_gib": 2.0, "reset_wall_s": 300, "rollout_wall_s": 902, "tool_calls_inflight": 1, "tool_calls_per_minute": 60, "tool_calls_total": 32, "tool_rate_burst": 4, "tool_wall_s": 110, "verifier_wall_s": 600, "workspace_gib": 10, } def main() -> None: p = argparse.ArgumentParser() p.add_argument("--url", required=True) p.add_argument("--image", required=True) p.add_argument("--id", required=True) p.add_argument("--tasks", default="") p.add_argument("--tasks-file", default="") p.add_argument("--dataset", default="Syndicate604/science-desk") p.add_argument("--name", default="Science Desk") p.add_argument("--out", required=True) a = p.parse_args() ids = [t for t in a.tasks.split(",") if t] if a.tasks else [ ln.strip() for ln in open(a.tasks_file) if ln.strip() and not ln.startswith("#") ] for t in ids: parse_task_id(t) if not 1 <= len(ids) <= 50: raise SystemExit(f"need 1-50 tasks, got {len(ids)}") schema = httpx.get(f"{a.url}/schema", timeout=10).json() sub = { "submission_id": a.id, "name": a.name, "image": a.image, "schema": {"action": schema["action"], "observation": schema["observation"]}, "tasks": [{"task_id": t, **LIMITS} for t in ids], "example_actions": [{"action_type": "exec", "command": "ls -la"}, {"action_type": "evaluate"}], "finish_action": {"action_type": "evaluate"}, "dataset": a.dataset, "source": f"https://huggingface.co/datasets/{a.dataset}", } json.dump(sub, open(a.out, "w"), indent=2) print(f"wrote {a.out}: {len(ids)} tasks, image {a.image}") if __name__ == "__main__": main()