Repository navigation
fix: reacquire missing raw blob evidence - #2390
Conversation
Problem: live catch-up and append planning could treat a source-tier raw row as acquisition proof even when the content-addressed blob named by that row was absent. That lets old raw debt suppress fresh acquisition work. What changed: require archive blob presence before restoring a watcher cursor or returning a raw fingerprint from archive-tier state. Existing positive tests now create the corresponding blob fixture, and new negative tests preserve missing-blob rows as debt while scheduling re-acquisition work. Verification: devtools test tests/unit/sources/test_live_catchup_planning.py::test_catch_up_repairs_missing_cursor_from_archive_source_row tests/unit/sources/test_live_catchup_planning.py::test_catch_up_does_not_repair_cursor_from_archive_row_with_missing_blob tests/unit/sources/test_live_catchup_planning.py::test_catch_up_reconciles_browser_capture_cursor_from_archive_origin tests/unit/sources/test_live_batch_support.py::test_codex_append_plan_reads_archive_file_set_session_identity tests/unit/sources/test_live_batch_support.py::test_latest_raw_fingerprint_ignores_archive_source_row_with_missing_blob Verification: devtools verify --quick
Problem: after missing raw blobs are detected, existing live cursors can keep source files settled, so ordinary catch-up never re-acquires the raw payload even though the source file still exists. What changed: add a dry-run-by-default ops maintenance command that finds unmaterialized raw rows whose blob is absent and source path still exists, then optionally deletes only the matching rebuildable ingest_cursor rows. Raw rows, source files, index rows, blobs, and user state are left intact. Verification: devtools test tests/unit/cli/test_archive_maintenance_cli.py::test_missing_raw_blob_cursor_repair_dry_run_keeps_cursor tests/unit/cli/test_archive_maintenance_cli.py::test_missing_raw_blob_cursor_repair_apply_deletes_only_cursor tests/unit/sources/test_live_catchup_planning.py::test_catch_up_does_not_repair_cursor_from_archive_row_with_missing_blob tests/unit/sources/test_live_batch_support.py::test_latest_raw_fingerprint_ignores_archive_source_row_with_missing_blob Verification: devtools verify --quick
|
Caution Review failedPull request was closed or merged during review 📝 WalkthroughWalkthroughThe PR adds archive-blob existence checks to raw-fingerprint lookup and archived cursor reconciliation, and introduces a maintenance command that reports or deletes ingest cursors for raw sessions whose blobs exist but whose indexed materialization is missing. ChangesArchive blob cursor repair
🎯 4 (Complex) | ⏱️ ~60 minutes
🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
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 |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 2aae4a1302
ℹ️ 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".
|
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
This PR makes missing raw blob rows stop acting as valid live-cursor proof, adds a dry-run-by-default cursor invalidation maintenance command, and uses that path to repair the live archive without deleting raw rows, source files, index rows, blobs, or user state.
Problem
The live archive had
source.db.raw_sessionsrows whoseblob_hashpointed at absent blob files. Some of those rows were not materialized inindex.db.sessions, but the live watcher and batch helper could still treat the source-tier row as acquisition evidence. Existingops.db.ingest_cursorrows then kept those source files settled, so normal startup catch-up did not re-acquire the missing raw payloads.Solution
polylogue ops maintenance missing-raw-blob-cursors, dry-run by default, which finds unmaterialized missing-blob raw rows whose source files still exist and optionally deletes only the matching rebuildableops.db.ingest_cursorrows.Live repair evidence
Ref #2308.
Before repair, the live archive had 315 unmaterialized missing-blob raw rows: 96 ChatGPT browser-capture, 5 Claude.ai browser-capture, 55 Codex, and 159 Claude Code. A current durable-tier backup was written at
/home/sinity/.local/share/polylogue/archive-db-backups/manual-durable-pre-reacquire-20260625T133437Zbefore mutation.The new maintenance command dry-run reported 315 cursor candidates, then
--applydeleted exactly 315 rebuildable cursor rows. Branch-localpolylogued run --no-api --no-browser-capturecatch-up then re-acquired those source files through the normal ingest path. After repair, a direct source/index/blob reconciliation reportedmissing_unmaterialized: 0; 389 remaining missing blob rows are already materialized by current source/native evidence and are not user-visible materialization debt.Operational caveat
Full re-acquisition is currently slow: browser-capture and Claude Code full-ingest chunks processed around 0.2 files/s, and one 50-file chunk briefly grew
index.db-walto about 5.9 GiB before checkpointing back down. That is not fixed here; it is runtime performance evidence for a follow-up optimization of full-ingest batching/transaction shape.Verification
devtools test tests/unit/sources/test_live_catchup_planning.py::test_catch_up_repairs_missing_cursor_from_archive_source_row tests/unit/sources/test_live_catchup_planning.py::test_catch_up_does_not_repair_cursor_from_archive_row_with_missing_blob tests/unit/sources/test_live_catchup_planning.py::test_catch_up_reconciles_browser_capture_cursor_from_archive_origin tests/unit/sources/test_live_batch_support.py::test_codex_append_plan_reads_archive_file_set_session_identity tests/unit/sources/test_live_batch_support.py::test_latest_raw_fingerprint_ignores_archive_source_row_with_missing_blobdevtools test tests/unit/cli/test_archive_maintenance_cli.py::test_missing_raw_blob_cursor_repair_dry_run_keeps_cursor tests/unit/cli/test_archive_maintenance_cli.py::test_missing_raw_blob_cursor_repair_apply_deletes_only_cursor tests/unit/sources/test_live_catchup_planning.py::test_catch_up_does_not_repair_cursor_from_archive_row_with_missing_blob tests/unit/sources/test_live_batch_support.py::test_latest_raw_fingerprint_ignores_archive_source_row_with_missing_blobdevtools verify --quickdevtools verify --quickdevtools verifystatic steps passed, but pytest-testmon selected 9,964 tests because the local seed was stale for this head and timed out at 2700s before producing a JSON report. This is recorded as run20260625T142529Z-testmon-4089363-7abcaa74; it is not treated as a focused failure of this patch./home/sinity/.local/share/polylogue: zero remaining unmaterialized missing-blob rows by direct source/index/blob reconciliation.Summary by CodeRabbit
New Features
Bug Fixes