#!/usr/bin/env python3 """Compact status for the isolated Codex SDK run1 sweep.""" from __future__ import annotations import json import os from pathlib import Path ROOT = Path(os.environ.get( "PTB_RESULTS_DIR", "/home/jiaruiliu/ptb-data/results_codex_sdk_gpt-5.6-sol_20261006", )) SWEEP = ROOT / "codex_sdk_gpt-5.6-sol_10h_run1" TASKS = ("aime2025", "arenahardwriting", "bfcl", "gpqamain", "gsm8k", "healthbench", "humaneval") MODELS = ( "google/gemma-3-4b-pt", "Qwen/Qwen3-4B-Base", "Qwen/Qwen3-1.7B-Base", "HuggingFaceTB/SmolLM3-3B-Base", ) def tail(path: Path, size: int = 1_000_000) -> str: if not path.is_file(): return "" with path.open("rb") as handle: handle.seek(max(0, path.stat().st_size - size)) return handle.read().decode(errors="replace") def classify(run: Path | None) -> tuple[str, str]: if run is None: return "missing", "-" metrics = run / "metrics.json" if metrics.is_file(): try: data = json.loads(metrics.read_text()) value = data.get("accuracy", data.get("score", "?")) return "complete", str(value) except (OSError, json.JSONDecodeError): return "bad-metrics", "-" if (run / "final_model").is_dir(): return "evaluating", "-" trace = tail(run / "solve_out.txt") if '"type":"turn.failed"' in trace: return "agent-failed", "-" if '"type":"turn.completed"' in trace: return "agent-finished", "-" if '"type":"command_execution"' in trace: return "agent-active", "-" if '"type":"turn.started"' in trace: return "agent-starting", "-" return "starting", "-" def main() -> None: counts: dict[str, int] = {} print(f"results: {ROOT}") print(f"{'TASK':20} {'MODEL':34} {'STATUS':16} SCORE") for model in MODELS: safe_model = model.replace("/", "_") for task in TASKS: runs = sorted(SWEEP.glob(f"{task}_{safe_model}_*")) run = runs[-1] if runs else None status, score = classify(run) counts[status] = counts.get(status, 0) + 1 print(f"{task:20} {model:34} {status:16} {score}") print("summary:", " ".join(f"{key}={counts[key]}" for key in sorted(counts))) if __name__ == "__main__": main()