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
[Bug]: Deleting a thread says it permanently clears its history, but V2 keeps every event and projection row #17845
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.sqlite read-only and count the thread's rows:
SELECTcount(*) FROM orchestration_events WHERE aggregate_kind ='thread'AND stream_id = :thread_id;
SELECTcount(*) FROM orchestration_v2_projection_turn_items WHERE thread_id = :thread_id;
SELECTcount(*) 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.
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.
Additional consolidated confirmation on nightly 0.0.46-nightly.20261014.3132; relevant metadata-upsert/deletion behavior still present at e536bfd33bc3c351997141d93790df75eeded7b9.
History belonging to deleted threads
Linux: 28 deleted threads
Mac: 81 deleted threads
Events: rows / payload bytes
7,386 / 13,530,469
28,901 / 38,063,897
Turn items: rows / bytes
432 / 585,236
1,055 / 1,204,264
Messages: rows / bytes
339 / 302,647
1,034 / 872,823
Nodes: rows / bytes
63 / 62,658
21 / 21,248
Read-only query on database copies:
SELECTcount(*), sum(length(CAST(e.payload_jsonAS BLOB)))
FROM orchestration_events e
JOIN orchestration_v2_projection_threads t ONt.thread_id=e.stream_idWHEREt.deleted_atIS NOT NULL;
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.
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.