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
Keep native-query replay assertions active in child processes - #4964
This fixes a verifier failure mode in PR #4952. An isolated Python parent ignores PYTHONOPTIMIZE=1, but its child processes can still inherit that variable and disable their mathematical assertions. The wrapper now removes the variable from each child environment, which also protects descendant processes. Its rejection of an optimized parent remains in place.
All five actual checks passed with that triggering environment. The independent review separately tested real children and grandchildren at all five dispatch sites: all ten probes had optimization level zero and active assertions. Those probes test the environment contract; they do not replace the mathematical replay. The prior independent mathematical review remains applicable because its proof and checker inputs are unchanged. Original review records are retained alongside the new file manifest.
The correction follows the merged head 159dda696ee2004065d250da76d7d2b94a3e4f21. The original package and predecessor credit remain as published in PR #4952. The additional evidence records only this verifier correction; no full supplier replay, Lean run, or hosted CI result is claimed. OpenAI Codex assisted this change and its separate agent review. No human review is claimed.
Independent review at head 9c8c1308b0458b8edd9382b0d62ad28f8478f26e
The fix is correct for the reported mechanism. A probe child started the old way (sys.executable -B, with the inherited environment containing PYTHONOPTIMIZE=1) reports sys.flags.optimize == 1. With the variable popped it reports 0. On Linux with CPython 3.12.14, env PYTHONOPTIMIZE=1 python3.12 -I -B …/verify.py --work <new dir> gives PASS_LEGACY_NATIVE_QUERY_OBSTRUCTIONS checks=5, and all five children exit 0 with their normal output.
A remaining gap of the same kind (suggested follow-up). The children still inherit every other PYTHON* variable. On a child's sys.path, PYTHONPATH comes before the standard library, and the wrapper accepts any child that exits 0. For example, a stray PYTHONPATH directory containing a fractions.py that just calls sys.exit(0) (four of the five checks import fractions) produces:
That PASS appears even though checks 0, 1, 2 and 4 ran nothing: stdout is 0 bytes and stderr shows the shadow message. This is not an adversarial scenario. It is the same "inherited environment silently weakens the replay" failure that this PR fixes for PYTHONOPTIMIZE.
Two small changes would close it:
Start children with -E. They then ignore all PYTHON* variables, including PYTHONOPTIMIZE and PYTHONPATH, while keeping the script directory on sys.path, unlike -I. Also scrub the environment passed on to grandchildren, for example child_env = {k: v for k, v in os.environ.items() if not k.startswith("PYTHON")}. I checked -E on the five children: with both PYTHONPATH=<shadow> and PYTHONOPTIMIZE=1 set, all five ran and passed normally (check-0 stdout 739 bytes, check-3 672 bytes).
Require a success marker from each child, such as its expected final stdout line, rather than exit code 0 alone. Then any early sys.exit(0) fails the wrapper.
I would not hold the PR on this. It strictly improves the wrapper, and the mathematical sources are unchanged. But the README's claim that the wrapper "protects descendant processes" is currently true only for the optimization flag.
This is an author-independent check. It is not maintainer acceptance, and κ is unchanged.
Reviewed by James Reed with substantial Anthropic Claude (Claude Code) assistance.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This fixes a verifier failure mode in PR #4952. An isolated Python parent ignores
PYTHONOPTIMIZE=1, but its child processes can still inherit that variable and disable their mathematical assertions. The wrapper now removes the variable from each child environment, which also protects descendant processes. Its rejection of an optimized parent remains in place.The five-line wrapper change, independent environment review, and fresh mathematical replay receipt bind the correction. The mathematical sources and the scoped lower-bound claims are unchanged. There is no supplier or kappa improvement.
From the repository root, with Python 3 and the standard library, use a new output directory:
Expected final line:
All five actual checks passed with that triggering environment. The independent review separately tested real children and grandchildren at all five dispatch sites: all ten probes had optimization level zero and active assertions. Those probes test the environment contract; they do not replace the mathematical replay. The prior independent mathematical review remains applicable because its proof and checker inputs are unchanged. Original review records are retained alongside the new file manifest.
The correction follows the merged head 159dda696ee2004065d250da76d7d2b94a3e4f21. The original package and predecessor credit remain as published in PR #4952. The additional evidence records only this verifier correction; no full supplier replay, Lean run, or hosted CI result is claimed. OpenAI Codex assisted this change and its separate agent review. No human review is claimed.