MCPcopy Create free account
hub / github.com/agentforce314/clawcodex / cmd_run

Function cmd_run

eval/run_compare.py:648–772  ·  view source on GitHub ↗
(args: argparse.Namespace)

Source from the content-addressed store, hash-verified

646
647
648def cmd_run(args: argparse.Namespace) -> int:
649 swebench_repo = _resolve_swebench_repo(args.swebench_repo)
650 swebench_python = _resolve_python("SWEBENCH_PYTHON")
651 openclaude_repo = _resolve_openclaude_repo(args.openclaude_repo)
652 clawcodex_repo = _resolve_clawcodex_repo(args.clawcodex_repo)
653
654 dataset_local = swebench_repo / args.dataset_local
655 if not dataset_local.is_dir():
656 py_hint = _resolve_python("SWEBENCH_PYTHON")
657 raise SystemExit(
658 "Text dataset not found.\n\n"
659 f" Expected directory: {dataset_local}\n\n"
660 "Build it once with:\n\n"
661 f" {py_hint} eval/run_compare.py prepare \\\n"
662 f" --swebench-repo {swebench_repo}\n\n"
663 "That Python must have the `swebench` package (editable install from your "
664 "SWE-bench-dev checkout). For example:\n\n"
665 f" {py_hint} -m pip install -e {swebench_repo} fastapi uvicorn tiktoken transformers\n\n"
666 "Then re-run `run`. If the dataset lives elsewhere, pass "
667 "`--dataset-local <relative-path-under-SWE-bench-dev>`."
668 )
669
670 instance_ids: list[str] | None = None
671 if args.scope == "smoke":
672 instance_ids = list(args.smoke_instances or DEFAULT_SMOKE_INSTANCES)
673 elif args.scope == "instances":
674 instance_ids = [i.strip() for i in args.instance_ids.split(",") if i.strip()]
675 if not instance_ids:
676 raise SystemExit("--scope=instances requires --instance-ids")
677
678 timestamp = datetime.now().strftime("%Y%m%d-%H%M%S")
679 run_id_base = args.run_id or f"compare-{timestamp}"
680 run_dir = (EVAL_DIR / "runs" / run_id_base).resolve()
681 run_dir.mkdir(parents=True, exist_ok=True)
682 paths = RunPaths(run_dir=run_dir, run_id=run_id_base)
683
684 specs = _build_agent_specs(args)
685
686 # Sequential mode: predictions → harness for each agent in turn.
687 summary_paths: dict[str, Path] = {}
688 for spec in specs:
689 _info(f"== {spec.name} ==")
690 env = _server_env(
691 swebench_repo=swebench_repo,
692 clawcodex_repo=clawcodex_repo,
693 openclaude_repo=openclaude_repo,
694 agent=spec.name,
695 )
696 env.update(spec.env_overrides)
697
698 with _spawn_server(
699 swebench_repo=swebench_repo,
700 swebench_python=swebench_python,
701 server_module=spec.server_module,
702 port=spec.port,
703 log_path=paths.server_logs[spec.name],
704 env=env,
705 ):

Callers

nothing calls this directly

Calls 15

load_summaryFunction · 0.90
render_textFunction · 0.90
render_markdownFunction · 0.90
write_disagreement_listsFunction · 0.90
_resolve_swebench_repoFunction · 0.85
_resolve_pythonFunction · 0.85
_resolve_openclaude_repoFunction · 0.85
_resolve_clawcodex_repoFunction · 0.85
RunPathsClass · 0.85
_build_agent_specsFunction · 0.85
_infoFunction · 0.85
_server_envFunction · 0.85

Tested by

no test coverage detected