Repository navigation
fix(devtools): Close nine live P1 findings and name what a worker retains - #5412
Conversation
…ness Triage of 35 P1 review findings at 17566b0; these six reproduce at HEAD. - pytest_slot: a held run signalled at its deadline (the route verify_all and verify_affected take inside the pytest pool) wrote no receipt at all. The handler stopped the child and re-raised, so sampler.stop() and the return value were never reached, and the caller's disposal removed the live telemetry sidecar on the way out. The selected width and the measured peak were lost on exactly the runs whose sizing evidence is worth most. - verify_testmon_selection: the gate's declared anti-vacuity mutation (CORPUS_MAX_WORKERS = 0) left it green, because the produced argument and the expected value both read the same constant. The refusal is now an independent claim about the argument list. - verify_rebuild_routes: a fully qualified `pkg.mod.rebuild_index(...)` call was invisible to the census (only attribute chains rooted directly at an ast.Name were read), and module-wide merging of every import let one function's local import erase another's binding of the same name. Measured over polylogue/: +265 edges, -60 wrong ones. - verify: the blanket `.md` exemption made a change set of only tests/data/golden/chatgpt-simple.md select no pytest, though TestGoldenMarkdownRendering::test_chatgpt_simple_session compares that exact file. The suffix exemption now stops at tests/. - schema_promote: the post-promotion audit inspected the installed polylogue/schemas package, while promotion writes to the registry's data_home()/schemas storage root. - schema_fast_forward: two semicolon-terminated statements on one line were handed to execute() in one call, so a valid transition applied or failed on newline formatting alone. Two inherited reds in tests/unit/devtools/test_verify.py are fixed forward: #5405 added `checkout = "candidate"` to the verify_all operation without updating the two assertions that require the key to be absent. One of them is in DESCRIPTOR_CONTRACT_TESTS, so a descriptor-only verify was red. Verification: devtools gate format/lint/mypy/rebuild-routes green; devtools test over the six changed test files green (.cache/verify/runs/20260922T081111Z-focused-test-1504360-2de9d572 and 20260922T080332Z-focused-test-1486718-9cc77d90). Co-Authored-By: Claude Opus 5 (1M context) <[email protected]> Claude-Session: https://claude.ai/code/session_01ToWqpkXotr573DiQex5vcy
The corpus width is bounded by WORKER_PEAK_ANON_MIB = 4750 against a 12 GiB memory.high, which is why CORPUS_MAX_WORKERS is 2 and a full run takes about 2h43m. Collection is only 583 MiB of that, so ~87% accumulates while the worker runs tests and plateaus near 4 GiB. The existing RSS trajectory says WHERE the growth happens; nothing said WHAT holds it, and resident pages look identical whether something reachable owns them or the collector has not run. POLYLOGUE_SUITE_COST_HEAP adds, at each trajectory point, a forced full collection with resident pages recorded on both sides of it and a census of live objects by type. The pair separates the two cases: pages released by collecting are a collection-policy problem, pages that survive it are retention and heap_top names the type holding them. Opt-in and separate from the O(1) trajectory, because a full gc.collect() plus one pass over gc.get_objects() is not a cost an ordinary managed run should pay. Also renames test_a_later_local_import_does_not_erase_an_earlier_route: its node id was 108 characters, which conftest rewrites to a digest, leaving the test unselectable by id. Verification: devtools test over tests/unit/devtools/test_pytest_suite_cost_plugin.py and test_verify_rebuild_routes.py green (.cache/verify/runs/20260922T084553Z-focused-test-1582357-d8458bc8). Co-Authored-By: Claude Opus 5 (1M context) <[email protected]> Claude-Session: https://claude.ai/code/session_01ToWqpkXotr573DiQex5vcy
Testmon deselects only what it has recorded; an unrecorded test is unknown
and runs. The affected estimate read its count out of the graph alone, so
every test in a file the graph has no execution for was in the launch and in
none of the arithmetic the 1,000-test cap is applied to. A freshly
initialized or interrupted graph therefore reported a bounded plan and
launched the corpus -- the required-check timeout the admission exists to
refuse.
Measured on this checkout at 2026-09-22: 1,353 declared test files, 1,343
with a recorded execution. The 10 missing ones hold 68 tests, none of which
appeared in the admitted count. Pricing them costs one collect-only pass over
those files: 2.2s standalone, 6.3s on a contended host, against the ~646s the
existing determine_stable() estimate already spends.
The estimate now adds them, and the receipt carries the term separately
because the halves are measured differently -- one from the graph, one from a
collection. Above AFFECTED_MAX_UNRECORDED_FILES the graph is not a partial
oracle but an absent one, and the answer is a typed refusal naming the corpus
boundary rather than a longer collection; that refusal is also reached before
the expensive snapshot, so the worst case gets faster.
Verification: devtools gate format/lint/mypy green; devtools test over
tests/unit/devtools/{test_verify,test_verification_admission,test_testmon_provision,test_verify_test_collection}.py
green (.cache/verify/runs/20260922T092806Z-focused-test-1669979-d189781a).
Anti-vacuity executed: reverting the summation makes the estimate report 2 for
a 70-test plan, and dropping the payload term raises KeyError in two cases
(.cache/verify/runs/20260922T092849Z-focused-test-1671723-4c9cf41f).
Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
Claude-Session: https://claude.ai/code/session_01ToWqpkXotr573DiQex5vcy
The production half of the previous commit was lost restoring the tree after
its anti-vacuity mutation: `git checkout -- devtools/` discards unstaged work,
not just the mutation, so only the tests landed. This is that half.
Verification: devtools gate format/lint/mypy green; devtools test over
tests/unit/devtools/{test_verify,test_verification_admission,test_testmon_provision,test_verify_test_collection}.py
green (.cache/verify/runs/20260922T093143Z-focused-test-1683453-b0680ab0),
which is the same selection that was red against the mutated source
(.cache/verify/runs/20260922T092849Z-focused-test-1671723-4c9cf41f).
Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
Claude-Session: https://claude.ai/code/session_01ToWqpkXotr573DiQex5vcy
`_reinspect_unknown_row` returned nothing for two unrelated reasons: the retained blob is gone, or the blob is right there and the row's nullable `detected_provider` names no parser to read it with. The stale-row rule treated every `None` as proof the bytes were unavailable, so a Claude Code `unknown/decode_failed` row at a declared session path -- which `coordinator_session_stream` matches with `parse_policy='session'` -- was marked COVERED by its path alone, with a witness that said "retained blob unavailable" about bytes the archive still holds. The gate passed without inspecting them. The reason is now typed. Only `_BLOB_ABSENT` (no blob tree, or a hash the store does not hold) is a statement about the archive; a resolution failure or an unreadable row says the bytes are still here and this check could not read them, which covers nothing. Verification: devtools gate mypy/format/lint green; devtools gate population-coverage PASS; devtools test over tests/unit/devtools/test_verify_population_coverage.py green (.cache/verify/runs/20260922T094234Z-focused-test-1720717-368d5739). Anti-vacuity executed: restoring `observation is None` makes the new case report 'covered' (.cache/verify/runs/20260922T094254Z-focused-test-1721437-e956522c). Residual: this checkout's gate reports "Inventory: not evaluated (no source.db)", so the change is proven on synthetic fixtures only. Against a real archive it can newly report an uncovered construct -- that would be a true finding this rule was hiding, not a regression. Co-Authored-By: Claude Opus 5 (1M context) <[email protected]> Claude-Session: https://claude.ai/code/session_01ToWqpkXotr573DiQex5vcy
|
Warning Review limit reachedNext included review available in 39 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 (21)
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: 316db12306
ℹ️ 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
Nine live P1 review findings closed in the verification harness, from a triage of all 35 anchored devtools findings, plus the first measurement that actually constrains the pytest worker-memory ceiling.
Triage
14 STALE, 6 WONTFIX, 15 LIVE — of the live, 9 fixed, 3 declined or out of scope, 3 duplicate rows.
Stale + wontfix is 20/35 (57%), well above the ~33% measured in storage and sources. The devtools area has been rewritten more recently, so anchored lines survive while the code around them is gone — three findings pointed at a coverage-reuse mechanism (
_corpus_already_verified,_packages_drift,_reuse_inputs_still_hold) deleted wholesale in #4551. The filter's accuracy is area-dependent, not a single rate.Two findings were declined with the reasoning stated rather than implemented:
_git_common_dir(root)/polylogue-mypy, nothing keys it by checkout) and unfixed. It needs a byte-length + whole-second-mtime collision that could not be produced without fabricating it, andgate mypyis green in every worktree on this host. Reported, not fixed on a story.What is fixed
schema_promote.pyschema_registry()→data_home()/schemas, but the audit readpolylogue.schemas.__path__— it audited a tree promotion does not writeverify.pyselectiontests/data/golden/chatgpt-simple.mdreturned"none", though that file is compared byte-for-byte bytest_ui_visual.py:528verify_testmon_selection.pyCORPUS_MAX_WORKERS, so the gate's own declared mutation left it green — a denominator derived from the thing it checkspytest_slot.pyreceipts_on_exitre-signalled beforesampler.stop()anddispose()unlinked the telemetry sidecar, so a deadline kill left nothingschema_fast_forward.pyA; B;toexecute()in one callverify.pyadmissionverify_population_coverage.pydetected_providerreturnedNoneand was marked COVERED with witness "retained blob unavailable"verify_rebuild_routes.pyaliasesverify_rebuild_routes.pyqualifiedisinstance(node.value, ast.Name)skipped every chain of depth ≥ 2. Measured +265 edgesgate rebuild-routesis green on the branch and the graph change is real: base 59,226 edges → head 59,431, measured by running both module versions againstpolylogue/.The worker-memory ceiling: two levers ruled out
An opt-in heap-retention census was added to the suite-cost plugin (
POLYLOGUE_SUITE_COST_HEAP): at each RSS trajectory point it forces a fullgc.collect(), records resident pages on both sides of it, and censuses live objects by type. Then it was run for real —tests/unit/storage, 3,357 tests, single process, 1,775 s.1. A full collection releases nothing. At 12 of 14 sample points RSS went up after
gc.collect()(the collector's own allocation); the two that freed anything freed 0.4 and 2 MB.The plateau is not uncollected cycles, so a collection-policy change is not the lever.
2. Live object count plateaus while RSS keeps climbing. 490,884 objects at n=250 → ~741k by n=1500 → 722,578 at n=3357 (flat/declining), while RSS rose ~20 MiB over that same span and ~58 KiB/test overall. Past n≈1500 the growth is not reachable Python objects — it is C-side (SQLite page caches, allocator fragmentation). Object-graph pruning is not the lever either.
3. Two named monotonic Python retainers, not previously named:
_pytest.reports.TestReport: 0 → 10,071 (≈3/test — pytest retains every report for the session). At a 15,416-test worker that is ~46k reports.polylogue.schemas.synthetic.relation_solver_runtime._MutualExclusionAnnotation: 0 → 17,425 (≈5/test), plus_StringLengthAnnotation0 → 2,506._PARSED_ANNOTATIONSin that module is bounded at 8 entries, so the holder is downstream of that cache, not the cache.Honest limit, stated rather than smoothed: this directory does not reproduce the 4.7 GiB plateau. It peaked at 547 MiB from an 88 MiB start; linear extrapolation to 15,416 tests gives ~1.3 GiB against the declared
WORKER_PEAK_ANON_MIB = 4750. So either retention is superlinear beyond this range, or concentrated in directories not run, or xdist workers differ from a single process.CORPUS_MAX_WORKERSwas not moved — nothing here justifies it yet.Second ceiling-relevant result: with the receipt fix above, a corpus run killed at its deadline now leaves
pytest-slot-held-<pid>.result.jsoncarrying its chosen width and measured peak, where the retained-artifact globs collect it. Previously those runs left nothing — the sizing evidence was being destroyed precisely on the runs that most needed it. A final sampler reading is now taken in the signal handler, so the receipt records the live peak rather than "no sample observed the process group".Anti-vacuity, executed
A combined run with all six of the first commit's edits reverted at once produced exactly 8 failures and no collateral:
Plus separately for the admission estimator —
assert (2, 68, None) == (70, 68, None),KeyError: 'unrecorded_tests'×2 — and for population coverage,assert 'covered' == 'uncovered'.Each fix also pins the opposite direction so a blanket refusal cannot pass:
test_a_completed_held_run_writes_no_interrupted_receipt,test_the_heap_census_is_off_unless_asked_for,test_an_unasked_unrecorded_term_stays_unknown,test_stale_missing_drive_export_uses_only_its_narrow_path_declaration, andpkg.shadow.harmless not in direct_callers.Verification
Rebased onto
d8a52f5ff.devtools verify --quick→ exit 0, 25/25 gates green (at the lane's original base this was 21 + the then-knowngate atlasred, identical at base and branch; fix(storage): Close seventeen live P1 review findings in the storage tier #5408 has since fixed it on master).devtools render all --check→ exit 0,grep -c 'out of sync'= 0.devtools gate schema-closure→ 0,observed_count 558 == baseline_count 558, added/removed empty.devtools schema closure→ out for every changed production file. Derived identity does not move.Inherited reds fixed forward
test_verify_quick_descriptor_accepts_the_declared_json_projectionandtest_agentctl_parser_preserves_distinct_verification_poolsboth assert"checkout" not in complete, but52c2175db(#5405, the commit immediately before this lane's base) addedcheckout = "candidate"to[operations.verify_all]. Both were red at base. Fixed rather than left, because the first is inDESCRIPTOR_CONTRACT_TESTS— a descriptor-onlydevtools verifywas red on master.Collisions and residuals
durable_write_censusstatement identity — measured at HEAD: 12 keys hold >1 distinct statement, hiding 13 durable rewrites (worst:raw_writes.py::execute_raw_admission_plan_async::raw_sessions::updateat lines 125/176/189). Declined here: a stable discriminator re-keys all 142 entries ofdocs/plans/durable-write-census.yaml, and the 12 collided keys need new per-statement adjudications requiring storage-domain judgement. Exact key list is in the lane report..github/workflows/verify.ymltimeout-minutes: 120vsverify_affected timeout_seconds = 7200. Severity reduced since the workflow is nowworkflow_dispatch:only. Fix site outside this write scope._MutualExclusionAnnotationretention lives inpolylogue/schemas/synthetic/and is adjacent to another lane's file. Not touched; reported with numbers.verify_runs.py:1058still readscovered_by_run, which no code can write since refactor(devtools): excise self-attesting machinery; testmon as one seed #4551 — vestigial, kept because old on-disk receipts may carry it.agent_env.agent_worker_caphas no production caller; only tests reference it.🤖 Generated with Claude Code
https://claude.ai/code/session_01ToWqpkXotr573DiQex5vcy