Repository navigation
Credential runner signal test: write with os.write so a signal cannot re-enter the buffered stdout - #601
Conversation
…print The hosted macOS suite failed once on test_exit_code_and_signal_propagate (SIGQUIT subtest, 1 != 9). The fixture printed its readiness line and printed again from its signal handler. When the signal arrives while the interrupted print still holds the buffered stdout, the handler's print raises RuntimeError (reentrant call inside BufferedWriter) and the command exits 1 instead of its code. Both writes now use os.write, which takes no buffer lock. The seven signals, their exit codes and the exact stdout assertion are unchanged; the runner is unchanged. Co-Authored-By: Claude Opus 5.5 <[email protected]>
|
Bounded static reconciliation at Both buffered prints become The only executable-code delta is this test fixture; the second file changes its evidence digest/size. Runner implementation, workflows and runtime configuration are unchanged in the exact comparison. Acceptance is source-only from the existing Astra/max reviewer. No tests, reruns, source changes or host/service operations by this lane. Owner-reported Linux demonstrations are separate evidence; the required actual macOS CI result must bind to this head. Root has no competing repair unit. |
Scope
One test fixture in
tests/test_credential_run.py(ProcessTests.test_exit_code_and_signal_propagate). The fixture's readiness line and its signal handler now write withos.writeinstead ofprint. The seven signals, their expected exit codes, the exact stdout assertion and the runner (scripts/credential_run.py) are unchanged. Lane: foundation.Why: the hosted macOS suite of #592 failed once on this test (run 36946376402, job 110649337077: SIGQUIT subtest,
1 != 9; 9,483 tests, 1 failure). The Codex lane's source diagnosis on #592 named buffered-stream reentrancy as the lead. A handler that prints while the interruptedprintstill holds the buffered stdout raisesRuntimeError: reentrant call inside <_io.BufferedWriter name='<stdout>'>, so the command exits 1 instead of its code. CPython runs signal handlers inside the buffered writer's flush loop (PyErr_CheckSignalsafter a raw write), which is where the window opens.SOTA sources
iomodule, "Reentrancy": buffered objects are not reentrant, and a signal handler that re-enters one raisesRuntimeError(https://docs.python.org/3.13/library/io.html#reentrancy).signalmodule, "Execution of Python signal handlers" (https://docs.python.org/3.13/library/signal.html#execution-of-python-signal-handlers).os.write: an unbuffered write on a file descriptor (https://docs.python.org/3.13/library/os.html#os.write).Evidence-class table
os.writehandler exits with its codevalidate-macoscheck is the observationThe local demonstration forces the window with a blocked write; the hosted failure reached the same window through scheduling. It shows the mechanism, not that it was the cause of that run.
Local commands run
print: exit 1 | RuntimeError: reentrant call inside <_io.BufferedWriter name='<stdout>'>;os.write: exit 9.python3 -B -m unittest tests.test_credential_run.ProcessTests.test_exit_code_and_signal_propagate, 40 runs: 40 passed.python3 -B -m unittest tests.test_credential_run: 92 tests, OK.python3 -B scripts/validate.py: passed, 8,976 hashed files.Both suites ran with the temporary directory outside
/tmp: while Codex sandboxes run on this host, an empty/tmp/.gitmount target appears and the runner correctly refuses a store inside a git work tree (9 of 150 runs of the unmodified test on main exited 1 withunsafe: inside_git_worktreefor that reason). That is a property of this host under load, not of the test.Decision record
None; a test-fixture repair.
Host evidence
None changed.
Checklist
🤖 Generated with Claude Code