Repository navigation
fix: Let the read operation own continuation, totals and failure exits - #5222
Conversation
|
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 59 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 (20)
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. |
## Summary Seventeen worker branches, each resolving a theme of small known-fix beads, integrated into one candidate: 472 files, +20,406 / −12,166, 80 commits (worker commits plus integration merges and eight cross-branch reconciliations). Every fixed bead carries one regression test that names its anti-vacuity condition. ## Problem The reindex campaign's closure held ~150 open beads whose fix was already known and small, spread across parsers, storage, daemon, surfaces, devtools and the test harness. Working them one PR at a time serialised on review and on the pytest slot. Bead status was stale in both directions: several dozen were already fixed at head, and a handful of premises were refuted on inspection. ## Solution Per theme (branch → beads): - batch3-identity: ig9tt irtix(1) 3ad8j(1,3) vabba zj8ns t1vl6 prwmd d9t8u asp4b(6) dhkuu(B) l3zva ddvpi m8yd5; 9193q already at head - batch3-devtools: uy1a5 7o5zj gcy1 8ykm 1bkl g31s zmlcn wbuf v6xh b1vr1 lafc4 d0kj acsmu hohj7 ga8vn c4a1o rxfo c2qsm t4l2q n6gnd 59qy ww6mj 5pv1p; already at head: b0vbz qai7u e4qyw 8errr v0t3r - batch3-daemon: ia88n(a) c1dx2 s4tkf 7z8do 7viwp 0ye6q jyzfs uwxir lbsh9 umca4 ji49p 7mkgv 5a6xc dvhe7 8374p o90gu 3zvsd 9z2gy hprg0 s4135 ho6m7 a03p0 6u8do; pinned at head: lr47v 8ifs 3ahdg f7bf9 liwst - batch4-harness: xbg9e o733y m3018(code half) 016xl(root cause: schema-closure import walk memoized on disk, 10.4→4.1 s per process); already at head: 3z1bj yichs csex1(AC1) ehva4 - batch1-parsers: 8t9bj 6d7fx q5j3o 670mf sfu70 foi1h utv49 4mbya w54q3 1wom1 l0cnu gzxhi; pua53 at head - batch1-surfaces: o6oct g88v4 xtcdz i6p4x onbz3 vgxkk e9y76 nfr2u 4vjfd 45pkf l9u58 zu08l; at head: kjy0a oil1q m1s98 c0ay0 9qpx4 - batch1-storage: nd2tb lyymm 3sic0(a–e) ebjar nszyu h9xx0 pv8xp wr0oe lezv0 5qrip lyqzg crcst; at head: bl132 4hys5 gzh7n son7n qczu5 - batch4-ingest: f7pdm dznyt 3ijaa swicx(3/4) m5djs av5j1(2) 9k62p roaof 3r36h; l8tdh at head - batch4-identity2: s9w0h e2e25 8u1p 3vsoj xnk51 31zag ro922 t37k9 07rfc sqy57 h92sm khkup 8k10u 56jc6 - B6 excision: 14ucm q4f6d aix14 9lrqs p1naz (+ unrecorded otlp_spans reach); at head: bhhsa si5kj - B7 vocabulary: z3sv hjvow bwh3h 7k3n0 exxly j1vs ir1wn grdt mjupn(part) jglh(part); a2jir at head - B8 daemon: zbzxs tjtua 5lfcr z5bu7 h8l96 w17k1 oa9w8 (+ duplicate ISOLATED_TIER_WRITE_PROFILE); iwmt at head - B9 ingest: 0ck6i zxpgj fkqxx(half) payqy xj7ru v85tn sifoy erf3; at head: h0nor ip0nq re4es - B10 CLI/API: 1c6j fawr7 lxdwy t83q(residual) lb15e(part) 01fe(origin class); at head: 1kavq v1mnm i58iu pd63j qwgi mon2f 395j - B11 tests/devtools: vwdj zphcj p9evo 6ou1q 7ui0g nlush b7c7m 4ayqx thqg2 8xvlf(part) + one real daemon saturation red; at head: vl7ra mnkfh 7y23g vhelw f3p8c mhy6z - B12 security: 97o2z xv0pf n61h5 4fbgw tztk 81v76 1oa7o; xtawb refuted at head - B13 campaign: k00uq cois9 xrba4 1ifhp; 4x38n at head Integration reconciliations (own commits on this branch): the shared SQLite introspection helper moved to `polylogue/core/sqlite_introspection.py` (its storage home grew the surface→substrate ratchet for two daemon modules); the hook-drain cursor read guards on the carriers table instead of swallowing every `sqlite3.Error`; the audit `principal_surface` CHECK stays hand-written (durable DDL is not enum-generated) and is pinned to the literal by value set; the codex record-skip log is a structured event; `--limit` refuses non-positive and clamps to the ceiling; the raw-discovery sweep keeps the held-page cursor inside the arrival/sweep lanes; the prefetch timeout cancels unstarted, discards finished-unread and attaches the discard to still-running workers; generated surfaces re-rendered; writer-module census, schema-closure and degradation baselines refreshed for the deleted and added modules. Beads skipped by workers are listed in the worker reports and stay open with their reason noted; none was closed without a fix at head. ## Closure and rebuild Dozens of files in this candidate are IN the derived-schema identity closure (parsers, write.py, archive_tiers specs, core enums/timestamps, sources, excision). The identity moves; this lands before the fresh rebuild starts and never during one. Content also changes for ChatGPT thought summaries, Gemini subagent origin, Codex world_state keys, Hermes profile keys, Grok session identity (content-derived, message-id namespace `grok`), tool_path/search_text widening for FTS, and the hash framing in `_hash_bytes` (length-prefixed) — all pre-wipe by design. ## Verification - `agentctl job start --workspace /realm/worktrees/polylogue-integ polylogue verify_quick` → job 2459 **succeeded** (all 21 gates ok) - `agentctl job start --workspace /realm/worktrees/polylogue-integ polylogue pytest_focused -- <162 touched test files>` → job 2460: 5,795 passed / 13 failed (all cross-batch interactions, reconciled in 5f123c6 and 2da4406); re-test of the 13 files → jobs 2467+2470 **succeeded** (594 and 89 tests, all passed); quick gate re-run after reconciliation → job 2471 **succeeded** - Each worker branch additionally ran its own focused selections and, for most, `devtools verify --quick` green before integration (receipts in the worker worktrees). ## Residuals - 15 test failures inherited on master (13 `test_plain_cli_snapshots` fixtures, 2 `test_click_app` read-view assertions) are owned by the peer session's 2206 fix and are not touched here. - `test_codex_state_live_ingest.py::test_codex_goal_materials_do_not_cross_supersede_source_roots` fails at base 342cf9e (inherited, unrelated). - Operator decisions surfaced by workers, left open: b5xfk (contradicts the #4614 subdirectory contract), bwu75 (member-level disposition row needs a source migration), 4xhzs (no converger stage resumes accepted machine requests), om8dh, ew7ti, fxtbj, gzmd4, qut1/l6v61, v8dz. - pw5jd stays open: its classifier is landed by #5222 (jtrtj) instead. - Corpus-scale receipts (memory.peak under the pytest slice at width 4, controller peak ≤600 MiB) were not produced; the width change is arithmetic plus unit tests. 🤖 Generated with [Claude Code](https://claude.com/claude-code) https://claude.ai/code/session_01Sx3uCnEiY7MXtLt4FDEYfw --------- Co-authored-by: Claude Fable 5.1 <[email protected]>
Four CLI read defects the 2026-09-15 grok audit found, all in the seam between a declared operation and the surface that renders it. polylogue-w3s0q (P0): the `cli.query` list payload carried no `next_offset`, so `session_rows.query_complete_session_ids` ended its walk after one page and `select`/`mark`/`delete --all` acted on the first 500 matches while the operator asked for every match -- the exact #1873 regression that loop exists to prevent. `daemon_reads.page_next_offset` now decides continuation once for both the list and ranked pages. It is carried as a sibling field in `QueryResult`, alongside `attached_units` and `total_unit` and for the same reason: `SessionListResponse`/`SearchEnvelope` forbid extras and live in the derived-schema closure, which a CLI-facing field must not move. polylogue-jfabc: `render/rows._page_envelope` substituted `len(rows)` for an operation's honest `None` total, turning a vector lane's deliberate "no archive-wide cardinality" into a confident count, and re-derived `next_offset` from it. The renderer now reports both as the operation decided them. The bare landing screen named "(daemon)" from the absence of `--no-daemon`, although the kernel falls back to the in-process reader when no socket answers; it now reads the authority the result carries. polylogue-jtrtj: every typed read failure that was not daemon_required/result_too_large became a `click.UsageError`, which exits 2 -- the *empty* status -- behind Click's usage banner. Transport loss, a missed deadline, a cancellation and a refused request were therefore indistinguishable by exit status from "matched nothing". `render/outcome` now owns one read-failure terminal: 1 for a failure, 130 for a cancellation, never 2, with the call id, the deadline and a remedy in the message, and a parseable document for `--format json`. polylogue-ry6g5: a fresh archive root produced two refusal texts and two machine contracts depending on which verb asked, because `find` echoed its own wording past `machine_errors`. It now raises the same typed `ArchiveTierUnavailableError` the storage layer raises. Closure: `devtools schema closure` reports every changed file OUT. Co-Authored-By: Claude Opus 5 (1M context) <[email protected]> Claude-Session: https://claude.ai/code/session_01DYUNBGoE652b3nfmq3CtqK
… claims
polylogue-dutav. `cli/read_view_registry.py` declared ten views as
`session-read-projection` over `session.read`. Only `hooks` is one:
`daemon_reads._session_read_payload` answers `transcript` itself and
delegates every other kind to `_SESSION_EVIDENCE_READERS`, which holds
`hooks` alone and raises for anything else. `summary`/`transcript` are
`cli.query` renderers; `dialogue`, `messages`, `raw`, `events`,
`effective_context`, `file-edits`, `agent-policies` and `web-content` read
the archive in this process through the Python API facade. `neighbors` was
declared a `cli.query` renderer while calling
`polylogue.neighbor_candidates` directly, and `temporal`/`chronicle` use
`run_archive_read_sync`/`list_summaries`.
The reason the table could be this wrong is that
`_validate_read_view_classification` checked it only against itself. It is
now checked against the kernel: `test_read_view_execution_routes.py`
dispatches every view with the daemon absent and `daemon_only=True` and
compares the operations that actually reach
`cli.operation_kernel.dispatch` with the operations the row declares, so a
row can neither claim an operation it does not execute nor execute one it
does not declare.
The honest state gets a name -- execution kind `in-process` -- and a
shrink-only ratchet, `IN_PROCESS_READ_VIEWS`: a view may leave it by moving
onto a declared operation, never join it. This records what S8/S9 still owe
instead of hiding it behind a classification that reads as finished.
Third mirror: `surfaces/read_contract.READ_PRESETS` was a hand-written list
that had silently lost `lineage` and `effective_context`, and nothing
compared it with the view declaration. It is now generated from
`archive.viewport.read_view_choices()` -- the declaration
`cli.read_view_registry` already validates against -- so the drift is
impossible rather than merely detectable.
Executed mutation: declaring `events` as a `session.read` projection turns
`test_each_view_executes_the_route_it_declares[events]` and
`test_session_read_projections_name_a_kind_the_operation_actually_serves`
red (2 of 24), with "events declares ('session.read',) but reached no
operation".
Closure: `devtools schema closure` reports both changed modules OUT.
Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
Claude-Session: https://claude.ai/code/session_01DYUNBGoE652b3nfmq3CtqK
`devtools verify --quick` rejected an unused `type: ignore` and an untyped row list in the polylogue-jfabc tests. Same assertions, typed. Co-Authored-By: Claude Opus 5 (1M context) <[email protected]> Claude-Session: https://claude.ai/code/session_01DYUNBGoE652b3nfmq3CtqK
16d4bfd to
20f7114
Compare
Summary
Five CLI read beads. The common defect is a surface deciding something it was
not entitled to decide — inventing a total, re-deriving a continuation, or
mapping every failure onto the empty-result exit code.
Per bead
w3s0q (P0) — a completion walk that stopped after one page. Reproduced at
head: the
cli.querylist payload carried nonext_offsetat all, sosession_rows.query_complete_session_idsended its walk after the first page.New
daemon_reads.page_next_offsetdecides continuation once for both the listand ranked payloads. Carried as a sibling field on
QueryResult(likeattached_units/total_unit) rather than added toSessionListResponse/SearchEnvelope, which are in the closure — the same reasoningijbwqused forreusing
offset.tests/unit/cli/test_complete_selection_pagination.pyseeds 7sessions with the walk page at 3 and proves all 7 ids resolve. The pre-existing
test in
test_select.pyfed the loop hand-written pages that already carriednext_offset, which is why it never saw this.jfabc — a fabricated total.
_page_envelopedidpayload.get("total") or len(rows), so an unknown total silently became thecurrent page size. A
Nonetotal now stays null in JSON/YAML, andnext_offsetis read from the payload instead of re-derived from the fabricated total. The
bare screen prints the authority the result carries
(
query_session_rows_with_authority), not"direct" if daemon_disabled else "daemon".jtrtj — read failures exited 2. Exit 2 is the empty-result code, so a
transport loss was indistinguishable from an empty scope.
render/outcomegainsexit_for_read_failure: 1 for transport/deadline/invalid-request/unavailable,130 for cancellation, never 2, no usage banner, with call id +
deadline_ms+a remedy line, plus a parseable machine document for
--format json(neededbecause
machine_mainre-raises a bare non-zeroSystemExit).OperationFailedError/OperationCancelledErrornow carryrequest_id.ry6g5 — an echo and
SystemExit(1)where a typed refusal belongs.archive_query's missing-index path now raises the sameArchiveTierUnavailableErrorthe storage layer raises.read --allisdeliberately excluded: browse mode over a nonexistent archive has a correct
empty answer.
dutav — a table that claimed ten
session.readprojections. Onlyhooksisone.
test_read_view_execution_routes.pyproves each row by dispatching it withdaemon_only=Trueand comparing recorded kernel operations against thedeclaration. The honest state gets a name (
in-process) and a shrink-onlyratchet
IN_PROCESS_READ_VIEWS. Third mirror found:READ_PRESETSwashand-written and had lost
lineageandeffective_context; it is now generatedfrom
archive.viewport.read_view_choices().Executed mutation
Declared
eventsas asession-read-projectionoversession.read. 2 of 24 red:Reverted; the registry is byte-identical to the committed version.
Closure
devtools schema closureon all eleven changed product files — all OUT. Thesibling-field design is what kept
surfaces/payloads.pyuntouched. Nopre-rebuild landing-order constraint.
Verification
devtools verify --quick→ exit 0, every gate okdevtools gate layering→ passed, 0 violationsdevtools test tests/unit/devtools/test_command_catalog.py→ passed(
test_top_level_command_surface_is_the_folded_twelvenot weakened)devtools test tests/unit/cli/ tests/integration/test_transcript_window_differential.py tests/unit/archive/query/test_continuation_surface_parity.py→ exit 1, 15 failed of 3136, all inherited. Proven by checking the tree
out at
e56edbea2and running the same two files: the same 15 node ids fail.13 are stale
test_plain_cli_snapshotsfixtures showing different seededdata; 2 are
test_click_appread-views assertingraw's options withoutcontinuation. Both named integration/parity suites passed.Residuals
transport loss and oversized body now reach typed distinct CLI terminals.
Still open: the summary-half four-surface differential (no equivalent of the
transcript differential exists for a summary request), typed outcomes for
active growth / deep transcript anchor / unavailable insight, and criterion
4's before/after responsibility map. Children vclez.5–.8 unchanged.
delete
archive_query.py's query-execution paths, move CLI-only predicatesinto
archive/query/expression.py, which is IN the closure. Its blockingdependency
dutavis now done, leavingvclezas its only open blocker.own bead.
CliRunner-based against the realfindroute — it asserts exit code and banner absence but is not a PTY.not deleted:
test_messages×2 andtest_query_exec_laws's vector-backendtest all asserted
click.UsageError(exit 2 for a non-empty condition — theexact conflation jtrtj removes), and
test_documented_query_corpus._assert_typed_outcomepinned exit 2 for everynon-zero typed terminal.
test_archive_query's clamped-page test moved from"the renderer computes continuation" to "the renderer reports the operation's
continuation", with a new sibling proving the renderer never invents one.
_execute_directly's locally builtinvalid_request/embedding_retrieval_not_readyenvelopes carry norequest_id, so thoserefusals name no call id.
Downstream unblocked
dpm6o(P0, all three blockers done),5vps8(P0) andi3i5k(P0 epic) viaw3s0q.🤖 Generated with Claude Code
https://claude.ai/code/session_01DYUNBGoE652b3nfmq3CtqK