Repository navigation
fix(daemon): compact superseded raw snapshots - #1483
Conversation
Live append ingest was durably retaining every historical raw payload snapshot for active session files. On the live archive, one 106 MB Codex JSONL path had accumulated roughly 1,472 raw rows and 6.8 GB of blob references; repo-wide preview found about 27.7 GB of superseded snapshots.\n\nThis changes append writes so transient append fragments are not recorded as the durable conversation/provider-event raw provenance, adds bounded daemon-side compaction for new append snapshots, and exposes an explicit doctor cleanup target for older superseded snapshots whose source files still exist. Targeted doctor maintenance now keeps explicit-target previews in probe mode unless --deep is requested, avoiding broad expensive readiness scans when the operator only asked for one cleanup target.\n\nFresh schemas include a provider_events(raw_id) index for future archives, but existing archives do not build that index on ordinary startup.\n\nRef #1482
|
Caution Review failedPull request was closed or merged during review 📝 WalkthroughWalkthroughThis PR implements a new canonical maintenance target ChangesSuperseded Raw Snapshot Cleanup Feature
Estimated code review effort🎯 4 (Complex) | ⏱️ ~60 minutes Possibly related PRs
Suggested labels
🚥 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: a018a81581
ℹ️ 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
Adds bounded cleanup for superseded live raw payload snapshots and stops future append fragments from becoming durable conversation/provider-event raw provenance. This keeps active session files from multiplying tiny append blobs and historical full snapshots far beyond the actual source workload.
Closes #1482
Ref #818
Problem
The live daemon had stopped broad catch-up churn, but the archive still showed raw/blob amplification: one active 106 MB Codex JSONL path had accumulated 1,472 raw rows and about 6.8 GB of blob references. A target-specific live preview found about 3,932 superseded raw snapshots totaling roughly 27.7 GB of referenced bytes.
The first implementation attempt also exposed a startup hazard: building
provider_events(raw_id)as a runtime index on an existing 1.7M-event archive can block too long, so that index must be fresh-schema-only unless an operator explicitly chooses offline cleanup.Solution
polylogue.storage.raw_retentionto plan and execute conservative raw snapshot cleanup: source file must still exist, current conversation raw references are preserved, newest full snapshots and newest append fragments are retained, active leases are skipped, and provider-event raw links are nulled only for explicit cleanup candidates.superseded_raw_snapshotsas apolylogue doctor --cleanup --target ...target.--deepis requested, so a single-target preview does not run broad expensive readiness scans.conversations.raw_idand new provider events do not point at append raw blobs.storage/repair.pyto keep file budgets clean.provider_events(raw_id)index to fresh schema DDL only; existing archives do not build it during ordinary startup.Verification
pytest -q tests/unit/storage/test_raw_retention.py tests/unit/storage/test_repair_blobs.py tests/unit/sources/test_live_watcher.py --tb=short→64 passed in 7.26spytest -q tests/unit/core/test_maintenance_targets.py tests/unit/devtools/test_artifact_graph.py tests/unit/devtools/test_scenario_coverage.py tests/unit/pipeline/test_ingest_batch.py tests/unit/storage/test_raw_retention.py tests/unit/storage/test_repair_blobs.py tests/unit/sources/test_live_watcher.py tests/unit/cli/test_check.py --tb=short→143 passed in 8.96sPOLYLOGUE_FORCE_PLAIN=1 timeout 30 polylogue doctor --cleanup --target superseded_raw_snapshots --preview --format json→ reported3,932candidate snapshots /27,736,902,614referenced bytes in under 1sdevtools render-all --check && devtools verify-file-budgets→ passdevtools verify --json --skip-slow→ pass,exit_code: 0,total_duration_s: 46.64devtools verify --quick→ pass,exit_code: 0,total_duration_s: 33.66Summary by CodeRabbit
Release Notes
New Features
superseded_raw_snapshotsmaintenance target to clean up redundant raw snapshot data.orphaned_blobsmaintenance target to detect and remove unreferenced blob files.Performance
Documentation