anomalyco / anomalyco/opencode

New and incremental core databases do not reclaim deleted pages during their lifecycle

Open
#47,591 0 comments 0 reactions 1 assignee View on GitHub

@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
  1. Initialize a disposable database through Database.layerFromPath; inspect PRAGMA auto_vacuum (currently 0).
  2. In a separate disposable fixture, enable INCREMENTAL offline, insert and delete a 4-MiB payload, retaining one small record.
  3. 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

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.