Repository navigation
fix: Repair the verification evidence channel - #5299
Conversation
width_within divided agentctl-pytest.slice's memory.high -- which charges anon + page cache + slab -- by a per-worker ANONYMOUS RSS constant. The two are not comparable, and the gap is what systemd-oomd killed the corpus for. Model the whole charge through a ChargeProfile: a worker's anonymous peak plus the page cache and slab accounted beside it. The declared width becomes 3 (charge 11,725 MiB against a 12,288 MiB ceiling); 4 would charge 15,275. Correct the constant and its rationale together. The measured anon peak is 582 MiB over 3,318 tests with a plateauing trajectory (423 MiB at 250 tests, 581 at 2,000, 581 at 3,318), so 2263 was 2-3x too high as an anon figure and the comment claiming the peak grows with tests executed was false -- the import floor dominates, and trimming imports IS a lever on width. Document the mirrored-constant coupling: PYTEST_SLICE_MEMORY_HIGH_MIB is a hand-kept copy of the Sinnix declaration with nothing gating the pair. Co-Authored-By: Claude Opus 5 (1M context) <[email protected]> Claude-Session: https://claude.ai/code/session_015WCh9YW3cRfsg3CZBKU7Fq
VerifyRun.__init__ writes status "running" and VerifyRun.finish is the only exit from it, in-process. systemd-oomd sends SIGKILL, which no handler can catch, so a killed run stayed "running" forever and every reader propagated that as legal -- four consecutive scheduled runs were stranded that way. Add reconcile_abandoned_verify_runs beside prune_successful_verify_runs. The owning pid is embedded in the run id, so a receipt with no process behind it becomes terminal with diagnosis verification_abandoned, adopting the AgentCTL .outcome recorded for the same job when one exists. A running receipt with a LIVE owning pid is left alone, and every uncertain liveness answer is "live". Both `devtools verify` and `devtools why` reconcile before reading, and each reconciled run gets the durable history and evidence row finish never wrote. Verified against a copy of the real stranded receipt 20260920T010004Z-all-3331884-73253a64: failed / verification_abandoned / exit 130 / cancelled, adopted from polylogue-verify_all-6e84077f.outcome. Co-Authored-By: Claude Opus 5 (1M context) <[email protected]> Claude-Session: https://claude.ai/code/session_015WCh9YW3cRfsg3CZBKU7Fq
_run_held's stop() ran SIGTERM -> wait(5) -> SIGKILL -> wait(5) BEFORE _on_exit re-raised the signal into verify's handler, so the child reap was guaranteed and the interrupted receipt was not. Observed 2026-09-20 on a cancelled corpus run: Stopping 03:05:26.885 -> Stopped 03:05:36.898, 10.01s of a 15s DefaultTimeoutStopUSec, and the receipt never landed. Both legs are spent in full, not as a worst case: stop() runs inside a signal handler nested in the blocking Popen.wait() that holds _waitpid_lock, so the nested wait(timeout=...) can never acquire it and each leg spins to its own timeout even when the child died at once. Measured: 4.015s for 2 + 2 against the incident's 10.01s for 5 + 5. Name the budget (UNIT_STOP_BUDGET_S, STOP_TERM_GRACE_S, STOP_KILL_GRACE_S), shorten the escalation to 2 + 2 so the majority of the unit budget stays with the receipt-writing handler, bind _run_launch's identical escalation to the same constants, and say in _on_exit's contract that an action there is a tax on the handler above it. Co-Authored-By: Claude Opus 5 (1M context) <[email protected]> Claude-Session: https://claude.ai/code/session_015WCh9YW3cRfsg3CZBKU7Fq
`devtools gate mypy` reported union-attr on `waiter.stderr.close()` in the finally block: the assert that narrowed it sat inside the try. Co-Authored-By: Claude Opus 5 (1M context) <[email protected]> Claude-Session: https://claude.ai/code/session_015WCh9YW3cRfsg3CZBKU7Fq
|
Warning Review limit reachedNext included review available in 29 minutes. View limit detailsLimit details: You’ve used the included review currently available. You've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository. Review configuration: ⚙️ Run configurationConfiguration used: Organization UI Review profile: ASSERTIVE Plan: Advanced Run ID: 📒 Files selected for processing (10)
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: 0d3c1bcae7
ℹ️ 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".
## Summary Three beads: `polylogue-uohdp` (new mechanism, measured), `polylogue-r2lud` and `polylogue-olw5e` (already landed at head — residual tests plus one route). **Cold consumer-reachability gate: 25.6s → 12.3s**, with byte-identical output proven by a differential harness. All six touched files are **OUT** of the derived schema closure. ## The measurement, taken as a same-head pair An earlier pair straddled #5299/#5300/#5301 and was discarded. Both arms below are the **same tree at the same head**; the base arm reverts this commit's three files from `origin/master`. | | total wall | consumer-reachability | |---|---|---| | base | 239.42s | **25.6s** | | head | 224.19s | **12.3s** | Gate alone, cache cleared before each: base `25.12 / 24.34 / 24.58`, head `12.50 / 12.67 / 12.42`. Warm is unchanged at 0.26s both ways — the existing content-digest cache already served it; only the cold path moved. Total-wall delta (−15.2s) exceeds the gate delta (−13.3s) purely because `test-collection` varied between runs. **The gate-level number is the evidence.** ## The bead's diagnosis was partly wrong It attributed the cost to re-parsing every source file with no caching. A fresh partition of the cold path (1,295 modules, 16,286 nodes) measured: `ast.parse` **3.0s**, call-graph edge indexing **9.9s**, reachability traversal **6.7s**, a second full parse for the module-import closure **3.7s**. Parsing was 6.7s of 23.5s. A cross-process content-digest cache also already existed. So the fix is four equivalence-preserving changes, **no new cache and no new cached verdict**: reuse the modules the call graph already parsed; walk the union of entrypoints in one BFS (the tuple names `polylogue.cli` twice and most entries reach the same component); collect a function's imports and calls in one body scan instead of two structurally identical visitors; hoist per-function rebuilds to module level. **AC2–AC5 asked for a per-file content-hash fact cache. I did not build it**, and this is a decision with a measurement rather than a silent omission: parsing is 3.0s of 23.5s, and the dominant edge indexing depends on the global node set so it is not per-file cacheable. If that judgment is wrong the bead should stay open with this measurement attached — **it should not be closed silently on this commit.** The bead's historical 101s-of-214s figure no longer describes this gate. The quick set's dominant cost today is `test-collection` at 88–98s. ## Equivalence proof Both implementations loaded in one process over the same live tree: reachable symbols **18,662**, reachable modules **1,180**, graph nodes **16,286**, and the **full edge map** all identical. Compute 24.12s → 11.79s (2.05x). `reachable_from` matched for 40 randomly sampled roots. ## r2lud and olw5e — already landed `mypy_gate.py` already takes an exclusive `flock` on a shared cache; the prior tests faked `_git_common_dir` and `subprocess.run`, so nothing exercised contention. Added a test with a real checkout plus a linked worktree and a stub checker claiming exclusive entry. Four concurrent lanes against the warm shared cache all exit 0, completing at +0.75 / +1.28 / +1.84 / +2.37s versus 0.78s single-lane — a ~0.55s stagger, the signature of strict serialization. Cold-cache variant **not measured**: clearing the shared cache would have disrupted live sibling workers. `olw5e`'s AC3 premise was wrong — `verify_population_coverage.py` walks no denominator, so there was no re-walk to replace. The real gap was that the coverage route could not see the real source population at all without a live archive. `census_constructs()` now classifies through the **same** classifiers the `source.db` inventory uses (extracted so the two evidence sources cannot drift into two coverage policies), and `resolve_census()` **raises** for an absent, unreadable, foreign or bounded census rather than producing an empty construct list that would read as full coverage. ## Verification `devtools verify --quick` exit 0, all 22 gates. `devtools render all --check` exit 0, `out of sync` count 0. `devtools test tests/unit/devtools`: **1121 passed, 5 failed**. Four anti-vacuity mutations run and reverted, each proven red. ## Inherited failures — all five reproduce on clean master Proven on a detached `origin/master` worktree with its own venv: three `test_cli_acceptance.py` reflow-ratchet failures (root-help and read-help exceed recorded baselines at widths 40/60/80), one `test_verify_provider_completeness.py` (`grok-export/export-json@v1` is *partial*, schema_package missing), and one intermittent `test_pytest_slot.py` telemetry-sidecar flake that asserts `peak pss_kib > 0` for a child exiting immediately against a 0.5s sampler. ## Environment note `uv sync --extra dev --frozen` **prunes the audit group and removes grimp**, making `devtools gate layering` fail with `grimp_unavailable`. The correct incantation is `uv sync --extra dev --group audit --frozen` (audit is a `[dependency-groups]` entry, not an extra). Every number above was measured with grimp present and layering green. 🤖 Generated with [Claude Code](https://claude.com/claude-code) https://claude.ai/code/session_015WCh9YW3cRfsg3CZBKU7Fq --------- Co-authored-by: Claude Opus 5 (1M context) <[email protected]>
… retire unowned span storage (#5302) ## Summary Eight beads. Two live defects found and fixed, three premises found void at head and recorded rather than implemented, one SLO lane measured for the first time. Four production files are IN the derived schema closure — **this must land before any rebuild starts.** Adds a new `root-topology` gate (the quick set is now 23 gates). ## pkst — `record_manual_continuation` was broken on every call Adding the cross-column lineage constraint exposed **two independent defects**, the first masking the second: 1. `api/archive.py` wrote `session_links.status='resolved'`, which `TopologyEdgeStatus` (`repaired`, `quarantined`, `authority-contradicted`) **has never admitted** — so the method raised `sqlite3.IntegrityError` on every call. Reproduced against the real DDL before fixing. The column is now dropped from the INSERT; resolvedness is carried by `resolved_dst_session_id IS NOT NULL`. 2. Its handoff assertion wrote `author_ref='service:polylogue'`, and `service` is not a declared `ObjectRef` kind, so `upsert_assertion` raised on the ref parse. Changed to `actor:`. **Why neither surfaced:** the facade-contract test asserted only the method's *name*. Other facade methods listed there are equally unexercised — a sweep for name-only facade coverage is worth a bead. The new constraint uses `IS`, not `=`: `=` evaluates to NULL for an undecided edge and SQLite passes a NULL CHECK. Both forms were probed. It is deliberately one-directional — prefix-sharing with a NULL anchor stays legal, because the anchor is bound only once the parent's message lands, so a captured claim for an unarrived parent is never rejected. ## sze30 — a retirement marker could be silently invisible `replace_raw_membership_census(..., retire_full_revision_governance=True)` accepted **any** `detail` string while nulling the raw's `logical_source_key` and quarantining it. A marker outside the recognised set made the retirement invisible to revision governance, and a later sibling was then accepted as an unconditional singleton byte-proven baseline. The write boundary now refuses it, placed after the `ActiveByteRevisionChainError` check and before any mutation. A census leaving no membership row keeps free prose, which the two empty-census call sites rely on. ## Premises void at head — recorded, not implemented - **`lbk1` AC1** is *forbidden* by a landed gate. `verify_durable_enum_checks.py` refuses exactly the `nullable_check("status", AssertionStatus)` shape the bead asks for, because pinning an enum into durable DDL makes every later token a durable migration. The single owner is the write boundary. - **`vijnq`**: `grep` for `ci_gate` and its siblings returns **zero matches** — there is no declared claim to diverge from. Took the bead's second branch and recorded the accepted tradeoff in `docs/architecture-spine.md` with the condition that reopens it. No checker built for an empty set. - **`8a060`** orphan class is subsumed by `consumer-reachability`, which flags any new unreached file fail-closed per diff. Recorded in the gate docstring and dropped. Its declared-but-missing and duplicate-declaration classes both need a declaration file that does not exist at head. ## dpm6o — the SLO lane measured, with an honest caveat The bead's stated blocker is void: `devtools bench slo` no longer shells to bare pytest, so it runs inside an agent job (making `polylogue-ubmr5` a closure candidate). Measured p50 against budget, in ms: ``` cli_status_cold 2537 / 500 (catalog baseline records 1.80s) daemon_warm_status 3349 / 400 daemon_mixed_load 3907 / 250 daemon_status_operation 108 / 100 daemon_concurrent_reads 133 / 250 PASS ``` All four over-budget rows are `gate:informational`, three are `tier:lab`, and the catalog itself records `cli_status_cold`'s budget as aspirational. **Stated plainly: the host's pytest pool was serving this batch's other lanes during the run**, so warm and mixed-load are not quiet-host numbers and the cold-start figure needs a clean-host rerun before being treated as a real regression. AC3 stays unsatisfied — whether these graduate from informational is an operator decision. ## b054.1.1.2 — no kill reproduced The replacement anti-vacuity is already met at head by #5299 and was not duplicated. `width_within` divides a cgroup ceiling by a charge profile; live values are slice `MemoryHigh` 12288 MiB, charge 11725 at width 3 and 15275 at width 4. No workstation kill was reproduced and no width changed. ## Verification `devtools verify --quick` — all 23 gates ok. `devtools render all --check` — no `out of sync`. Every added test names its anti-vacuity condition; the `lbk1` carry-forward was proven by mutation (coercing hydrated status to ACTIVE reddens it). Two inherited reds proven on a clean `origin/master` worktree. One inherited red was **fixed forward** because it sits in `lbk1`'s own file: a stale `USER_SCHEMA_VERSION` assertion against the numbered chain #5275 retired. ## Finding worth its own bead `USER_SCHEMA_VERSION = 11` and `SOURCE_SCHEMA_VERSION = 47` **no longer decide anything** — `ARCHIVE_VERSION_BY_TIER` maps those tiers to `ARCHIVE_FORMAT_FLOOR_VERSION`. Yet `test_archive_maintenance_cli.py:1522-1525` asserts a user migration applies `range(11, USER_SCHEMA_VERSION + 1)` against a chain that no longer exists. Not removed here — outside scope and likely to collide. 🤖 Generated with [Claude Code](https://claude.com/claude-code) https://claude.ai/code/session_015WCh9YW3cRfsg3CZBKU7Fq --------- Co-authored-by: Claude Opus 5 (1M context) <[email protected]>
…#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 ef10e59):
Resolving the fixed, stale and refuted threads; tracked threads stay open. |
|
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. |
## Summary Fixes the 15 confirmed Codex P1 findings tracked in polylogue-5gj4u, all in devtools: the xdist worker cap, the durable-write census, the mypy cache seed, the schema-manifest gate, and verification receipts. The previous owner's uncommitted lane state was carried onto current master; this PR finishes the census work, which had left `devtools gate layering` at 158 violations. ## Problem Each row is a Codex review thread confirmed against master 64a9bd0 by triage run `r3-devtools`. The reproductions are in the bead and in each linked thread. ## Solution | Finding | Thread | Disposition | Regression test | |---|---|---|---| | 04.F054 Cap explicit xdist worker requests | [#4540](#4540 (comment)) | Fixed: `resize_worker_argument` reads every `-n`/`--numprocesses` before `--`, resolves `auto`/`logical` through xdist's own hook, writes the capped count into every occurrence, and keeps `--pdb` at 0 | `tests/unit/devtools/test_corpus_worker_memory_bound.py`, `tests/unit/devtools/test_run_tests.py` | | 04.F021 Preserve distinct statement identities | [#5377](#5377 (comment)) | Fixed: a site key carries its occurrence, numbered in source order; alternative texts of one call count once, and statements inside one script count separately. The declaration gains a row for each separate statement (15 rows) | `tests/unit/devtools/test_durable_write_census_regressions.py` | | 04.F022 Track in-memory connections by lexical scope | [#5503](#5503 (comment)) | Fixed: a memory binding exempts only its own scope's single, unconditional binding, and only for statements after it | same file | | 04.F023 Reject unresolved dynamic-helper call targets | [#5503](#5503 (comment)) | Fixed: a missing, computed, or partly unknown table argument becomes an explicit `?` target. A conditional with no readable branch stays "not a string" instead of a hole, so the caller-supplied-SQL helper census keeps seeing it | same file | | 04.F024 Scan runtime DDL in every writer module | [#5503](#5503 (comment)) | Fixed: runtime DDL is observed across `polylogue/storage/**` and in any module that writes a canonical archive table. Private stores that never name an archive table (parser spill databases, the browser-capture registry) stay outside archive state; the delegation scratch graph is declared `disposable_scratch`, which any module may now declare with a reason | same file | | 04.F025 Enumerate every table an executescript creates | [#5503](#5503 (comment)) | Fixed: every `CREATE` in a statement text is classified | same file | | 04.F026 Verify foreign-key cleanup data flow | [#5503](#5503 (comment)) | Fixed: each dynamic write in a cleanup helper must take its identifier and connection from the FK metadata loop (or from the catalog loop plus `PRAGMA foreign_key_list` on the same table and connection) | same file | | 04.F029 Isolate incremental mypy state | [#4807](#4807 (comment)) | Fixed: the gate passes mypy its configured `files` as absolute paths rooted at this checkout, so a sibling's cache entry never matches by path and mypy re-hashes the source | `tests/unit/devtools/test_mypy_daemon_lifetime.py` | | 04.F099 Refuse to compare against HEAD | [#4671](#4671 (comment)) | Fixed: `_merge_base` never falls back to HEAD. On the default branch it uses the first parent; with no comparison history it refuses. The GHA lint job fetches full history, and the CircleCI quick gate fetches master | `tests/unit/devtools/test_verify_schema_manifest.py` | | 04.F100 Validate mandatory train sidecars | [#4671](#4671 (comment)) | Fixed: the evolution gate runs the runtime's own `durable_migration_claims` admission per durable tier; shipped sidecars are immutable like their SQL | same file | | 04.F071 Declare the full verification phase plan | [#4111](#4111 (comment)) | Fixed: the complete plan is built and persisted as `workload_spec` before admission; a refusal or interruption withholds steps from execution, not from the plan. The `finalization` placeholder is removed | `tests/unit/devtools/test_verify.py` | | 04.F072 Do not attribute dirty runs to HEAD | [#4111](#4111 (comment)) | Fixed: a dirty tree is `worktree-sha256:<content>`, an unidentified tree is `None`, and a tree that moved during the run has no build id | same file | | 04.F074 Preserve the workload receipt in AgentCTL output | [#4111](#4111 (comment)) | Fixed: the operation result carries the same `workload_receipt` persisted in run.json | same file | | 04.F075 Record configured pytest concurrency | [#4111](#4111 (comment)) | Fixed: `concurrency` is the widest planned fan-out (gate pool or capped xdist width) | same file | | 04.F098 Re-read the receipt after the owner exits | [#5299](#5299 (comment)) | Fixed: after proving the owner dead, the reconciler re-reads run.json and acts only on a receipt still `running` under the same run id | `tests/unit/devtools/test_verify_runs.py` | No derived-identity closure member changes (devtools, tests, CI, and `docs/plans/durable-write-census.yaml` only). ## Verification All runs through AgentCTL declared operations at head `23f57e45e0` (rebased on master `5d56c3a26f`): - `agentctl job start --workspace /realm/worktrees/polylogue-5gj4u polylogue verify_quick` (job 3393): `verify: PASSED exit=0`. Pre-push quick verify: `verify: PASSED exit=0`. - `agentctl job start --workspace … polylogue pytest_focused -- -n 4 <60 affected test files>` (job 3392): 1156 passed, 14 failed. All 14 are inherited or environment-dependent: - 11 fail identically on master `5d56c3a26f` in a detached worktree (`pytest_focused -- <ids> --on-default-branch`, job 3391): `test_daemon_resilience::test_concurrent_access_safety`, `test_web_reader::test_archive_filter_kwargs_cover_every_storage_lowerable_spec_field`, three in `test_cli_acceptance`, `test_pytest_suite_cost_plugin::test_post_gc_rss_is_read_before_heap_census_allocations`, `test_verification_evidence_lane::test_reconciled_abandoned_run_joins_the_durable_lane`, `test_verification_result::test_projection_uses_the_finalized_step_and_aggregate_counts`, `test_verification_terminal_receipts::test_queued_interruption_keeps_start_time_worktree_provenance`, `test_verify::test_zero_exit_without_a_report_is_a_failed_pytest_step`, `test_retention_probe::test_worker_output_is_qualified_and_retention_ranking_is_separate`. - 3 `test_retention_probe` cases fail only inside the mixed `-n 4` run. The file alone passes them on this branch (job 3398) and on master (job 3397), with the same single inherited failure. - `devtools gate layering`: `gate_passed` (0 semantic violations; 158 before this PR's census work). - Every census, worker-cap, mypy, schema-manifest, and receipt regression named in the table passed in job 3392. ## Self-review Checklists re-read: `docs/review/codex-review-guide.md`, `devtools/AGENTS.md` review rules, and the orchestrate worker contract. Three passes; findings from passes 1 and 2 were fixed here, and pass 3 found nothing new. **Pass 1 findings (fixed):** (a) The census WIP left the declaration unchanged: `devtools gate layering` reported 158 violations. (b) Scanning runtime DDL in every module treated about 60 private spill tables (parser scratch databases, the browser-capture registry, schema journals) as archive state. (c) Occurrences were numbered in `ast.walk` order, so nesting an unrelated statement renumbered sites and could swap their declarations. (d) The `IfExp` change turned a conditional with no string branch into a hole, which hid the `_canonical_schema_inventory_for_ddl` caller-supplied-SQL helper. (e) `_dynamic_table_targets` kept an unused `values`. (f) `ast.AST.lineno` typing. **Pass 2 findings (fixed):** (g) Per-call dedupe collapsed two rewrites inside one `executescript` (a red regression test). (h) The regression module sat outside the scanned layer. 1. ✓ **Siblings and owners.** Census runtime DDL now has one scope rule, `_is_archive_storage_module` or `_writes_archive_table`, used by both `census_package` and `verify_layering._package_pass` through `observe_runtime_ddl` (the `reads_runtime_ddl` pre-filter is deleted from both). The worker-width parser `_worker_requests` is the single reader for the slot; `run_tests` still expands clustered flags first (`test_an_explicit_automatic_width_starts_pytest_at_the_capped_count`). 2. ✓ **The fix itself.** A schema-manifest refusal is a typed `RuntimeError`, which `main()` turns into FAIL/exit 1. `durable_migration_claims` errors become violations, not tracebacks. 3. ✓ **Memory and limits.** No new caps. The worker cap applies the existing memory bound to widths xdist would otherwise resolve after it. 4. ✓ **Cost per unit.** `_writes_archive_table` is one extra pass over each module's calls; the census cost stays linear in module size. 5. ✓ **Interruption.** An interrupted verify run records `status=interrupted` with the declared plan and only the steps it finished. 6. ✓ **Ordering and races.** F098: the reconciler re-reads after the liveness check and acts only on a receipt still `running` under the same run id. 7. ✓ **Failure classification.** A missing schema comparison base is refused rather than compared against itself; a shallow clone says so. 8. ✓ **Silent outcomes.** An unresolved dynamic-helper target is an explicit `?` target that fails the gate rather than being skipped. 9. N/A **Cleanup on failure.** The mypy targets response file is written under the checkout lock and removed after the run; nothing else here acquires resources. 10. ✓ **Identity and keys.** Site keys include a source-order occurrence (`test_occurrences_follow_source_order_across_nesting`). Workload build identity is the commit only for a clean tree, otherwise the content digest. 11. ✓ **Lossless transforms.** `resize_worker_argument` rewrites only width values and keeps every other argument in place. 12. ✓ **Degenerate inputs.** `-n 0` stays no xdist; `-n auto --pdb` becomes 0; `-n64` after `--` is a path, not a width. 13. ✓ **Consumers.** `WriteSite.key` and declaration keys change together (`load_declaration` numbers rows the same way); `reads_runtime_ddl` has no remaining caller (grep 0); `iter_site_payloads` publishes `occurrence`. CI configs fetch the comparison history the gate now requires. 14. ✓ **Tests and stubs.** The `_Run` double in `test_verify_gate_independence.py` gained `declare_workload`/`recorded_git_dirty`; `test_verifier_common_finalizer_adds_receipt_on_early_failure` was removed with the fallback it tested. 15. N/A **Trust boundaries.** No credentials or private data are involved. Generic list: 1. ✓ Each finding has a regression test on the gate's own entry points (`census_package`/`collect_violations`, `resize_worker_argument`, `devtools.verify._main` helpers, `verify_schema_manifest.main`, the real mypy binary for F029). 2. ✓ Sibling search: `grep -rn "reads_runtime_ddl\|_is_archive_tier_runtime_module" devtools tests` finds 0 matches. 3. ✓ The HEAD^ fallback and its test are removed; so are the `finalization` placeholder and the `workload_receipt=None` fallback. 4. ✓ Refusals are typed gate failures with named rules. 5. ✓ Each census regression names its anti-vacuity condition in its docstring. 6. ✓ Fixtures are synthetic: temporary repos and modules only. ## Residuals - The census cannot prove which connection a statement runs on. A module outside `polylogue/storage/` that writes no canonical archive table, yet creates and rewrites a table on an archive connection it was handed, is still unseen. The declared scope is the storage layer plus archive writers. - The mypy gate absolutizes only `files` targets; a config using `packages`/`modules` keeps mypy's stat-trust behaviour (Polylogue uses `files`). - An xdist width injected through configuration (`-o addopts=-n64`, `-c other.ini`) is still invisible to the resizer. - The CircleCI fetch step's first hosted run on this PR is its proof. - The 11 inherited failures above are not fixed here: they fail identically on master and sit outside this PR's scope. 🤖 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]>
Summary
Three defects that between them left the campaign with no usable full-suite evidence since 2026-09-16: pytest width sized from the wrong quantity, receipts stranded forever when a run is killed, and the stop budget spent reaping children instead of writing the receipt.
Closes
polylogue-erupj,polylogue-k37jp,polylogue-su7yt.1. Width was sized from anonymous RSS against a charge-inclusive ceiling
width_withindividedmemory.high— which charges anon + page cache + slab — by an anon-only constant. Measured on a live worker: anon 544 MiB, file 457 MiB (nearly allinactive_file), slab 44 MiB,memory.current1050 MiB — charge/anon 1.93x, ~44% page cache from the suite's own 47–55 GB of scratch writes.Now a frozen
ChargeProfilemodels the whole charge. At the 12 GiB slice it returnsCORPUS_MAX_WORKERS = 3(11,725 MiB, 563 MiB margin); the old form returned 4, whose modelled charge is 15,275 MiB — matching the two observed oomd kills at ~12.4 G.WORKER_PEAK_MIB = 2263is gone. The comment claiming "the rest grows with tests executed, so trimming imports does not recover width" is deleted and replaced — it is falsified by the measured trajectory (250t 423.1 MiB | 1250t 541.6 | 2000t 581.7 | 3318t 581.1: ~53 KiB/test to ~2,000 tests, then flat). The import floor dominates, so trimming imports is a lever on width.2. A SIGKILLed run stranded its receipt as
runningforeverrun.jsonhad one writer and no reconciler, so an oomd kill left a permanently-runningreceipt nothing corrected — while agentctl's.outcomeheld the answer next door.Adds
reconcile_abandoned_verify_runs: a run stillrunningwhose owning pid is gone becomes terminal withverification_abandoned, adopting the agentctl outcome when present. Every uncertain answer about liveness means live. Wired intoverify.pybefore a new receipt is created andwhy.pybefore any read.Proven on a copy of the real stranded receipt
20260920T010004Z-all-3331884-73253a64: reconciled tostatus=failed,exit_code=130,termination_reason=cancelled, adopted from the realpolylogue-verify_all-6e84077f.outcome.3. The stop budget went to reaping children
Escalation shortened to 2 s + 2 s against a named
UNIT_STOP_BUDGET_S = 15.0, with_run_launch's duplicate hand-written bound tied to the same constants so they cannot drift.New mechanism found: both legs are spent in full, not as a worst case.
stop()runs inside a signal handler nested in the blockingPopen.wait()that holds_waitpid_lock, so the nestedwait(timeout=...)can never acquire it and each leg spins to its own timeout even when the child died instantly. Measured 4.015 s for 2+2 — which is exactly why the shipped 5+5 produced the incident's observed 10.01 s.Verification
Every anti-vacuity condition proven red by mutation, then reverted:
worker_anon_mib(the category error)20260920T190821Z-…-f98e326fassert 16 == 3,assert 57875 <= 1228820260920T191304Z-…-08bdbab6assert "running" == "failed"or is_live(pid)guard20260920T191246Z-…-1082812620260920T183242Z-…-89deb7fbthe waiter did not unwind within 6.0sFinal:
113 passedon the four touched test files (20260920T191320Z-…-57ddc252), clean tree.devtools verify --quick— all 22 gates ok, exit 0 (20260920T185932Z-quick-1734856-258fa850).devtools render all --check— exit 0,grep -c 'out of sync'= 0.devtools schema closure— all ten files OUT; nothing here moves the derived schema identity, so landing order is unconstrained.Residuals
tests/unit/devtools, proven pre-existing by reverting all five production files toorigin/master(20260920T184353Z-…-b25d0987):test_verify_provider_completeness.py::test_provider_completeness_human_output_includes_statusand threetest_cli_acceptance.pycases. Not diagnosed; may be a worktree provisioning artifact rather than a master regression.test_rss_trajectory_localizes_growth_to_the_tests_that_caused_itmeasured 8.8 MB against a >100 MB assertion under pool contention;test_a_failed_queued_run_keeps_sizing_telemetry_sidecar). Both pass alone, neither file is touched here. Candidates for aload_sensitivemarker.WORKER_PEAK_CACHE_MIB = 2850is derived, not directly measured — calibrated from 11,776 MiB of charge observed on the 09-17 width-3 run minus controller and anon terms. Page cache from the suite's own writes expands toward whatever ceiling it is given, so this is calibration against observed charge, not a constant of nature. The better fix — capping scratch page cache viafadvise(DONTNEED)/sync_file_rangeon discarded basetemps — is not implemented here and is named in the comment as the term to attack.PYTEST_SLICE_MEMORY_HIGH_MIBremains an ungated hand-kept mirror offlake/data/runtime-defaults.nix. The coupling is documented; nothing enforces it. A real fix is a cross-repo check.verifyandwhy.canonical_verification_receipt()called directly by a third party does not reconcile first.🤖 Generated with Claude Code
https://claude.ai/code/session_015WCh9YW3cRfsg3CZBKU7Fq