Repository navigation
chore: Retire the read-surface contracts package and schedule the corpus - #5196
Conversation
polylogue/api/contracts/ declared a Protocol family (ReadSurface and its seven per-operation protocols) plus assert_implements, intended to pin read-surface parity by structural conformance. Its shadow adapters were deleted two days after shipping (#1329), the write-surface half followed in #2900, and its last implementor, TUIReadSurface, went with the TUI in #5182. At head nothing outside the package imports polylogue.api.contracts, assert_implements has zero call sites, and no doc, atlas citation or generated surface names it. Parity is owned instead by operation identity (polylogue/api/parity.py, devtools gate api-parity) and by the four-surface behavioral differentials in tests/infra/surface_differential.py. Retirement is authorized on polylogue-aq2l5. ArchiveReadCapability is unaffected; its home is polylogue/api/archive_reads.py. Verification: devtools verify --quick (all 19 gates ok, including layering and api-parity); devtools test tests/unit/api tests/unit/core/test_facade_api.py (PASSED); devtools render all --check (exit 0, no "out of sync"). Layering baselined_count unchanged at 226 -- contracts held no baseline entry, so the ratchet did not grow. Co-Authored-By: Claude Opus 5 (1M context) <[email protected]> Claude-Session: https://claude.ai/code/session_01DYUNBGoE652b3nfmq3CtqK
The full corpus had no scheduling mechanism: hosted CI is the quick gate only and .github/workflows/verify.yml is workflow_dispatch-only, so the corpus ran only when someone fired it by hand -- which produced 12 failed ad-hoc verify_all jobs since 2026-09-13. Declare schedule = "*-*-* 03:00" on [operations.verify_all]. agentctl schedule apply reconciles it into a transient user timer firing `agentctl job fire polylogue verify_all`; the primitive already exists and is live for sinnix's [operations.census]. The "one run per change, never per PR" property comes from rules already set on this operation rather than a counter: fire() skips while the same operation is queued or running, cache = "tree+environment" reuses a launch whose committed tree and environment receipt match (so a package change is a tree change and does run, an unchanged master does not), and checkout = "default" pins it to the master checkout. Those three keys are unchanged. 03:00 avoids the 04:25 SQLite-backup and 06:04 borg timers. pytest-heavy is exclusive_with ["agent"], so the ~90-minute run freezes the agent pool -- which is why it is one fixed off-hour rather than per-merge. verify.yml's header claimed a nightly agentctl verify_all schedule that was never declared; it now describes the schedule this commit declares. concurrency.cancel-in-progress stays true, deliberately -- it is moot under workflow_dispatch. Ruled on polylogue-yk0zz want 4. `agentctl schedule apply` is not run here; the coordinator applies it after this lands. Verification: devtools verify --quick (all 19 gates ok). Co-Authored-By: Claude Opus 5 (1M context) <[email protected]> Claude-Session: https://claude.ai/code/session_01DYUNBGoE652b3nfmq3CtqK
|
You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard. |
|
Warning Review limit reachedNext included review available in 7 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 (5)
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. |
…5201) ## Summary **Master was red.** Three `TestCockpitAggregateRoutes` tests patched legacy outcome columns by SQL after writing, which #5195 made inert. Fixed at the test layer — no production code changed. ## What was actually wrong My first diagnosis was that `result_state` was returning `no_result` because the tool_use↔tool_result pairing by `tool_id` had failed. **That was wrong**, and the probe that disproved it also explains why my own attempted fix (also setting `tool_outcome` on the result block) did nothing: `actions` is a view over a **materialized `action_pairs` table**, not a live join, and its `result_state` comes from `action_pairs.tool_outcome` — the outcome captured at write time on the tool_use side. Any post-write `UPDATE blocks …` is inert against it. On a fresh archive built from the exact fixture: ``` BLOCKS: …:n:m:0 tool_use tool-evidence unknown …:n:m:1 tool_result tool-evidence unknown ACTIONS: …:n:m:0 …:n:m:1 outcome_unknown ← pairing fine, result_block_id NOT NULL AFTER legacy-only UPDATE (is_error=1, exit_code=0): outcome_unknown AFTER also setting tool_outcome='ok' on the result: outcome_unknown ``` No `no_result`, no pairing problem, no endpoint-mapping problem. `polylogue/storage/sqlite/action_relation.py` is not involved and was not touched. The old parametrization also encoded the legacy SQL's precedence rather than any intent: `(is_error=1, exit_code=0) → ok` is self-contradictory evidence that the production derivation refuses outright. ## Solution Outcomes are now built through the production route — on the `ParsedContentBlock` passed to `write_index_session` — instead of SQL-patched afterwards: - `test_evidence_summary_matches_structural_tool_relations`: consistent parser evidence (`is_error=True, exit_code=2 → failed`; `is_error=False, exit_code=0 → ok`), SQL `UPDATE` removed. Still protects "a genuinely-ok call reports ok, a genuinely-failed one reports failed, through canonical `result_state`". - **New** `test_evidence_summary_reports_a_distrusted_result_as_unknown`: writes `outcome_unknown_reason="not_reported"`, then *deliberately* patches the legacy pair to `(is_error=0, exit_code=0)` and asserts `{"ok":0,"failed":0,"unknown":1}`. This pins the defect #5195 fixed — reverting to exit-code derivation turns it red. - `test_evidence_summary_composes_prefix_sharing_tool_evidence`: parent tool_result carries its outcome at parse time; inert post-write UPDATE removed. Still asserts inherited `ok:1` across the composed prefix. - Incidental repair: restored `parent_id = write_index_session(…)` in `test_session_read_page_renders_lineage_banner_for_fork_family`, clipped by a first-pass string replace and caught by the wider run before commit. ## Verification ``` devtools test "tests/unit/daemon/test_web_reader.py::TestCockpitAggregateRoutes" → PASSED exit 0 devtools test tests/unit/daemon/test_web_reader.py tests/unit/daemon/test_daemon_http.py → PASSED exit 0 devtools verify --quick → exit 0, all 19 gates ``` No non-test file changed; schema identity unmoved. ## How this reached master, and one residual #5195's worker verified `tests/unit/daemon/test_daemon_http.py`; the affected tests live in `test_web_reader.py`. The hosted merge gate is `devtools verify --quick` — static gates only, no pytest — so a behavioral change that breaks a test outside the worker's chosen selection merges clean. This is the second such regression today; the scheduled nightly corpus run declared in #5196 is the mechanism that catches this class, and it is not applied yet. Residual worth someone's call: `action_relation.py`'s `result_state` CASE still carries exit_code/is_error fallback arms, but the deployed `actions` view does not use that SQL — it reads `action_pairs`. Any consumer of `action_relation_select_sql` may still be on the legacy precedence path. Not investigated; out of scope for this red. 🤖 Generated with [Claude Code](https://claude.com/claude-code) https://claude.ai/code/session_01DYUNBGoE652b3nfmq3CtqK Co-authored-by: Claude Opus 5 (1M context) <[email protected]>
## Summary Job 2206 — the first nightly full-corpus `verify_all`, which fired at 03:00 as declared in #5196 — failed with **27 tests red**. Fifteen were deterministic and stale. This PR is those fifteen. They reproduce in isolation at the base commit (`15 failed, 96 passed in 9.96s`) with node ids matching 2206 exactly, so none of them is pool contention. ## The two assertion fixes `tests/unit/cli/test_click_app.py` asserted raw's options as `["full", "limit", "offset"]`. **#5202 added `continuation`** to `MESSAGE_READ_VIEW_OPTION_NAMES`. The product is right; the assertion was stale in two places. ## The thirteen snapshots Regenerated. The drift is genuine fixture data, not the ephemeral state this file's docstring warns about — which is why each change was checked before committing rather than after a green: - The seeded corpus now draws titles from `polylogue/schemas/synthetic/demo_themes.py` instead of `synthetic-N` placeholders. Verified, because realistic conversation titles appearing in a tracked baseline is exactly the shape a private-data leak would take. These are authored in-repo fixtures. - `total_messages` moves 10 → 13. Verified against the seeded artifact, not accepted from the diff: 8 + 5 messages across two sessions, every row `identity_source=native` with `content_occurrence=0`. A message-count drift is also what a content-identity collision or a lineage-recomposition bug looks like, and regenerating over one of those would pin the bug permanently. - `summed_wall_duration_ms` now redacts to `<HASH>` where the old baseline pinned a literal duration. The old baseline was doing what the docstring forbids; the regeneration removes a latent flake. ## Verification `devtools test` over the four affected files through the declared `pytest_focused` operation (job 2463): **199 passed, 4 failed**. All four failures are the pre-existing wire-support ones described below — untouched by this PR and red on master independently. ## Not in this PR: the wire-support gap The other twelve 2206 failures split into ~7 load-shaped daemon timeouts (still needing isolated evidence) and 5 real wire-support failures that are **one design gap**, not a test bug: `build_wire_support_receipt` synthesizes **one session document per provider** and validates it against **every element in every package**. That was harmless while each provider declared one element kind. It is not any more — chatgpt v4 now declares `export_asset` and `export_asset_index` beside `session_document` (#5215), and claude-code declares nine kinds across v1–v3 (`agent_transcript`, `session_index`, `workflow_journal`, `coordinator_session_stream`, `agent_sidecar_meta`, …). Every element is declared `supported=True`. The symptoms are all consequences of that: the missing `'number'` in a type union is `export_asset_index`'s `additionalProperties`, which has no reason to admit a float `create_time` because `create_time` is not a field it models; and the conservation "losses" at `$.body (message_body)` and `$.id (session_title)` are a session document parsed under an asset schema, which loses every session field by construction. **The chatgpt parser is not dropping content and the committed schemas are not wrong.** The fix is per-element wire synthesis — a feature, not a red-fix. Filing it rather than forcing it: a filter that merely skips non-document elements breaks `test_every_catalog_provider_has_an_explicit_route_and_receipt_counts`, which requires an entry for every catalog element. I tried that and it was wrong. 🤖 Generated with [Claude Code](https://claude.com/claude-code) https://claude.ai/code/session_01DYUNBGoE652b3nfmq3CtqK Co-authored-by: Claude Opus 5 (1M context) <[email protected]>
Two independent settled decisions, one commit each.
A — retire
polylogue/api/contracts/(polylogue-aq2l5)Ruled and authorized on the bead. The package shipped as a contract spine enforced through shadow adapters; those adapters were deleted two days later (#1329), leaving
TUIReadSurfaceas the only implementor — and #5182 deleted the TUI.a7xr.13had already deleted the mirrored write-surface half, recording the finding that shadow adapters verify copies rather than surfaces, and the plan "execute f94 first, then nothing in read_surface needs keeping".Verified before deleting, not trusted from the brief: every
api.contractshit is inside the package;assert_implementshas 11 hits, all internal, zero call sites; each exported Protocol name searched individually returns zero external hits;TUIReadSurfacezero hits anywhere.ArchiveReadCapabilityis unaffected — it lives inapi/archive_reads.py:17and the deletedcontracts/__init__.py:38was a pass-through re-export.Replacement in place: operation-identity parity (
polylogue/api/parity.py, gateapi-parity) plus behavioral differentials — including the one in #5184 that caught the MCPoffset=0defect no name-based check could.Correction to the ruling's expectation: it predicted the layering baseline would shrink. It did not — 226 before, 226 after.
docs/plans/layering-surface-baseline.jsonhas no entry for anyapi/contracts/*file, andpolylogue/api→polylogue/daemonis not a disallow pair inlayering.yaml, so the removedread_surface.py:31import never counted. The bound held; the number did not move.B — declare the corpus schedule (polylogue-yk0zz want 4)
schedule = "*-*-* 03:00"added to[operations.verify_all].cache,checkout,pooluntouched — they are load-bearing for the dedupe property.verify.yml's header comment corrected: it claimed a nightly agentctlverify_allschedule that was never declared.concurrency.cancel-in-progress: truedeliberately unchanged.Key spelling cross-checked against the live precedent (
/realm/project/sinnix/.agentctl/project.toml[operations.census]).agentctl schedule applywas not run — that mutates live host state and is the coordinator's.Verification
All five changed files confirmed out of the schema-identity closure.
Residual
agentctl schedule applystill needs running after this lands; want 4 closes only once the timer is listed and one scheduled run has a result.agentctl scheduleexposes onlyapply— no read-only list verb — so the descriptor's acceptance of the value is unproven until then.🤖 Generated with Claude Code
https://claude.ai/code/session_01DYUNBGoE652b3nfmq3CtqK