From 0ccb8ff9ea6686ca8b0adf3ec552408b4b07ad6b Mon Sep 17 00:00:00 2001 From: YurenHao0426 Date: Wed, 22 Jul 2026 20:24:31 -0500 Subject: audit: bind oral B recovery to D4 gate --- experiments/bci_td_run.py | 17 +++++++++++++---- 1 file changed, 13 insertions(+), 4 deletions(-) (limited to 'experiments/bci_td_run.py') diff --git a/experiments/bci_td_run.py b/experiments/bci_td_run.py index 195bd22..b7948a5 100644 --- a/experiments/bci_td_run.py +++ b/experiments/bci_td_run.py @@ -31,13 +31,14 @@ def sha256(path): return digest.hexdigest() -def provenance(): +def provenance(d4_gate_path): def run(command): return subprocess.run( command, cwd=ROOT, check=True, capture_output=True, text=True).stdout.strip() runner = os.path.relpath(os.path.abspath(__file__), ROOT) protocol = os.path.relpath(PROTOCOL_PATH, ROOT) + d4_gate = os.path.relpath(os.path.abspath(d4_gate_path), ROOT) return { "git_commit": run(["git", "rev-parse", "HEAD"]), "git_tracked_dirty": bool(run( @@ -47,6 +48,10 @@ def provenance(): capture_output=True).returncode == 0 for path in (runner, protocol)), "protocol_sha256": sha256(PROTOCOL_PATH), + "d4_gate_tracked": subprocess.run( + ["git", "ls-files", "--error-unmatch", d4_gate], cwd=ROOT, + capture_output=True).returncode == 0, + "d4_gate_sha256": sha256(d4_gate_path), } @@ -199,9 +204,12 @@ def main(): or d4.get("status") != "passed" or d4.get("review_score_after") != 7): raise ValueError("oral-B R1 requires the complete audited D4 pass") - source = provenance() - if source["git_tracked_dirty"] or not source["runner_and_protocol_tracked"]: - raise RuntimeError("R1 requires clean tracked source and protocol") + source = provenance(args.d4_gate) + if (source["git_tracked_dirty"] + or not source["runner_and_protocol_tracked"] + or not source["d4_gate_tracked"]): + raise RuntimeError( + "R1 requires clean tracked source, protocol, and D4 gate") cfg = build_config(args.eta) trajectories = generate_trajectories(cfg, args.task_seed) @@ -240,6 +248,7 @@ def main(): "confirmation_seeds_touched": False, "evaluation_task_seed": args.task_seed + 200_000, "d4_gate_source": args.d4_gate, + "d4_gate_sha256": source["d4_gate_sha256"], }, "args": vars(args), "config": vars(cfg), "provenance": source, "warmup": warmups, "conditions": conditions, -- cgit v1.2.3