Skip to content

Tooling: preserve replay assertions despite inherited PYTHONOPTIMIZE - #1299

Merged
Mister-Meeseeks merged 1 commit into
CrocSwap:mainfrom
cbethin:codex/replay-assertion-environment
Oct 14, 2026
Merged

Mister-Meeseeks merged 1 commit into
CrocSwap:mainfrom
cbethin:codex/replay-assertion-environment

Conversation

@cbethin

@cbethin cbethin commented Oct 13, 2026

Copy link
Copy Markdown
Contributor

An inherited PYTHONOPTIMIZE=1 or 2 makes the registered-package launcher print PASS_REGISTERED_RESEARCH_PACKAGE after skipping a verifier's false assertion. This reproduces through the complete CLI with a valid, source-pinned package fixture. With the same files and PYTHONOPTIMIZE=0, that fixture correctly fails.

Remove only PYTHONOPTIMIZE from each launched command's environment. Ordinary Python verifier children and their subprocesses then retain assertion checks. Preserve other environment settings, the caller's environment, command arguments, timeouts, and explicit -O/-OO options for intentional controls. This is a tooling repair; no mathematical result, supplier certificate, frozen source, selected frontier, or kappa changes.

Validation:

  • python3.12 -B -m unittest discover -s tests -p 'test_research_*.py' -v: all 23 tests pass on CPython 3.12.12. They also pass with the test driver launched using -OO.
  • CPython 3.15.0 via the research wrapper: 21 pass, two skip because full generic replay explicitly requires 3.12. The same result holds with inherited PYTHONOPTIMIZE=2. Python.org confirmed 3.15.0 as current stable; 3.12 is a compatibility exception for the pinned replay contract.
  • The new tests execute actual interpreter children, nested children, and the full registered-package CLI. False assertions reject; true assertions pass for environment values empty/0/1/2. Explicit optimization remains observable, the parent's setting is unchanged, and an unrelated environment sentinel survives.
  • Restoring only the original launcher makes all three new test groups fail (seven failing subcases). The unchanged and patched CLI probes use identical fixture bytes. A separate compile(..., optimize=0/1/2) oracle, independent of the launcher, confirms why assertion removal changes the outcome.
  • The selected-record check and all 25 selected-record tests pass. No selected cold replay, hosted CI, Windows execution, or external human review is claimed.

Scope: this prevents accidental optimization inherited from the invoking environment. It does not prevent a manifest from explicitly requesting optimization or verifier code from changing its own subprocess environment. Those remain explicit package-author choices. Python documents the environment/flag behavior at https://docs.python.org/3/using/cmdline.html#envvar-PYTHONOPTIMIZE.

Base bce54fb3f895cbe5cd4c0eb477c3afeed100190f; OS seed 89, verification engineering. Fresh overlap covered 792 open PRs, 44 discussion records and 325 local records with complete remote pagination and no warnings. No pinned coordination issue exists; the scope and evidence are saved locally. PR1298 at e76026571dbfa7299bf474b941c9abeb5bd556b3 independently fixes Windows encoding and timeout behavior. This repair leaves that behavior alone; the shared test import/insertion context needs coordination when combining patches.

Credit Douglas Colkitt for the registered-package tooling and existing fixtures. Apache-2.0 headers remain intact. Prepared for Charles Bethin with substantial OpenAI Codex assistance in diagnosis, implementation, testing, and writing.

@Mister-Meeseeks
Mister-Meeseeks merged commit 79c9731 into CrocSwap:main Oct 14, 2026
61 checks passed
@Mister-Meeseeks

Copy link
Copy Markdown
Contributor

100-PR batch review at 0050ee9f2fa7fec6e3589a92df863c3042073d95.

Merged to main, preserving the original contributor commits and package attribution.

Reviewed scope: Removes inherited PYTHONOPTIMIZE only from replay child environments; explicit -O/-OO controls stay explicit. Nested-interpreter and full CLI regression checks prevent silent assertion bypass.

The pinned scoped command passed; the batch ledger contains its command, input hashes, environment and log. This incorporates the research/tooling contribution and does not change the selected κ or discharge the inherited multiplication-theorem assumptions.

Batch review, attribution and evidence. Thank you for the contribution.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants