GeezerVison is showing github.com — storage: shared `event` table grows unbounded; retention prune never reclaims disk space · Issue #56827 · anomalyco/opencode
storage: shared event table grows unbounded; retention prune never reclaims disk space #56827DescriptionEnvironment
opencode v1.19.0, Linux x86_64, ~10 concurrent long-lived opencode instances sharing one ~/.local/share/opencode/opencode.db (SQLite WAL), uptime of instances: days.
What happened
The append-only event table (event-sourcing of all session state changes across all instances) grew to 9.8 GB — 76% of a 12.85 GB database over ~2 weeks, despite cleanup prune=7.days running hourly.
Key observations from forensics on the resulting database:
- DELETE-based retention never shrinks the file (no auto_vacuum / VACUUM), so the file only grows.
- With N long-lived reader connections, WAL auto-checkpoint is starved (0.8 GB WAL observed alongside the main file).
- Pruning a multi-GB B-tree produces sustained ~100+ MB/s of page-churn writes from whichever instance holds the writer lock — for a HIL bench host this looked like a runaway process and ultimately filled the root filesystem.
- After disk-full (ENOSPC mid-transaction) the table scanned as empty while still occupying 9.8 GB of live pages (not on the freelist) — the delete/rollback sequence orphaned the pages.
Ask
- Incremental vacuum (or post-prune reclaim) for retention paths.
- Per-table retention/size bounds for
event.
- A WAL checkpoint strategy that survives long-lived multi-instance readers.
Happy to provide more forensic detail (page footprints, WAL frame data, log timelines). Activityopencode-agent commented on Oct 18, 2026 Thanks for the detailed forensics, @Amperstrand.
This report is about opencode v1.19.0. v1 now only gets fixes for critical bugs (data loss, security, or breakage with no workaround), so this is unlikely to be changed in v1. Until then, you can get the space back by stopping all instances and running sqlite3 ~/.local/share/opencode/opencode.db 'PRAGMA wal_checkpoint(TRUNCATE); VACUUM;'. Make sure there's enough free disk for the copy VACUUM writes.
Work happens on v2 (@opencode/cli), and we'd encourage you to upgrade. Related v2 work:
Earlier v1 reports of the same thing were #47223 and #53760.
If you see the same growth, or the starved WAL checkpoints with many instances, on v2, or you think this is critical on v1, please reply here with the details.
opencode-agent commented on Oct 19, 2026 We haven't heard back, so I'm closing this as not planned. The report is about opencode v1.19.0, and v1 now only gets fixes for critical bugs. Unbounded event table growth is a known problem: v2 tracks it in #33356, and #56365 proposes incremental auto-vacuum. Until then, stopping all instances and running PRAGMA wal_checkpoint(TRUNCATE); VACUUM; gets the space back.
Thanks again for the detailed forensics. If you see the same growth or the starved WAL checkpoints on v2 (@opencode/cli), please reply with the version and details and we can reopen.
MetadataMetadataDevelopmentNo branches or pull requestsIssue actions
|