Repository navigation
fix(cli): wait for the hash-seed re-exec on Windows instead of os.execvpe (#3799) - #3816
sinangumuskabak-sys wants to merge 1 commit into
Conversation
…cvpe (Graphify-Labs#3799) On Windows os.exec* does not replace the process: CPython spawns a new one and the caller exits at once, so update/extract/cluster-only/label returned before graph.json was written, and the exiting parent intermittently died with an access violation (exit 139). Run the child with subprocess, wait for it and propagate its exit status there; POSIX keeps the real os.execvpe. Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
There was a problem hiding this comment.
Graphify reviewed this change.
Looks safe to merge — no coupling regressions and no blocking issues, checked against the code graph (not a self-assessment).
Formal verification. 1 change(s) tested, no difference found (not proven).
Graphify review — findings
Fixes hash-seed re-exec on Windows, where os.exec* spawns a detached child and returns immediately so the parent exits (sometimes with an access violation) before the work finishes. Routes the re-exec through a new _reexec helper that keeps the real os.execvpe on POSIX but, on Windows, runs the child synchronously via subprocess.run and exits with its return code.
No blocking issues surfaced. 4 lower-confidence candidates did not survive cross-model review.
Analysis details — impact, health, verification
Impact & health
Graphify review
Impact — 218 functions depend on the 34 functions this change touches.
Health — this change adds coupling hotspots:
- new:
main()— 98 callers, 3 callees - new:
dispatch_command()— 2 callers, 125 callees - new:
test_poisoned_manifest_is_healed()— 0 callers, 6 callees
Verification — 218 functions in the blast radius were not formally verified this run (proofs are advisory here).
Gate & verification
graphify gate
PASS — objectively clean (no health regressions, tests not run — proofs not run this pass (advisory)). Grounded, not self-assessed.
Advisory (not blocking):
- verification_scope: 218 function(s) in the blast radius were not formally verified this run
Test selection
Test selection
22 of 300 test file(s) selected (7%) via static blast radius.
tests/test_affected_cli.py— impacttests/test_agents_platform.py— impacttests/test_codebuddy.py— impacttests/test_devin.py— impacttests/test_explain_cli.py— impacttests/test_extract_cli.py— impacttests/test_global_add_tag_inference.py— impacttests/test_god_nodes_cli.py— impacttests/test_hollow_chunks_arm_shrink_guard.py— impacttests/test_incomplete_build_guard.py— impacttests/test_install.py— impacttests/test_install_references.py— impacttests/test_install_version_warning.py— impacttests/test_merge_chunks_validation.py— impacttests/test_multigraph_diagnostics.py— impacttests/test_no_dedup_flag.py— impacttests/test_path_cli.py— impacttests/test_pin_hash_seed.py— impact, changed-testtests/test_query_cli.py— impacttests/test_query_induced_edges.py— impacttests/test_skill_version_warning.py— impacttests/test_unverified_semantic_shrink.py— impact
Selection is safe under the controlled-regression assumption; always-run tests + a periodic full run are the backstops. Advisory — it never changes the check verdict.
Formal verification
No difference found (not proven): No behavior difference found in \_pin\_hash\_seed\_if\_needed (not a proof).
The verifier ran both versions of \_pin\_hash\_seed\_if\_needed on many inputs and saw identical behavior every time. Strong evidence the change is safe, but evidence, not a proof.
Guarantee: Empirical: differential testing (both versions run on many generated inputs). A divergence on an untested input remains possible, so this is 'no counterexample found', not 'proven equivalent'.
Note: An input the sampler did not try could still differ.
· 1 grounded finding(s) anchored inline below; 2 more finding(s) on lines outside this diff (see the check run).
| os.execvpe(argv[0], argv, env) | ||
|
|
||
|
|
||
| def main() -> None: |
There was a problem hiding this comment.
main()
98 callers depend on it (afferent coupling).
Grounded coupling-delta finding (deterministic), not an LLM guess.
Windows hash-seed re-exec wait (#3816/#3799), Terraform secret-named variable-default/output redaction (#3817), COBOL fixed-format sequence-number detection (#3813) and PERFORM...THRU both-endpoint linking (#3814), and gate the GRAPH_REPORT undocumented-components reason on a real semantic layer (#3828/#3801). Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]>
|
Shipped in v0.9.68 (now on PyPI) via an authorship-preserving cherry-pick, so your commit keeps contributor-graph credit. Thanks @sinangumuskabak-sys! Completes the 0.9.67 Windows re-exec fix (spawn-and-wait + exit-code propagation). |
What does this PR do?
Fixes #3799.
On Windows
os.exec*does not replace the process: CPython spawns a new one and the calling process exits immediately. Soupdate/extract/cluster-only/label(the commands that pinPYTHONHASHSEEDvia_pin_hash_seed_if_needed) returned beforegraph.jsonwas written, and the exiting parent intermittently died with an access violation (exit 139 /0xC0000005).This PR moves the re-exec into a small
_reexec(argv, env)helper:os.execvpe.subprocess.run, waits for it, and exits with the child's return code (as suggested in the issue).The existing
OSErrorfallback (keep running without the pin) still applies to both branches.Type of change
How was this tested?
Windows 11, Python 3.12, graphify 0.9.67 (pip
graphifyy), small TSX corpus,PYTHONHASHSEEDunset:Test changes: the subprocess probes now stub
_reexecinstead ofos.execvpe(so on a Windows CI runner they never spawn a real child), and two unit tests cover the POSIXexecvpebranch and the Windows wait-and-propagate branch.Graphify-specific checklist
🤖 Generated with Claude Code