anomalyco / anomalyco/opencode
New and incremental core databases do not reclaim deleted pages during their lifecycle
@neriousy is already working on this.
Since Sep 6, 2026.
- Dominant language
- TypeScript
- Stars
- 209k
- Forks
- 27.5k
- PR merge metrics
- PR metrics pending
Description
Description
Scoped follow-up to #31526: new core databases use auto_vacuum=NONE, and opening an already-INCREMENTAL database or deleting an event aggregate does not reclaim its free pages.
Expected: enable incremental reclamation for new databases and make bounded, best-effort progress on compatible databases after initialization and aggregate deletion. Preserve retained records and existing NONE/FULL modes; do not perform a full startup VACUUM.
Legacy database conversion and live-event retention remain outside this issue, tracked by #31526 and #33356. Draft #47589 implements this limited fix; this issue records its acceptance scope without closing those broader reports.
Plugins
None in the isolated reproduction.
OpenCode version
Source dev at 337fd144d2ba144743368f78d9579a99cce175bd.
Steps to reproduce
- Initialize a disposable database through
Database.layerFromPath; inspectPRAGMA auto_vacuum(currently 0). - In a separate disposable fixture, enable INCREMENTAL offline, insert and delete a 4-MiB payload, retaining one small record.
- Reopen through the same layer: the freelist does not decrease. Aggregate deletion likewise has no reclamation pass.
Reproduction tests are in #47589: from packages/core, run bun test test/database-storage.test.ts. The new-file and reclamation assertions fail against the original implementation and pass with the proposed patch. No real session data is needed.
Operating System
macOS, Bun 1.3.14; additional production-layer smoke test under Node 24.15.0.
AI-assisted investigation and report.
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Assessment
This issue has not been assessed yet.