You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
opencode-claimant hermetic suite: violation gate trips on 5 caught subprocess attempts across four modules #13344
pm-stack/opencode-claimant/run_hermetic_tests.py (the claimant's canonical offline suite; the Makefile test target) currently exits 1 even when every test passes: Ran 226 tests ... OK, then Forbidden external I/O attempted: subprocess.Popen ×5 and a failing exit status. The runner's contract is deliberate — code that catches the guard's exception still attempted real I/O, so the run is not a successful offline check — but five caught attempts across four modules trip it, so the suite cannot report green end-to-end.
Per-module bisect (2026-11-23, worktree bisect harness replicating the runner's guard/env, pristine main ba7ea99e9fe):
Each attempt is a production fail-open path (a subprocess spawn whose failure the code under test catches and converts to a verdict) exercised by a test that does not fake the subprocess boundary.
Suggested disposition
Per case, one of: fake the subprocess boundary in the test (the shape used for the TestCodeSourceFireLog fix landed under #13254), move the test out of the offline suite if its purpose is the spawn-failure path itself, or — only with a recorded rationale — amend the guard's contract. The suite should exit 0 with an empty violation list when this is done.
Found by Lane XS during the #13254 verifier audit (2026-11-23). The two hard test errors that previously accompanied this (TestCodeSourceFireLog spawning real git, from #12813) are fixed under #13254 and are not part of this item; this issue covers only the remaining caught-attempt violation backlog.
Plan: reproduce the hermetic suite's violation-gate failure first-hand, record a per-module verdict (benign caught fail-open attempt vs real violation) for each of the five attempts across the four modules, then fix per the codebase's own conventions — fake the subprocess boundary in the test (the TestCodeSourceFireLog shape from #13254), move a test out of the offline suite only if its purpose is the spawn-failure path itself, or amend the guard contract only with a recorded rationale. The gate will not be blanket-disabled. Done when run_hermetic_tests.py exits 0 with an empty violation list and all tests passing.
Reproduced first-hand at main 9904c3ae8ec: run_hermetic_tests.py → Ran 226 tests ... OK, then Forbidden external I/O attempted: subprocess.Popen ×5, exit 1. Per-test bisect under the runner's own guard/env confirms the issue's attribution exactly (poll and prompt_constants modules: 0 attempts).
Single production source for all five attempts:claimant.log_fire() calls claimant.read_code_source() unconditionally, and that read runs git rev-parse via subprocess.run. It is fail-open by design (#12813 provenance: any git failure is caught and recorded as state "unreadable"; a fire must never abort because its provenance read failed). Each test below drives a fire (via main() or log_fire() directly) without faking that boundary, so the guard's raise is caught by read_code_source and the test passes — while the attempt is still recorded.
Per-test verdicts — all five are benign caught attempts, no real violations:
test_babysitter.pyTestFireWiring.test_fire_log_carries_babysitter_record — purpose is the babysitter record key, not the spawn path.
test_nudges.pyTestFireWiring.test_fire_log_carries_nudges_record — purpose is the nudges record key, not the spawn path.
test/test_claimant.pyReadModeLoudDefaultTests.test_fire_log_entries_carry_the_mode_source — calls log_fire() directly; purpose is the mode_source field, not the spawn path.
None of the five exists to exercise the spawn-failure path, so none moves out of the offline suite. The fail-open spawn behaviour itself stays covered by TestCodeSourceFireLog.test_unreadable_clone_fails_open (faked git, rc=1). The guard's contract is not amended and the gate is not weakened.
Fix shape (the #13254 precedent): fake the subprocess boundary in each of the five tests — patch claimant.subprocess.run with a fake git returning a fixed branch/commit, exactly as TestCodeSourceFireLog._fake_git does — so the fire log still carries a real-shaped code_source entry and no real spawn is attempted.
Lane ZT — done. Landed via PR #13405, merge commit 1310027fd1ffa022d94d5c866fb3a67b1014a53f.
Fix shape (as recorded in the verdicts above): each of the five tests now fakes the subprocess boundary with a fixed branch/commit git stub (_fake_git_run, the TestCodeSourceFireLog shape from #13254), patched in via patch.object(claimant.subprocess, "run", ...). Test files only — no production code, no guard change, no contract amendment; the fire entries still carry a real-shaped code_source, and the fail-open spawn path stays covered by TestCodeSourceFireLog.test_unreadable_clone_fails_open.
Verification:
Pristine main 9904c3ae8ec (before): 226 tests OK + Forbidden external I/O attempted: subprocess.Popen ×5, exit 1.
Branch (laptop): suite exit 0, 226 tests OK, empty violation list; per-test bisect under the runner's own guard/env shows zero attempts in all six modules; affected classes pass standalone (7 + 5 tests, OK).
Remote dispatch: fleet run 45205014988 executed the suite at the branch — success.
Merge commit on main (fresh worktree at 1310027fd1f): suite exit 0, 226 tests OK, no violation line; _fake_git_run present in all four test files.
The gate's protective value is intact: the runner and guard are untouched, and the pre-fix reproduction above shows the gate still trips on a real attempt.
Activity
developing-today commentedon Nov 23, 2026
CODE-4865
fix(opencode-claimant): fake the code_source read in the 5 hermetic c…
dezren39 commentedon Nov 23, 2026
Lane ZT claim — taking this item.
Plan: reproduce the hermetic suite's violation-gate failure first-hand, record a per-module verdict (benign caught fail-open attempt vs real violation) for each of the five attempts across the four modules, then fix per the codebase's own conventions — fake the subprocess boundary in the test (the
TestCodeSourceFireLogshape from #13254), move a test out of the offline suite only if its purpose is the spawn-failure path itself, or amend the guard contract only with a recorded rationale. The gate will not be blanket-disabled. Done whenrun_hermetic_tests.pyexits 0 with an empty violation list and all tests passing.dezren39 commentedon Nov 23, 2026
Lane ZT — reproduction and per-module verdicts
Reproduced first-hand at main
9904c3ae8ec:run_hermetic_tests.py→Ran 226 tests ... OK, thenForbidden external I/O attempted: subprocess.Popen ×5, exit 1. Per-test bisect under the runner's own guard/env confirms the issue's attribution exactly (poll and prompt_constants modules: 0 attempts).Single production source for all five attempts:
claimant.log_fire()callsclaimant.read_code_source()unconditionally, and that read runsgit rev-parseviasubprocess.run. It is fail-open by design (#12813 provenance: any git failure is caught and recorded as state"unreadable"; a fire must never abort because its provenance read failed). Each test below drives a fire (viamain()orlog_fire()directly) without faking that boundary, so the guard's raise is caught byread_code_sourceand the test passes — while the attempt is still recorded.Per-test verdicts — all five are benign caught attempts, no real violations:
test_claimant.pyTestCapUnknownFireLog.test_cap_unknown_logs_cap_room_null_not_sentinel— purpose is thecap_room: nullfield (Act only on a verified read — one seam contract for the opencode-claimant #7770/opencode-claimant(claimant.py): gate-exit logs a hardcoded cap_room 0 — idle fires read as cap-saturated #7732), not the spawn path.test_claimant.pyTestGateExitFireLog.test_gate_exit_logs_cap_room_null_not_zero— purpose iscap_room: nullon gate exit (opencode-claimant(claimant.py): gate-exit logs a hardcoded cap_room 0 — idle fires read as cap-saturated #7732), not the spawn path.test_babysitter.pyTestFireWiring.test_fire_log_carries_babysitter_record— purpose is thebabysitterrecord key, not the spawn path.test_nudges.pyTestFireWiring.test_fire_log_carries_nudges_record— purpose is thenudgesrecord key, not the spawn path.test/test_claimant.pyReadModeLoudDefaultTests.test_fire_log_entries_carry_the_mode_source— callslog_fire()directly; purpose is themode_sourcefield, not the spawn path.None of the five exists to exercise the spawn-failure path, so none moves out of the offline suite. The fail-open spawn behaviour itself stays covered by
TestCodeSourceFireLog.test_unreadable_clone_fails_open(faked git, rc=1). The guard's contract is not amended and the gate is not weakened.Fix shape (the #13254 precedent): fake the subprocess boundary in each of the five tests — patch
claimant.subprocess.runwith a fake git returning a fixed branch/commit, exactly asTestCodeSourceFireLog._fake_gitdoes — so the fire log still carries a real-shapedcode_sourceentry and no real spawn is attempted.dezren39 commentedon Nov 23, 2026
Lane ZT — done. Landed via PR #13405, merge commit
1310027fd1ffa022d94d5c866fb3a67b1014a53f.Fix shape (as recorded in the verdicts above): each of the five tests now fakes the subprocess boundary with a fixed branch/commit git stub (
_fake_git_run, theTestCodeSourceFireLogshape from #13254), patched in viapatch.object(claimant.subprocess, "run", ...). Test files only — no production code, no guard change, no contract amendment; the fire entries still carry a real-shapedcode_source, and the fail-open spawn path stays covered byTestCodeSourceFireLog.test_unreadable_clone_fails_open.Verification:
9904c3ae8ec(before): 226 tests OK +Forbidden external I/O attempted: subprocess.Popen ×5, exit 1.1310027fd1f): suite exit 0, 226 tests OK, no violation line;_fake_git_runpresent in all four test files.The gate's protective value is intact: the runner and guard are untouched, and the pre-fix reproduction above shows the gate still trips on a real attempt.