Repository navigation
Description
Area
apps/server
Steps to reproduce
- On Orchestrator V2, run a thread for one turn with at least one tool call.
- Delete it from the sidebar. The dialog says: "This permanently clears conversation history for this thread."
- With the server running or stopped, open
statev2.sqliteread-only and count the thread's rows:SELECT count(*) FROM orchestration_events WHERE aggregate_kind = 'thread' AND stream_id = :thread_id; SELECT count(*) FROM orchestration_v2_projection_turn_items WHERE thread_id = :thread_id; SELECT count(*) FROM orchestration_v2_projection_messages WHERE thread_id = :thread_id;
Expected behavior
The thread's conversation history (messages, turn items with tool output, reasoning, and the events that carry them) is removed from the database, as the dialog says. A minimal tombstone may stay so clients drop the thread.
Actual behavior
Every row stays. planThreadDeletion (apps/server/src/orchestration-v2/ThreadDeletion.ts:58) emits thread.deleted with deletedAt and cancels open work; nothing deletes rows. The projection gets deleted_at set, and reads filter on it. Each delete also appends more events (the delete plus the cancellations).
On one install, a thread deleted on 2026-10-08 still has all 48 of its events (48.6 KB of payload), 6 turn items and 2 messages. Across that install, 45 deleted threads still hold 365 MB; 44 of them were deleted before the V2 migration, so that total also reflects V1 behavior.
The dialog text is in apps/web/src/components/Sidebar.tsx:4807 and :4460 (bulk), apps/web/src/hooks/useThreadActions.ts:992, and apps/web/src/hooks/useThreadActionMenu.ts:318.
ProjectionMaintenance.compactEventStore does not help. It keeps the newest event of each kind and never removes a deleted thread's history; besides, nothing in production calls it (#15759, #16558).
Impact
Minor bug or occasional failure
Version or commit
Observed on nightly 0.0.46-nightly.20261007.2787. Same code on main @ 8c777fbfad (checked statically).
Environment
Linux x86_64, headless T3 server, Orchestrator V2.
Logs or stack traces
deleted threads in orchestration_v2_projection_threads: 45 (1 deleted after the V2 migration)
that V2-era thread: events 48 (48,642 payload bytes), turn items 6, messages 2
all deleted threads together: ~365 MB logical across events, turn items and nodes
Workaround
None in the app. Rows can be removed only by hand with the server stopped, followed by VACUUM. auto_vacuum is off, so deleted pages do not shrink the file.
Either the delete should purge the thread's history (events, receipts, projections, keeping a tombstone), or the dialog should say the thread is hidden, not cleared. Which one is the maintainers' call. A purge path is the bigger change and overlaps the retention discussion in #6897.
Drafted with Claude Opus 5.5 in Claude Code (T3 Code harness); counts measured read-only on the install above.
🤖 Generated with Claude Code
Activity
alexmorris0n commentedon Oct 12, 2026
Confirming on Linux nightly 0.0.46: deleting or archiving threads frees no space, since their events and projection rows stay in statev2.sqlite. With no retention setting, the DB reached 41.6 GB in about 6 weeks. A delete that actually removes a thread's events and projections, or a retention window for settled threads, would help a lot.
josephv123 commentedon Oct 15, 2026
Additional consolidated confirmation on nightly
0.0.46-nightly.20261014.3132; relevant metadata-upsert/deletion behavior still present ate536bfd33bc3c351997141d93790df75eeded7b9.Read-only query on database copies:
The event counts include imported legacy history and overlap #18559. This is not 51.6 MB of independently additive V2-era growth, nor evidence of a CPU stall. It confirms that the deleted-thread tombstone does not remove the associated stored history. Invoking the existing compactor alone would not fulfill the delete dialog's promise. No live rows were deleted or vacuumed.
grasdal commentedon Oct 28, 2026
Additional storage-pressure observation from macOS. This is a retention report, not a claim that all measured bytes belong to deleted threads.
A saved read-only table-allocation audit from October 27 UTC measured approximately 26.24 GiB in
orchestration_eventsand 15.36 GiB inorchestration_v2_projection_turn_items. Those are historical table sizes, not deletion-eligible byte counts or independently additive recovered space. We have not established how much is legacy/imported history or attributable specifically to deleted threads.On October 28, 2026 at 04:01 UTC, a fresh bounded metadata-only read found:
The connection used SQLite URI
mode=ro, connection-localquery_only, and a one-second busy timeout. Only file metadata, PRAGMAs and bounded schema names were read. No event payloads, thread text, row deletion, checkpoint, VACUUM, doctor repair, database copy or server pause was used. File and WAL observations are live and need not form an atomic filesystem snapshot. The installed T3 build was not captured in this read; this is not a claim about current upstream main.Our current
auto_vacuum=2differs from the original report's disabled setting. Zero freelist pages means no already-free page pool was shown by this observation; it does not identify which retained history can safely be retired. We are leaving the original database intact.Could maintainers identify the supported retention/compaction path for legacy events and retained thread projections, including integrity and interruption handling? A bounded dry-run report that separates active/retained history, deleted-thread history and actually reclaimable storage would help operators choose a supported route. We prefer attaching this observation here over creating a duplicate issue; the legacy-event portion may also belong with the existing retention/imported-history discussions.
L-Blondy commentedon Oct 29, 2026
Fresh data point from a heavier install, nightly
0.1.5-nightly.20261029.3867(Linux x64, headless server, Orchestrator V2). Here deleted-thread history is ~90% of the database, not a minor leak.statev2.sqlite: 25.9 GB after 3 weeks (first event 2026-10-08).freelist_count0,auto_vacuum0.orchestration_events: 3.23M rows, 12.5 GB table + ~3.5 GB indexes. 2.93M rows (91%, ~8.0 GB payload+metadata) belong to deleted threads.orchestration_v2_projection_turn_items: 5.6 GB; 664k of 723k rows (92%) belong to deleted threads.Workflows that spawn many short-lived threads make this the dominant storage cost. #24924 fixes the dialog text, but a purge (or a retention window for deleted threads) is what would bound the DB.
Measured read-only (
node:sqlite,mode=ro,dbstat). No rows changed.Drafted with Claude Opus 5.5 following the
t3 triageplaybook (Claude Code via T3 Code).VDrozd-Cyclis commentedon Oct 30, 2026
Note
Claude Opus 5.5 (Claude Code) writing on behalf of Vincent.
Data point from 0.1.5 stable (macOS 27.2, Apple Silicon, desktop app). Here deleted threads are a small share of the database, so a delete that actually purges would reclaim little. Most of the growth comes from threads that are still live.
statev2.sqliteis 18 GiB after 22 days (first event 2026-10-08).freelist_countis 0 andauto_vacuumis 0, soVACUUMreclaims nothing.orchestration_eventstable and 6% of the 3.8 GiBorchestration_v2_projection_turn_itemstable, asdbstatreports them.The delete dialog's promise is still unmet on stable. On an install like this one, though, only a retention window for settled threads (#6897) would bound the file.
Measured read-only (
mode=ro) on the live database. No rows were changed.AnalogCyan commentedon Oct 30, 2026
Additional data from a headless Linux server on 0.1.6-nightly.20261030.3917 (97e35bc), which includes the eligible turn-item compaction fix cited in #19780.
A consistent SQLite online backup was measured and the installed doctor was rehearsed only on a second disposable copy. No live database repair or server restart was performed.
Before repair: 9,984,724,992 bytes. Table plus owned-index allocation was 6,115,880,960 bytes for orchestration_events, 2,469,965,824 for projection_turn_items and 738,500,608 for projection_nodes. The copy had only 161 free pages; 1.826 GB was unused inside allocated pages, which was not all reclaimable packing space.
Doctor exited 0 in 899.6 seconds, removed 472 superseded events, and produced 9,643,323,392 bytes: a 3.42% reduction. Both copies passed integrity_check; primary-key-sorted digests of 31 projection/control tables were identical. The exact installed T3 CLI opened the repaired result through its read-only doctor inspection. That is not a claim of full UI replay testing. Production repair was cancelled because the measured benefit did not justify downtime.
Most bytes therefore remain in retained canonical events and projected turn items, rather than an already-free page pool. Current deletion/archiving does not retire those rows. Could maintainers confirm the supported path for bounding this retained history, and the intended status of #22630? Its proposed event-retention floor would help the event log, but canonical turn-item projections would remain.
A supported dry-run report separating active/dependency-protected history, eligible retired-thread history and actually reclaimable bytes would help. For a purge/retention or compressed-archive path, we would want explicit handling of fork/context references, prompt references, command retries/receipts, queued child deliveries, restart interruption and downgrade/restore boundaries before clone testing a release.
No private thread IDs, titles, content, credentials, host addresses or backup files are attached here.
excenter commentedon Nov 2, 2026
Note
🤖 Claude Sonnet 5.5 (Claude Code) writing on behalf of
excenterData point on 0.1.6 (macOS, desktop app, Orchestrator V2): one soft-deleted thread still has 233 events (348 KB of payload) in
orchestration_events, 7 messages and 39 turn items. Searchingpayload_jsonfinds message text verbatim, so the content is recoverable. I haven't checked the search-index tables (orchestration_v2_message_search*).Related: the provider event logs (
logs/provider/events.<threadId>.log) also survive a thread delete; I opened #29030 for an opt-out there and left the database side to this issue.chris-sanders commentedon Nov 3, 2026
Note
Written by Claude Opus 5.5 (Claude Code) on behalf of the reporter. All numbers are read-only aggregates from the live database.
Data point on
0.1.7-nightly.20261102.4093(Linux x86_64, headless), measured 2026-11-03 on a 12.83 GBstatev2.sqlite.The reporter deleted 36 old threads through the app, and about two hours later the file had grown slightly, from 12.83 GB to 12.85 GB.
freelist_countstayed at 0.Across all 51 threads with
deleted_atset, of 1,071 in total:orchestration_eventsThese are row counts, not bytes. Threads deleted as long ago as 2026-10-06 are still in the table, and the five deleted-thread event streams I sampled before today's deletions all still had their events, turn items and nodes, so this isn't a delay that clears up over time.
On this install, deleted threads are a bigger share than the roughly 4–6% reported above but well below the ~90% case. Purging them would help, but it wouldn't bound growth on its own; that's #28903.
PR #29806 would prune most of the old events, but as far as I can tell from its description, the deleted threads' turn items and nodes would stay, so this issue would still apply to them.
realhasanshoaib commentedon Nov 7, 2026
Data point and a fix proposal. macOS,
0.1.8-nightly.20261107.4301, one heavy user.statev2.sqlitewas 11.6 GB. I deleted 3,475 threads older than a week throughthread.delete. Afterwardst3 doctor --dry-runreported 0 KiB reclaimable, because the delete only setsdeleted_atand every projection row stays.thread_idbelongs to a deleted thread, in one transaction: turn items and their positions (570k each), nodes (475k), messages (85k), and about 80k rows across runs, attempts, provider turns/threads/sessions, checkpoints, subagents, handoffs, runtime requests and plans.PRAGMA quick_checkwasok.t3 doctor --fixthen took the file from 10.97 GiB to 4.12 GiB. T3 started normally; the thread list and thread reads worked.So on this install about 60% of the database was content that deleted threads can never show again. I opened #32378, which makes the existing projection maintenance purge it once a thread has been deleted for longer than
RETAINED_EVENT_HISTORY, keeping the thread row as the tombstone.hoop-ai commentedon Nov 12, 2026
Note
Written by Claude Opus 5.5 (Claude Code) on behalf of the account owner. All numbers are read-only measurements from one install.
Data point on
0.1.8-nightly.20261109.4433(Windows 11 Pro, desktop app with the bundled server, Orchestrator V2), measured on 11 Nov 2026:orchestration_eventsand the V2 projection tables.statev2.sqlitewas 39.1 GB at about 01:00 and 40.1 GB at about 17:00 the same day, so it grows roughly 1.5 GB a day. The freelist is 0 pages, soVACUUM, the reclaim action andt3 doctorgain nothing.ProjectionMaintenance.pruneEventStore(every 6 h, 1-day retention) trims onlyorchestration_events. We found noDELETE FROMfor the thread, run, node, message or turn-item projection rows of deleted threads. Dynamic SQL could be missed.sql.transactionspans of up to 27.2 s and 16 failed transactions.event-loop-stalls.ndjsonlogged 1,583 stalls of 2 s or longer between 25 Oct and 11 Nov, the longest 76.7 s. We did not prove the stalls come from the file size.A purge after a grace period, or a "purge deleted threads" maintenance step that works in small batches, would fix this for us. Related: #32378.
cristianuibar commentedon Nov 13, 2026
Data point from a headless server where scheduled tasks start most threads.
0.1.10-nightly.20261113.4630, Linux x86_64, Orchestrator V2, measured 2026-11-13 with read-only queries.statev2.sqliteis 7.62 GiB after about three weeks (first thread 2026-10-22).freelist_countis 0, andt3 doctor --dry-runreports 96 KiB reclaimable.orchestration_v2_projection_turn_itemswith about 2.2 GB ofpayload_json. The legacyorchestration_eventstable still holds 162k rows (about 340 MB).We had planned to delete the old automation threads and then run
t3 doctor --fix. Given this issue, that would free nothing, so we stopped. #32378 would fix this for us.A second gap for headless installs:
t3 threadhaslist,start,sendandshowbut nodelete, so a server whose threads come from scheduled tasks cannot remove old ones without the UI. With #32378 merged, at3 thread delete <id>(orthread.deleteexposed to scripts some other way) would make the whole cleanup scriptable.grasdal commentedon Nov 13, 2026
Another data point from the macOS desktop app: my 1,870 deleted threads still hold about 3.8 GB of history in
statev2.sqlite, almost all of it full command and tool output in turn items. The database is 38 GB with nothing reclaimable, so deleting threads frees no space today. #32378 would fix this for me.Measurements
Environment: T3 Code (Nightly) desktop
0.1.10-nightly.20261113.4643, macOS, Orchestrator V2. Read-only queries on 2026-11-13.statev2.sqlite: 38.06 GiB, page_size 4096, 9,977,815 pages,freelist_count0.t3 doctor --dry-runreports 0 KiB reclaimable.deleted_atset (deleted 2026-10-04 to 2026-11-12), 4,507 archived.Rows that still belong to deleted threads:
payload_jsonorchestration_v2_projection_turn_itemsorchestration_v2_projection_nodesorchestration_v2_projection_messagesIndex pages for these rows come on top of the payload sizes.
Largest objects from
dbstat(whole database):orchestration_v2_projection_turn_items22.02 GiB,orchestration_v2_projection_nodes4.75 GiB,orchestration_events3.93 GiB. A random sample of 6,000 turn items puts 53% of turn item bytes incommand_executionitems (13 KB average, 1.9 MB max) and 39% indynamic_toolitems (35 KB average, 1.1 MB max).hkarlsen06 commentedon Nov 16, 2026
Note
🤖 Claude Opus 5.5 responding on behalf of hkarlsen06
Still present on
0.1.10-nightly.20261116.4761(macOS 27.3, arm64, desktop app). This install also shows that a purge keyed ondeleted_atwould miss about 40% of the deleted history: subagent threads are never marked deleted when their parent is.The
ThreadDeletion.planThreadDeletionin the shipped 0.1.10 bundle emitsthread.deletedonly forcommand.threadId. Its subagent threads keepdeleted_at = NULL, so they stay "live" with all their turn items. #23900 (the fix for #17812) only taught worktree cleanup about these children; the threads themselves remain.Numbers from a 6.16 GB
statev2.sqlite(auto_vacuum2,freelist_count0, auto-compacted the same morning), measured read-only:deleted_atset)deleted_atNULLSizes are
payload_jsonbytes. Deleted threads plus their orphaned subagents hold 62% of all turn-item payload. 1,131 of the orphans belong to 570 top-level threads deleted within four minutes on 2026-11-08, well after #23900 merged; none of their children were marked deleted. The other 7 date from 2026-10-08.With compaction running, events are no longer the cost here; turn items and nodes are. A purge for this issue needs to take the subagent chain (
lineage.parentThreadId/rootThreadId) with the deleted thread, or deletion has to cascade to the children first. #33884 is the archive version of the same missing cascade.Neither "Restart and reclaim" (
t3 doctor) nor Storage cleanup touches these rows, so there is still no in-app way to reclaim the space.fevernova90 commentedon Nov 16, 2026
Another data point: Windows 11, T3 0.1.9 stable, 32 GB RAM, many agents with delegates. I read these on 2026-11-16 over a read-only connection.
statev2.sqliteis 6.36 GB with 0 free pages, sot3 doctorhas little to reclaim.orchestration_v2_projection_turn_itemshas 333k rows (about 1.9 GB, estimated from row sizes) andorchestration_v2_projection_nodeshas 291k rows (about 0.8 GB). The event-log prune works: 245k events are left of 1.59M.selectShellItemCountsover the 2,888 non-archived threads takes 12.8 s with a cold page cache and 0.14 s warm. When agents fill RAM, Windows drops the cache, and the next shell snapshot runs cold.event-loop-stalls.ndjsonshows stalls up to 98.7 s today. I expect fix(server): a slow database write no longer freezes the server #35728 to fix those once it ships in a stable release.A retention setting would help most here: hard-delete turn items, nodes and runs for threads that have been deleted, archived or settled for N days, and for sub-agent threads once their root thread settles. That overlaps #15122 and #33884.
Sent by Claude
xwchen commentedon Nov 16, 2026
Note
🤖 Claude responding on behalf of xwchen
Another data point: macOS desktop app,
0.1.10-nightly.20261115. These were read over a read-only connection on 2026-11-16.statev2.sqliteis 25.9 GB with 68 free pages. It grew 225 MB in 39 minutes of normal use, and it filled the disk once today (SQLITE_FULL).orchestration_v2_projection_turn_itemsholds 10.2 GB, plus 2.1 GB of indexes. Its payload grows 0.27 to 0.75 GB a day. Most of that is MCP tool output (3.5 GB) and command output (2.1 GB).ProjectionMaintenance.pruneEventStorekeepsorchestration_eventsin check. The projections have no retention at all.Request: alongside the delete fix, add a retention window for archived threads. For example, drop tool and command output in turn items older than N days on archived threads, keep the messages, and make N configurable. Today the only lasting relief is a VACUUM, and that needs twice the file's size in free disk.
hoop-ai commentedon Nov 20, 2026
Note
Written by Claude Opus 5.5 (Claude Code) on behalf of the account owner. The numbers below are from one Windows install.
Another data point: the database was 50.1 GB on 18 November and 62.2 GB on 20 November, an increase of 12.1 GB across those dated measurements. Deleting threads did not reclaim space. This is a file-size observation; it does not establish how much of the growth was caused by deleted history.
Luzivog commentedon Nov 23, 2026
Adding live production disk measurements from a heavy 24/7 host running
0.1.12-nightly.20261122.5111:statev2.sqlitehas reached 40.67 GB (9,914,606 pages, freelist 0 soVACUUMcannot reclaim space, plus a 134 MB WAL).dbstatbreakdown:orchestration_v2_projection_turn_items: 17.80 GB (~2.69M rows, ~6.6 KB/row storing full command/tool outputs inline) + ~5.6 GB across its 7 indexes andturn_item_positions.orchestration_events(legacy v1 table): 5.50 GB (14.3M rows, still actively written in v2) + ~1.2 GB indexes.orchestration_v2_projection_nodes: 5.40 GB + ~1.5 GB indexes.orchestration_eventswould cut DB size dramatically.postoso commentedon Nov 23, 2026
Note
Written by Claude (Claude Code) on behalf of postoso. All numbers are read-only measurements from one install.
Data point from the macOS desktop app,
0.1.12-nightly.20261122.5111, Orchestrator V2, measured 2026-11-23 on an APFS clone of the database opened read-only. Like the 30 Oct and 16 Nov reports above, this install has almost nothing in deleted threads. Here the space sits in finished subagent threads.statev2.sqliteis 45.8 GB with no free pages. It holds 15,517 threads, and 15,307 of them are children of another thread. I summed the storedpayload_jsonbytes per thread (turn items, nodes, messages, v1 events, checkpoints, provider turns and runs, 23.9 GB in all) and grouped the threads by kind and by time since their last activity:By turn-item type,
command_executionholds 9.2 GB of payload,dynamic_tool4.4 GB,file_change1.4 GB andreasoning1.4 GB. Assistant and user messages together are 0.7 GB.So 72% of the stored payload belongs to child threads that have been idle for more than a day. I rarely delete a thread, and I would not think to delete finished subagent threads by hand, since there are thousands of them and they are not in the sidebar. Deleted threads hold 0.0 GB here, so a purge of deleted threads has nothing to take on this install.
This is the same request as the retention window asked for above, with one detail from this install: the window would need to cover idle child threads whose parent is still live, because that is where the bytes are. Keeping a finished child's final report and dropping its tool output after N days would reach most of it.