[Feature]: Add supported retention and compaction for unbounded local SQLite growth #6897
Jules-Astier
started this conversation in
Ideas
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Before submitting
Area
apps/server
Problem or use case
T3 Code's local SQLite database grows without a supported retention or compaction path. Settling, archiving, or deleting a task does not appear to reclaim its persisted activity/event payloads; settling currently behaves like a UI/state override rather than a storage lifecycle operation.
On one macOS installation using
0.0.32-nightly.20260804.997,~/.t3/userdata/state.sqlitereached 3.7 GiB with:A small number of long-running/tool-heavy threads dominated storage. One thread alone held about 215.8 MiB in projected activities. The database remained valid (
PRAGMA quick_check = ok), so this was live retained data, not corruption or free-page bloat.The size eventually contributed to V8 heap OOM crashes during hydration. The desktop UI reported these as a failed local environment connection to
127.0.0.1:3773, obscuring the storage problem.An offline, backup-first maintenance pass that retained only the newest 500 projected activities per thread removed 300,475 projection rows and reduced the database from 3.7 GiB to 2.3 GiB after
VACUUM. It preserved all events, receipts, messages, turns, and threads. That still leaves the append-only event copy unbounded.Proposed solution
Add a supported storage-retention and compaction system for the local SQLite database:
VACUUMsafely when worthwhile, outside latency-sensitive paths.Why this matters
Long-lived T3 installations should not require manual SQLite surgery to stay usable. Unbounded growth consumes disk, increases startup/hydration cost, worsens replay behavior, and can crash the backend on machines with ordinary memory limits.
A supported retention policy would keep local installations stable while making the meaning of “settled,” “archived,” and “deleted” predictable.
Smallest useful scope
A first useful version could:
projection_thread_activitiesper thread,VACUUM,PRAGMA quick_check.This alone reclaimed about 1.4 GiB in the installation above without removing conversation messages or event history.
Alternatives considered
Risks or tradeoffs
VACUUMcan temporarily require substantial free disk and must not run while the database is active.Examples or references
Related but distinct reports:
Those issues describe important producers and consequences. This request is for the missing general-purpose retention, compaction, diagnostics, and task-lifecycle policy.
Contribution
All reactions