You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
opencode.db grows unbounded - event table (4.1GB after ~6 months) has no retention policy or cleanup command #47729
opencode.db grows without bound because the event table has no retention policy or cleanup command. On a ~6-month-old install: 6.2GB database, of which the event table alone is 4.1GB (655k rows hanging off ~1.1k live event_sequence aggregates — ~600 events per aggregate on average), next to 931MB of part and 338MB of message.
There is no documented way to trim it: session rows can be deleted manually (children cascade), but the event stream for remaining sessions keeps growing indefinitely, and the serve process appears to hold a large heap (~8GB in our case) that seems correlated with database contents.
Proposed solution
Any of:
A built-in retention setting (e.g. keep N days / N events per aggregate)
A opencode db cleanup / vacuum command that prunes old events (and optionally old sessions) safely with the server stopped
Automatic compaction of event history for sessions older than a threshold
OpenCode version
1.18.29 (linuxbrew install)
Operating System
Linux x86_64 (Ubuntu), headless opencode serve behind the OpenChamber web/desktop client.
Additional context
We had to stop the server, hand-write SQLite deletes + VACUUM to reclaim space. Also worth noting: cascading deletes only fire if PRAGMA foreign_keys=ON is set in the maintenance session — the app itself appears to run with FKs off, so manual cleanup needs care.
Thanks for the report! OpenCode 2.0 is now out and development is focused on V2, so we're closing issues filed against OpenCode 1. Please upgrade (opencode upgrade --major, details: https://anoma.ly/notes/opencode-2-0), and if this is still relevant on 2.0, reopen this issue or open a new one with your 2.0 version.
Activity
github-actions commentedon Sep 7, 2026
This issue might be a duplicate of existing issues. Please check:
eventtable: opencode.db reaches 13GB+, mostlymessage.updated.1snapshots (no retention/compaction) #33356: Unbounded growth of theeventtable: opencode.db reaches 13GB+, mostlymessage.updated.1snapshots (no retention/compaction)message.updated.1event snapshotsthdxr commentedon Oct 11, 2026
Thanks for the report! OpenCode 2.0 is now out and development is focused on V2, so we're closing issues filed against OpenCode 1. Please upgrade (
opencode upgrade --major, details: https://anoma.ly/notes/opencode-2-0), and if this is still relevant on 2.0, reopen this issue or open a new one with your 2.0 version.— from 𝕺𝖕𝖊𝖓𝕮𝖔𝖉𝖊