Repository navigation
fix: Bound affected verification before it becomes a corpus run - #4898
Conversation
…3' into batch/polylogue-20260912-083955-259f513e/integration
|
Important
This repository does not receive automatic reviews because it has fewer than 10 stars. ⚙️ Run configurationConfiguration used: Organization UI Review profile: ASSERTIVE Plan: Advanced Run ID: Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
Codex Review SummaryThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 746ea47d5b
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
…#5802) ## Summary Salvages ChatGPT fleet worker 15 (Codex review debt, beads polylogue-1tyq5.45, .47, .48, .51, .52: devtools parts 4/6/7, docs, nix). Of 79 findings: 13 fixed here, 56 already fixed on master, 4 stale, 6 not reached. The worker's patch was built on snapshot `e1510b53ea`, not master. It was ported hunk by hunk onto current master, keeping the newer OOM attribution and trusted-parent work in `verify.py`, `verify_runs.py`, `run_tests.py` and `pytest_slot.py`. ## Problem - `devtools test --outliers` globbed `last-pytest-*.json` shards. No verifier writes these any more: each pytest step's report is rebound into its run step directory, and only `last-pytest.json` is projected. The command therefore read nothing or stale files (45.01, 45.02). - A focused `devtools test` that got SIGTERM died in `subprocess.run`. It wrote no terminal receipt, history or evidence (45.06). - Queued slot interruptions dropped the start-time worktree provenance (45.08). - When a selected directory was missing, pytest exited 4 (usage error). The missing-path diagnostic only ran on exit 5 (45.10). - The focused verdict printed a checkout-relative receipt path. `main()` has `chdir`ed to ROOT, so the path did not resolve from the caller's directory (45.12). - `canonical_verification_receipt` preferred `final_git_head`. It attributed passing tests to a head that moved under the run and was never executed (45.14). - The verifier's interruption handlers did not cover selection, admission or verdict assembly. A signal there left the run `running` (47.03). - A refused affected plan returned before any static gate ran (47.21). - The Home Manager readiness lane required the removed role-ladder expressions. It rejected the intact module and could not detect a dropped capability switch (47.22). - Pattern help and docs advertised `path:sha1[:count]`, but the parser requires `path:sha1:context_sha1[:count]` (48.01). The SHA-1 anchors used the security-default constructor (48.03). - Reconciliation retried publication only for abandoned runs adopted as failure. A run adopted as success whose first publication was interrupted never reached history (48.20). ## Solution - `print_outliers` selects every pytest lane of the newest completed `--all` receipt (tier `all`, status `success`, `complete_corpus_covered`). It refuses when a lane report is missing. The shard glob, its constant and the verifier's `_clear_full_run_shards` are removed. - `devtools test` installs a SIGTERM handler around the launch. The slot's own handler chains into it after it stops the child. The run finishes with exit 143 and `termination_reason=sigterm`, and the prior handler is restored. - Both slot interruption writers pass the captured `worktree_provenance`. - The missing-path diagnostic runs on exit 4 and exit 5. The "every path exists" hint stays exit-5 only. - Receipt and artifact paths print absolute. - `source_revision` is set only when the ending head equals the executed head. It is also unset when the tree is unknown or dirty. - `_main` runs selection, admission, steps and verdict assembly inside the interruption handlers. Publication (`_finish_and_record_verification`) stays outside so a signal cannot finish a run twice. A refused plan now runs the quick gates through the same path, keeps the first failing gate's exit and diagnosis, and otherwise returns exit 2 with `affected_admission_refused`. - The HM lane checks the three `cfg.mcpEnable*` mappings. - The pattern gate hashes with `usedforsecurity=False`. The help, catalog, regenerated `docs/devtools.md` and `docs/structured-logging.md` name the context-anchor format. - Reconciliation retries publication for abandoned runs adopted as success too. The existing per-run dedup keeps it idempotent. Diverges from the worker: its 47.03 change put publication inside the handler. That could append a second history row for a run already finished. Publication is kept outside, and crash-consistent publication stays with 47.12 (not reached). Its 47.25 change is dropped because master already rejects malformed registries more strictly. ## Verification All through AgentCTL on the pushed head's tree or its immediate predecessor: - `agentctl job start polylogue verify_quick --workspace /realm/worktrees/salvage-w15 --wait`: job 2319 on `75059a9ddc` (rebased head): `verify: PASSED exit=0`. - `agentctl job start polylogue pytest_focused --workspace /realm/worktrees/salvage-w15 --wait -- tests/unit/devtools/test_verification_terminal_receipts.py tests/unit/devtools/test_verify.py tests/unit/devtools/test_run_tests.py tests/unit/devtools/test_verify_patterns.py tests/unit/devtools/test_agent_integration_module.py tests/unit/devtools/test_verify_runs.py tests/unit/devtools/test_verification_evidence_lane.py tests/unit/devtools/test_pytest_slot.py`: job 2300 on `4e72110e57`: `2 failed`, both inherited (see residuals); everything else passed. - After the mypy typing commit: job 2312, `pytest_focused -- tests/unit/devtools/test_verification_terminal_receipts.py tests/unit/devtools/test_verify_patterns.py tests/unit/devtools/test_run_tests.py`: `devtools test: PASSED exit=0`. - Red on master: job 2242 ran the new and changed tests in a detached master worktree (`e14b47662d`) with production code unchanged. Every new regression failed: 13 in `test_verification_terminal_receipts.py`, the sha1 pattern test, the HM lane pass case, both `test_affected_admission_refuses_without_launching_pytest` params and the adapted outliers test. The `ending == executed head` canonical parameter passed there as expected. The same job reproduced the two inherited failures. - Derived-identity closure: scratch job 2202 ran `python -m devtools schema closure` on all 8 changed production files, and every one reported `out`. The same job regenerated `docs/devtools.md` with `devtools render devtools-reference`. ## Self-review - **Sibling sites.** The artifacts line got the same absolute-path fix as the receipt (45.12). `docs/structured-logging.md` carried the same stale anchor spelling (48.01). Both slot interruption writers are fixed (45.08). The verifier's shard clearing was the other half of the dead shard protocol and is removed with the reader. - **Cancellation and shutdown.** The focused SIGTERM handler is installed after the temp-tree guard and restored in `finally`. The held slot's handler restores it and re-signals, so the two chain. Verifier publication is outside the handler, which avoids double finishing. - **Unbounded reads.** The outliers reader globs `runs/*/run.json`, which retention already bounds (8 successful runs). - **Fail-open fallbacks.** Outliers refuse on a missing or malformed lane rather than fall back to older reports. An unknown ending head yields no `source_revision`. - **Compatibility shims.** None. The shard constant and clearing are deleted, not kept alongside. - **Removed symbols.** `PYTEST_PARALLEL_REPORT_PATTERN` and `_clear_full_run_shards` have no remaining references in code, tests or docs. - **Production route.** The tests drive `run_tests.main`, `verify.main`, `pytest_slot._run_launch`, `reconcile_and_record_abandoned_verify_runs`, `verify_patterns.main` and the real lane function. Only host observations (Git, processes, signals) are replaced. ## Findings | key | disposition | evidence | test | |---|---|---|---| | 45.01 #4162 run_tests.py:116 | fixed | shards unwritten since per-step report binding (`verify._bind_pytest_reports_to_step`) | test_verification_terminal_receipts.py::test_outliers_read_all_lanes_of_one_completed_receipt, ::test_outliers_refuse_a_missing_lane_instead_of_falling_back_to_older_reports | | 45.02 #4162 run_tests.py:116 | fixed (same change; worker had fixed-already via shard clearing, which cleared names nobody writes) | receipt-bound selection | ::test_outliers_read_all_lanes_of_one_completed_receipt | | 45.06 #4267 run_tests.py:352 | fixed | no SIGTERM handling on master | ::test_focused_sigterm_finishes_receipt_and_publications | | 45.08 #5544 run_tests.py:427 | fixed | `_write_interrupted_result` lacked provenance | ::test_queued_interruption_keeps_start_time_worktree_provenance | | 45.10 #4343 run_tests.py:485 | fixed | `if rc == 5` only | ::test_focused_missing_directory_has_a_path_specific_usage_diagnostic | | 45.12 #4726 run_tests.py:626 | fixed | `run.relative_run_dir` printed | ::test_focused_verdict_receipt_is_absolute_from_a_nested_invocation | | 45.14 #5544 run_tests.py:649 | fixed | `final_git_head or git_head` | ::test_canonical_receipt_never_attributes_an_untested_ending_head | | 47.03 #4109 verify.py:505 | fixed (publication kept outside; see 47.12) | selection/tail outside `try` | ::test_verifier_finalizes_interruptions_outside_the_step_loop | | 47.21 #4898 verify.py:1019 | fixed | early `return 2` before `build_verify_steps` | ::test_refused_affected_admission_still_executes_static_gates; test_verify.py::test_affected_admission_refuses_without_launching_pytest | | 47.22 #4266 verify_agent_integration.py:472 | fixed | role-ladder tokens absent from module | test_agent_integration_module.py::test_home_manager_lane_checks_independent_capability_switches | | 47.25 #4161 verify_patterns.py:37 | fixed-already (worker claimed fixed) | `_rules` raises on every malformed shape, verify_patterns.py:36-63; test_verify_patterns.py::test_malformed_pattern_registry_fails_closed | none | | 48.01 #4199 verify_patterns.py:59 | fixed | help said `path:sha1[:count]` | generated reference refreshed | | 48.03 #4199 verify_patterns.py:113 | fixed | default-security `hashlib.sha1` | test_verify_patterns.py::test_pattern_entrypoint_marks_sha1_as_non_security_use | | 48.20 #5299 verify_runs.py:1282 | fixed | retry branch matched `status == "failed"` only | ::test_successful_abandoned_adoption_retries_an_interrupted_publication | | 45.22, 45.25, 47.12, 48.05, 48.06, 48.17 | not reached | still open; need design (receipt-bound config, resumable GC, crash-consistent publication, stale-baseline policy, located violations, unknown duration) | none | | 47.08, 47.10, 47.15, 47.20 | stale | code paths removed (`--recompute`/`--commit`, bootstrap selection, parent-root refusal, graph publication) | none | | remaining 55 | fixed-already | worker's line evidence, spot-checked on current master | none | ## Derived-identity closure None. All 8 changed production files are outside the closure (`devtools schema closure`, job 2202). ## Residuals - These two failures reproduce on master `e14b47662d` (job 2242) and are unrelated to this change: - `tests/unit/devtools/test_verification_evidence_lane.py::test_reconciled_abandoned_run_joins_the_durable_lane`: the relocated-cache evidence target conflicts with the test's durable-lane expectation. - `tests/unit/devtools/test_verify.py::test_zero_exit_without_a_report_is_a_failed_pytest_step`: pytest-benchmark options are unrecognized in the free-threaded venv. - A signal that arrives during publication itself still escapes. That is 47.12. - Abandoned runs with no recorded ending head now publish no `source_revision`. This is intended: the head was never observed at the end. 🤖 Generated with [Claude Code](https://claude.com/claude-code) https://claude.ai/code/session_015pdKaZWyGe6Ngvsz468dzg --------- Co-authored-by: Claude Opus 5.5 (1M context) <[email protected]>
|
Closing out open Codex review threads on this PR (evidence checked against master at 64a9bd0):
Resolving every thread listed; confirmed defects are fixed under the named bead. |
Batch
polylogue-20260912-083955-259f513eon basefb43e7df553f.polylogue-y7o73 Bound affected verification before it becomes a corpus run