Repository navigation
fix(devtools): Derive the tool-outcome denominator from origin declarations - #5340
Conversation
…from their own answer polylogue-b6qba: the tool-outcome routing closure test derived its denominator from `_routed_origin_names()`, so it asserted over exactly the origins already routed and an unrouted declaring origin was invisible by construction. The denominator now comes from the OriginSpec declarations. Measured at 0b1e99d: 9 origins declare a tool-outcome unknown reason and the 25-route table reached 6 of them -- antigravity-session, claude-ai-export and claude-design-session were entirely unrouted, and hermes-session declared `unsupported_construct` with no route. Seven real provider routes close that: antigravity through `parse_trajectory_db`, claude.ai and Claude Design through `parse_ai`/`parse_design`, and Hermes' unread `exit_code`. Claude Design's two declared reasons have no derivation site (its only tool_result emitter hardcodes `is_error=False`), so they are recorded with their evidence in `_UNDERIVABLE_DECLARATIONS`, guarded against going stale in either direction. The two documented `archive tool-outcome-census` examples omitted the parser's required `--archive-root` and exited 2 on a usage error. A new catalog test parses every documented example against its own command's parser (9 examples across 4 commands carry one). polylogue-0gcri: `devtools gate layering` without `--json` died with `KeyError: 'observed'` on its own payload -- the plaintext printer read a per-file-count shape that predates the content-anchored baseline. Masked because the gate table runs `--json`. Two of 243 anchors in docs/plans/sqlite-degradation-baseline.json no longer reproduced and are pruned as legitimate handler removal, not normalization drift: three of watcher.py's four anchors reproduce byte-identically under the same normalizer, and each disappearance lands on the commit that deleted its route (hooks.py at #5225, watcher.py at #5233). Verification: devtools verify --quick -> exit 0, 24 gates green devtools render all --check -> exit 0, no "out of sync" devtools test (3 touched files) -> 104 passed python -m devtools.verify_layering -> exit 0 (KeyError at head) Anti-vacuity executed, not asserted: b6qba: deleting the three claude.ai routes reddens test_every_declaring_origin_reaches_a_provider_route and test_every_declared_reason_is_routed_or_recorded_as_underivable, while test_every_routed_origin_declares_its_reasons (the pre-fix `_routed_origin_names()` shape) stays green on exactly that mutation. 0gcri: restoring `entry['observed']` reddens both new plaintext tests with KeyError; neither passes `--json` on the failing path. Refs: polylogue-b6qba, polylogue-0gcri Co-Authored-By: Claude Opus 5 (1M context) <[email protected]> Claude-Session: https://claude.ai/code/session_015WCh9YW3cRfsg3CZBKU7Fq
|
You have reached your Codex usage limits for security reviews. Please try again later. |
|
Warning Review limit reachedNext included review available in 49 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 (6)
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: 074d0a2809
ℹ️ 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 Test-only salvage of Codex-debt worker 16 (`polylogue-1tyq5.122`). Eight unit tests now fail on the regression each one names, instead of passing on a weaker proxy. No production code changes. ## Problem Hosted review findings on earlier PRs showed that these tests could not catch the defects they claim to guard. For example, the antigravity symlink test used a `.md` path that the conversation walker never considers. The blob-store fsync test also passed with every staged-file fsync removed. The worker's patch arrived truncated. Eight complete test-file diffs were recoverable. The ninth (`test_durable_change_train.py`) was cut off after its header and is not included. ## Solution | key | disposition | evidence | test | |---|---|---|---| | 122.01 #4037 test_migration_load_evidence.py:357 | fixed-kept (reworked) | query continuations are opaque `q2.` tokens (`server_support.py` `_budget_envelope`), so the worker's `arguments["offset"]` read raised KeyError | decodes the token and requires `request.offset == returned_items` | | 122.02 #4037 test_migration_load_evidence.py:460 | fixed-kept | status check rejected only markers | status must contain no seeded session ID either | | 122.08 #5470 test_resource_pilot.py:104 | fixed-kept | `perf_counter` timing test had no `uses_real_clock` marker | marker added with its reason | | 122.09 #5470 test_resource_pilot.py:116 | fixed-kept | receipt went to captured stdout | `emit_receipt("pilot-provider-build-cost")` plus readback | | 122.12 #4788 test_antigravity_source_acquisition.py:187 | fixed-kept | `.md` symlink is never a conversation candidate | symlinked `.pb` next to a regular `.pb`; only the regular one is admitted | | 122.13 #5325 test_cold_build_generation.py:263 | fixed-kept | preflight depended on the runner's free space | `_free_space` pins 512 MiB, and the receipt must record it | | 122.14 #5334 test_finished_build_equivalence.py:183 | fixed-kept | both arms call `backfill_historical_revision_evidence` directly | arms are described as replay configurations; receipt names the executed `callable_identity`; the unexercised `production_driver` labels are removed | | 122.17 #5340 test_tool_result_unknown_reason_contract.py:982 | fixed-kept | a success-only route would demand an unknown declaration | origins come only from routes that expect `UNKNOWN` | | 122.20 #4152 test_blob_store.py:65 | fixed-kept | first `fsync` could be the directory sync | events are classified by `fstat`; the file fsync must precede `replace` | | 122.21 #4976 test_bulk_build_lifecycle.py:615 | fixed-kept | protocol committed per session; production replay passes `manage_transaction=False` (`revision_governance.py:555`) | each arm runs in one caller-owned transaction; a trace callback requires exactly `BEGIN`, `COMMIT` | | 122.22 #4976 test_bulk_build_lifecycle.py:699 | fixed-kept | measurements were dropped after the assertions | `emit_receipt("finished-build-protocol-synthetic")` plus readback | Removed from the worker's patch as tautological: an `any(...)` assertion over the same set it iterated, a test asserting its own marker, and a check that a dict it had just built lacked a key. ## Verification - `agentctl job start polylogue verify_quick --workspace /realm/worktrees/salvage-w16 --wait` → job 2591: `verify: PASSED exit=0 ... head=d35b8dc637d8` - `agentctl job start polylogue pytest_focused --workspace /realm/worktrees/salvage-w16 --wait -- <all 8 files>` → job 2498 (before the 122.01 rework): 198 passed, 4 failed. After the rework, job 2560 on d35b8dc (the five files whose tests had failed or changed since 2498): 138 passed, 2 failed. - The remaining failures are in tests this PR does not touch, and they fail the same way on clean master 1beb2e5 (job 2561, 3 failed): `test_resource_pilot.py::test_parser_resource_needs_only_provider_bytes` and `::test_parser_resource_acquisition_opens_no_archive_tier` (the ChatGPT parser opens `sqlite3.connect(":memory:")` at `chatgpt.py:3017`), and `test_bulk_build_lifecycle.py::test_fresh_shard_build_finishes_equivalent_to_retained_indexes`. - Mutation proof, job 2501: with `_walk_source_paths` following symlinks and the staged fsync removed from `write_from_bytes`, both the new antigravity test and the new blob-store test fail (`2 failed`). ## Self-review - **Sibling sites.** Both status and continuation assertions in the MCP file were reviewed. The three sibling fsync sites in `blob_store.py` share the same event classification, and only `write_from_bytes` is exercised here, as before. - **Cancellation, shutdown, unbounded reads.** Not applicable; no loops or readers were added. - **Fail-open fallbacks and compatibility shims.** None. The retired `_routed_origin_names` and `production_driver` have no remaining references. - **Production route.** Every changed test drives the production callable. 122.14 narrows its claim instead of pretending to exercise drivers it does not call. - **Removed symbols.** `rg _routed_origin_names|production_driver tests` finds no remaining uses. ## Derived-identity closure No production files are touched, so the closure does not move. ## Residuals - Worker 16's 22 claimed fixes for `.120` and `.121` never reached a branch, because the publication connector returned 502. They remain open. - Findings 122.10, 122.11, 122.24 and 122.25 were not reached (122.24 and 122.25 were in the truncated diff), along with the other `.122` and `.123` findings. - The three failures that already occur on master (above) are not addressed here. 🤖 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 bf68918):
Resolving every thread listed; confirmed defects are fixed under the named bead. |
Summary
Two gates that could not do what they claimed: a closure test whose denominator
was its own answer, and a plaintext printer that crashed on every invocation.
1. The closure test iterated its own routed set
It lives at
tests/unit/sources/test_tool_result_unknown_reason_contract.py, notin
devtools/tool_outcome_census.py(that module is 196 lines). It iterated_routed_origin_names()and asserted over exactly the origins already routed, soan unrouted origin was invisible by construction.
Measured at head, and the bead's numbers were wrong: 9 origins declare a
tool-outcome reason, not 10 —
grok-exportnow declares none. The route table has25 routes, not 22, reaching 6 origins. Three declaring origins were
unrouted:
antigravity-session,claude-ai-export,claude-design-session.Per-reason coverage found a fourth gap the origin-level count hides:
hermes-sessiondeclaresunsupported_constructwith no route.The denominator now comes from
origin_specs(). Seven real routes were addedrather than only fixing the check — antigravity via
parse_trajectory_db,claude.ai via
parse_ai, Claude Design viaparse_design, and Hermes's unreadexit_code. Route builders now take aPathso antigravity's SQLite trajectorycan be built.
Claude Design over-declares.
_design_tool_call_blocks(
sources/parsers/claude/ai_parser.py:238) hardcodesis_error=False, and Designcarries no result-status field, so neither declared reason has a derivation
site. Fixing it needs
origin_specs.py, outside this scope. Recorded in_UNDERIVABLE_DECLARATIONSand guarded both ways bytest_no_recorded_underivable_declaration_is_stale, so the record cannot rot ineither direction. Filed separately.
Anti-vacuity executed: deleting the three claude.ai routes reddens the two new
checks, while
test_every_routed_origin_declares_its_reasons— the pre-fix_routed_origin_names()shape — stayed green on that exact mutation.command_catalog.py: both documented census examples omitted the required--archive-rootand exited 2 (reproduced). Fixed, plus a test parsing 9examples across the 4 commands exposing a
_parser— those two were the onlyfailures.
2. The plaintext printer crashed, and the bead misattributed why
Reproduced:
python -m devtools.verify_layering→KeyError: 'observed'at:1277, exit 1.devtools gate layeringforces--json, so the moduleinvocation is the plaintext path — the one a human takes to investigate a failure.
The bead's "54 stale entries in
sqlite-degradation-baseline.json" is amisattribution. 54 is
stale_baseline_count, computed at:1234-1236fromdisallow.baseline— the import-layering ratchet, a separate line that printscorrectly. The sqlite-degradation drift is 2 anchors of 243.
Those two were classified as legitimate handler removal, not normalization
drift, on two independent pieces of evidence:
watcher.pyhas 4 baseline anchors and 3 reproduce byte-identically underthe same normalizer. A drifted normalizer would have moved all four.
the commit that deleted its route:
hooks.pyat 0029ecf (feat: Replace the hook spool with NDJSON carriers acquired by intake #5225 — the file nowhas zero
except sqlite3) andwatcher.pyat ee36023 (feat: Admit intake pages as one batch and delete the watcher chunk route #5233).Pruned exactly those two, which the baseline's own rule permits ("Anchors may be
removed, never added"). No blanket refresh — that would have converted a real
signal into a green baseline, the failure the ratchet exists to prevent.
Anti-vacuity executed: restoring
entry['observed']reddens both new testswith
KeyError, and neither passes--jsonon the failing path.Verification
devtools verify --quick— exit 0, 24 gates (exit read directly, not piped)devtools render all --check— exit 0,grep -c "out of sync"= 0devtools testover the three touched files — 104 passedverify_layering.main()'s plaintext branch overa real degradation baseline, and
origin_specs()→ parser → writer →actions→ envelope for four previously unrouted origins
polylogue/**is untouched.Residuals
disallow.baselinecarries 54 non-reproducing entries — a different ratchet,prints correctly, not classified here.
devtools test "a b c"as one quoted string exits 4(
pytest_no_tests_selected); separate arguments work.Closes polylogue-b6qba and polylogue-0gcri.
🤖 Generated with Claude Code
https://claude.ai/code/session_015WCh9YW3cRfsg3CZBKU7Fq