capture
genlm.eval.domains.livecodebench.capture
Full per-test execution capture for LiveCodeBench.
run_test calls grade_call_based / grade_stdio as bare module-level
names (testing_util.py lines 476/497), so enable_capture() swaps in instrumented
copies that:
- run every test (never short-circuit at the first wrong answer),
- record each test's input / expected / actual output untruncated (no
truncatefn), - stop only on a hard fault (-3 timeout / -4 runtime error), where the interpreter state after a signal-driven exception is unsafe to keep running,
- carry the per-test records back out through the returned
metadata["executions"](which already flows to the parent via the harness pipe).
The official pass/fail is unchanged: passed_all is all(r > 0 for r in results).
grade_call_based_cap(code, all_inputs, all_outputs, fn_name, timeout)
Instrumented grade_call_based: runs all tests, captures every return value.
Source code in genlm/eval/domains/livecodebench/capture.py
grade_stdio_cap(code, all_inputs, all_outputs, timeout)
Instrumented grade_stdio: runs all tests, captures every stdout untruncated.
Source code in genlm/eval/domains/livecodebench/capture.py
enable_capture()
Swap the vendored grade functions for the capturing copies (idempotent).
The harness child re-enables capture itself, so this need only be set in the parent before grading.
Source code in genlm/eval/domains/livecodebench/capture.py
disable_capture()
Restore the vendored grade functions and clear the flag (inverse of enable_capture).