Repository navigation
fix: integrate reindex recovery and proof work - #4679
Conversation
A GitHub Actions workflow job is its own serialisation domain: one self-hosted runner executes one job at a time, under the job plane's slice. It runs pytest in place instead of queueing through the workstation's pytest slot, which required the workstation's queue runner on the runner's PATH. Co-Authored-By: Claude Opus 5 <[email protected]>
`verify_all` declares `pool = "pytest"` but was absent from the operation fallback, so its worker re-queued into the single-slot group it already occupied whenever the runner did not export `SINNIXD_QUEUE_POOL`. The declarations are now the test's own fixture, so a new pytest-pool operation cannot drift out of the classifier. The slot tests also read whatever the workstation had deployed: the declared worker's assertion held only because the run sat inside the deployed pytest cgroup, and queueing resolved the real `sinnixd-queue-run` from PATH. The cgroup is stubbed and both queue tools are fakes that are the whole PATH, so the unreachable-queue test now reaches the pueue check it is named for. Co-Authored-By: Claude Opus 5 <[email protected]>
verify_all's absence from per-lane publication rests on it being default-checkout-only and scheduled; assert both alongside the publication list so restoring it to a lane fails here. Co-Authored-By: Claude Opus 5 <[email protected]>
pueue kills the queue runner with SIGKILL, so the workload it started survives in the transient systemd scope pueue cannot see: a reaped waiter left pytest running against the checkout while the slot showed free. `agentctl job cancel` stops the task and then empties that scope. The launch file carries the resolved environment and belongs to whoever ends the run, so it is deleted only when the cancellation succeeded -- a task still on the queue reads it when it starts. Co-Authored-By: Claude Opus 5 <[email protected]>
#4531 untracked `.lane/`; #4649 re-added `.lane/title` with it, so every lane that writes its own subject dirties a tracked file and trips the worktree identity check. `.gitignore` already covers the directory. Co-Authored-By: Claude Opus 5 <[email protected]>
|
Important
This repository does not receive automatic reviews because it has fewer than 10 stars. ⚙️ Run configurationConfiguration used: Organization UI Review profile: ASSERTIVE Plan: Team Run ID: 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. |
|
@codex review |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 3efbcb9798
ℹ️ 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".
`_reextract_prefix_tail_db` deleted from `insight_materialization`, which #4649 retired from the index DDL, so every deferred-tail resolution raised `no such table`. Delete the child's `session_profiles`, `session_latency_profiles`, `session_work_events` and `session_phases` instead: their staleness predicate compares the session's sort key, updated-at and content hash, none of which re-extraction moves, so a profile materialized over the whole child would report fresh indefinitely. The same retirement left four `SessionInsightCountDescriptor`s whose `count_key`s are no longer snapshot fields and whose `table_key` names the retired table, making every `session_insight_status_sync`/`_async` call raise `KeyError`. Remove them and their SQL. Co-Authored-By: Claude Opus 5 <[email protected]>
#4649 removed the readiness descriptor whose `zero_counts` short-circuited `stale_thread_count`, `orphan_thread_count` and `stale_tag_rollup_count` when their product tables were absent, leaving the three count descriptors querying `session_profiles`, `threads` and `session_tag_rollups` unguarded. Restore the gates as `table_key`, so a status call on an archive without those relations falls back to zero instead of raising `no such table`. Co-Authored-By: Claude Opus 5 <[email protected]>
The readable index guard admitted any object whose name starts with `messages_fts`, so an undeclared object sharing that prefix was survivable before anyone decided it was. Declare the five objects the message FTS surface owns and match membership. `search_archive_blocks` reached SQL against that admitted-absent surface and raised `no such table: messages_fts`; it now refuses with the same typed `DatabaseError` the other search routes raise. Presence is the check, not freshness: rebuild and differential routes read this surface while it is legitimately behind `blocks`. Deletes `_readable_without_fts`, an unreachable copy of the same admission decision. Co-Authored-By: Claude Opus 5 <[email protected]>
A tail-only replay (the live-append path) wrote the newly accepted chunk and left the prefix's `claude_parse_coverage` row at its own position and timestamp, while `sessions.content_hash` described the chain's reduction -- one event carrying the chain's totals, the chain's newest timestamp, and a slot after every point-in-conversation event. `_reconcile_chain_summary_events` now reconciles the retained row on all three axes the hash covers, reusing the writer's own payload, summary, timestamp, and next-position helpers so the row matches what a full replace of the composed session writes. Co-Authored-By: Claude Opus 5 <[email protected]>
Every `sessions` column carried `record_name=None`, so the record projection rendered empty and `get_session` and `list_sessions` both emitted `SELECT FROM sessions`. Declare each column's record name and select expression on the column itself rather than through a separate wrapper applied after the spec, and cover the projection with a spec contract and a read-path test. Co-Authored-By: Claude Opus 5 <[email protected]>
Replacing a parent deletes its blocks, and the ON DELETE SET NULL foreign key on session_links.parent_tool_use_block_id nulls every inbound child edge while the replacement reinserts the same deterministic block ids. Identity resolution revisits only unresolved edges, so the join key stayed NULL and the dispatch dropped to unresolved. _refill_inbound_dispatch_block_ids rebinds resolved children on every write. Dispatch child identity is now read from the progress payload alone -- the record envelope names the emitting session -- and candidate names are compared as the sessions they resolve to, so several exact names for one child are one identity. Co-Authored-By: Claude Opus 5 <[email protected]>
…ema-generation suites test_plain_cli_snapshots took a fresh query-only lease per test (each one revalidates every artifact byte) and re-cloned plus re-materialized the cli-mixed insights for each of eight read-only consumers. test_schema_generation cloned the schema-coverage archive for each of seven tests that only read index.db. Both are now module-scoped; the per-test fixtures only set the environment the CLI reads. seeded_archive_writable has no remaining consumer and is deleted. test_completion_matrix was already module-scoped and is unchanged.
resolve_archive_ingest_dispatch read CPU count alone, so every parse_sources_archive call spawned the ambient worker count -- 16 fresh interpreters on a 24-thread host -- even for a walk of one small file, the shape the API ingest facade produces per source. Tier the plan on the byte boundaries resolve_ingest_batch_dispatch already uses, and record the walk, parse, and pool phases in the append.* stage ledger that previously covered only the archive write. Measured over six one-file walks (1,074 messages), interleaved arms: 41.2/41.5 messages/s at 0.078 process CPU utilization with the pool, 325.4/476.3 at 0.795/0.764 in-process. Co-Authored-By: Claude Opus 5 <[email protected]>
Restore batches host parameters below the connection's own variable limit, writes a vector and its metadata together so a metadata row (the tier's reuse signal) can never exist without the vector at its address, and reports every unrestored hash as a typed miss naming its cause. Preservation builds the copy in a private temporary file, makes it self-contained, derives its receipt from the finished copy, and renames it into place, so a file at the destination path is always a whole copy its receipt describes. Deletion re-reads the copy's digest and refuses a receipt that names another file or a copy that has changed. Co-Authored-By: Claude Opus 5 <[email protected]>
The envelope reader selects attachment_refs.direction and producer_ref unconditionally, so a schema missing either column fails every read at statement preparation. Assert the write-then-read round trip on a freshly bootstrapped index, and record the v91 declaration for the columns. Co-Authored-By: Claude Opus 5 <[email protected]>
The rebase conflict resolution re-added the archive index-fast-forward CommandSpec that #4666 deleted along with devtools/index_fast_forward.py. Its module target does not exist.
A procfs read failure returned zero RSS, PSS and swap, which satisfies every declared limit and reports the envelope as met without measuring it. Missing fields now raise and the command records blocked-env.
f64c6cc to
381f886
Compare
3efbcb9 to
96a0fcc
Compare
|
@codex review |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 96a0fcc82f
ℹ️ 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".
Master's side kept for every conflicted hunk: #4690's dispatch-link functions and #4692's attachment writer in write.py, INDEX_SCHEMA_VERSION 94, the daemon-probe status path, and the tests master advanced with them. Co-Authored-By: Claude Fable 5.1 <[email protected]> Claude-Session: https://claude.ai/code/session_01DNGJ3awfNrsLaMdHgQZvid
The writer retains an attachment whose owner coordinate is claimed by more than one message as a typed unowned row with no attachment_refs edge. Such a row is an orphan by the relink scan's definition, so the raw re-parse reaches it, and attachment_message_owner_key raises the same ambiguity again -- aborting `polylogue ops maintenance blob-reference-closure` with a traceback in both dry-run and --apply. Classify it as UnrecoverableAttachmentReason.OWNER_AMBIGUOUS. Archive verification's blob-reference-closure and attachment-coverage checks key on acquired-and-unreferenced, which the unowned row is not, so both stay clean. Co-Authored-By: Claude Fable 5.1 <[email protected]> Claude-Session: https://claude.ai/code/session_01DNGJ3awfNrsLaMdHgQZvid
Both import blocks kept in test_archive_verification.py. Co-Authored-By: Claude Fable 5.1 <[email protected]> Claude-Session: https://claude.ai/code/session_01DNGJ3awfNrsLaMdHgQZvid
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: c36e83cc46
ℹ️ 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".
#4708) ## Summary Embedding preservation now has a production caller and produces the receipt its own deletion path demands. ## Problem `polylogue/maintenance/embedding_preservation.py` was reachable only from tests (polylogue-fur7r). Nothing in the repository wrote an `ac2_passed` receipt, so `delete_preserved_copy` could never authorize a deletion, and nothing measured whether a rebuilt archive reuses the preserved vectors at all — the >=95% acceptance on polylogue-ockqd had no instrument. The six correctness defects from the exact-head review of #4672 (polylogue-ockqd.1) are already fixed on master by `68bef3b2b`, carried in by #4679: batched IN lookups bounded by the connection's own variable limit, restoration counted only once a vector row exists, incomplete legacy metadata as a typed miss, deletion bound to the copy's path and digest, a temporary file renamed atomically, and the receipt derived from the completed backup. This change adds nothing to that family; it supplies the caller they were missing. ## Solution `polylogue ops maintenance embedding-preservation` owns the three phases across a fresh start. The phases are separate invocations because the archive is discarded between them. - `preserve` (AC1) copies the vector tables aside and records row counts and a table-set digest. `--immutable` reads a quiesced source without creating its sidecar files. - `restore` imports the vectors the rebuilt archive is about to ask for. - `verify` (AC2) recomputes the rebuilt archive's addresses through `archive_embeddable_messages_relation` — the production embedder's own message selection and hash expression — counts a hit only when the fresh tier holds both metadata and vector, and enumerates every miss by cause. The proof lands at `<copy>.ac2.json` so it cannot overwrite the preservation record. - `discard` (AC3) deletes the copy only against that proof, which must carry the AC2 schema and match the copy's current path and digest. The reuse denominator is distinct vector addresses, matching AC2's wording; messages sharing text share an address and are counted once. ## Verification `devtools verify --quick` — green, all thirteen gates, no `out of sync`. AC1 rehearsed read-only against the live archive at `/realm/state/polylogue` (raw immutable opens only; the tier file's mtime is unchanged at 2026-08-18): 167,943 metadata rows and 167,943 vector rows, digest `ce85925ddb145f2749a821b0f1aff8473ee7cc2d8de05cd931e2736b125a351d`, an 807 MB copy under `/realm/tmp/work/blob-maneuver/embeddings/`. `devtools test tests/unit/maintenance/test_embedding_preservation.py tests/unit/maintenance/test_embedding_reuse_verification.py` is queued behind a saturated host pytest slot (a full-corpus run has held it for over ninety minutes) and has not yet produced a line. The required checks gate this merge. ## Residuals AC2 cannot be measured until a fresh archive exists; only its instrument ships here. Two live-archive facts confirmed and still current: the tier is at embeddings version 4 and names its column `embedding_input_hash` where current DDL says `vector_derivation_hash` (restore already maps this), and its stored vectors are `voyage-4` while configuration says `voyage-4-lite` — the reindex must run as `voyage-4` or the hit rate is zero by construction. 🤖 Generated with [Claude Code](https://claude.com/claude-code) https://claude.ai/code/session_01DNGJ3awfNrsLaMdHgQZvid --------- Co-authored-by: Claude Opus 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 0914f89):
Resolving every thread listed; confirmed defects are fixed under the named bead. |
|
Closing out open Codex review threads on this PR (evidence checked against master at 0914f89):
Resolving every thread listed; confirmed defects are fixed under the named bead. |
|
Closing out open Codex review threads on this PR (evidence checked against master at 5d56c3a):
Resolving every thread listed; confirmed defects are fixed under the named bead. |
|
Historical Codex triage: evidence checked at 5ebcfe5. This records that source revision; it does not claim a fresh review of current master.
Only the rows listed above are dispositioned. Held findings remain open. |
|
Historical Codex triage: evidence checked at 5ebcfe5. This records that source revision; it does not claim a fresh review of current master.
Only the rows listed above are dispositioned. Held findings remain open. |
Summary
Integrates the reindex-recovery work: the physical blob disposition plan and
its guarded apply, embedding-vector preservation, archive-ingest parse-pool
sizing, the query-execution envelope lab check, the conversational-evidence
rule in the one-shot importer, AI Studio attachment ownership on
same-timestamp document turns, and attachment-reacquisition coverage.
Rebased onto master f80542b.
Review outcome
The adversarial review's blocking finding was the branch's own attachment
writer: retaining an owner-ambiguous attachment wrote a ref-less row that
blob-reference-closureandattachment-coverageclassify as blocking debt,and that crashed
polylogue ops maintenance blob-reference-closure.Master #4692 has since shipped its own version of that writer change, so this
branch keeps master's side of
write.pyin full -- the file is nowbyte-identical to master, which also preserves #4690's dispatch-link
functions and
INDEX_SCHEMA_VERSION = 94.What remained was the independent crash the review proved, which master does
not fix:
attachment_relink._match_session_payloadcalledattachment_message_owner_keywith no handler, unlike_write_attachments.Any ref-less attachments row makes
_read_orphaned_attachment_idsnon-empty,so the raw re-parse scan reaches the same ambiguity and raises
MessageOwnerAmbiguityErrorout ofblob_reference_closure.py, past theCLI's
BlobReferenceClosureError-only handler.Solution
_match_session_payloadclassifies the ambiguity asUnrecoverableAttachmentReason.OWNER_AMBIGUOUS-- the same typed-unrecoverableshape as
NO_AUTHORITATIVE_RAWandMESSAGE_MISSING. No consumer change isneeded: closure blockers are already filtered to
acquiredorphans, and bothrequired archive-verification checks key on acquired-and-unreferenced, which
the unowned row is not.
Two tests, each naming its anti-vacuity condition:
test_owner_ambiguous_orphan_is_reported_typed_not_raised-- writes theambiguous session through the production writer, then runs plan and relink.
Removing the handler makes it red with the review's traceback.
test_unowned_attachment_evidence_keeps_closure_and_coverage_clean--blob-reference-closureandattachment-coverageon a fixture archivecarrying the fix: profile, delegation and storage reds from the 2026-09-05 corpus #4692 unowned shape. Giving the row
acquiredturns both ERROR.Verification
The single failure is
test_empty_covered_table_without_stats_is_not_missing_coverage, confirmedfailing on master itself and tracked separately.
Residuals
destructive branch of
blob_disposition_apply(theunlink_unreferenced_blob_hashes_under_exclusioncall) has no test thatreaches a real unlink, and
embedding_preservationstill has no productioncaller.
_write_attachment_rowwith a preacquiredacquiredtuple, which wouldproduce the acquired-and-unreferenced shape both checks reject. The new test
covers the unfetched shape master produces without preacquired bytes; the
acquired variant is master's behavior, not this branch's.
_temp_used_bytesmeasures the TMPDIR filesystem, not the process(review nit 5), and the one-shot importer's evidence refusal increments no
ParseResultcounter (nit 6).🤖 Generated with Claude Code
https://claude.ai/code/session_01DNGJ3awfNrsLaMdHgQZvid