Repository navigation
feat(desktop,mobile): a conversation delete takes its child sessions - #866
Merged
Merged
Conversation
Deleting a parent conversation left its children behind, re-rooted in the sidebar with a lineage pointing at a session the user had just removed. Desktop and phone deletes are now recursive. - `store::delete_thread_tree` deletes a thread and every descendant it parents in one transaction (tombstoning each removed thread's Agent session, flagging each chat thread's temporary workspace, and removing those directories when `delete_files`). The lineage is walked by Agent session id (`parent_session_id`) with a recursive `UNION` CTE, so a malformed cycle terminates instead of recursing forever. - `store::delete_thread` keeps its single-thread meaning: the orphan sweep and the reaction to a session deleted outside the GUI must not take live children with them - a child is a projection of its own Agent session. - The desktop delete path resolves `store::thread_delete_closure` first, so every removed thread's shells close and its active run stops before the rows go. The batch command no longer reports a selected child of a selected parent as a failed deletion. - The phone's `delete_session` reply is idempotent (already gone is success), because the phone walks a selection one session at a time. - Mobile drops the deleted session's local subtree (pinned children included) and closes the conversation when the selection was one of them. Docs: PRODUCT/ER now state that a user delete is recursive and which paths are not.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Deleting a parent conversation left its children behind: each child re-rooted in
the sidebar as a conversation whose lineage pointed at a session the user had
just removed. Deleting a conversation from the desktop GUI or the phone now
takes its descendants with it, recursively, including each child's temporary
chat workspace.
Store
store::delete_thread_treedeletes a thread and every descendant it parents inone transaction: each removed thread's Agent session is tombstoned, each
chat-mode thread's temporary workspace is flagged for cleanup (and its
directory removed when
delete_filesis set, exactly like the root's).parent_session_idholds theparent's session id, not its thread id) via a recursive
UNIONCTE, so amalformed cycle terminates instead of recursing forever, and archived /
legacy soft-deleted children are not left behind as rows.
store::delete_threadkeeps its single-thread meaning on purpose: the orphansweep and the reaction to a session deleted outside the GUI (TUI/CLI) must not
take live children with them — a child is a projection of its own Agent
session and keeps working.
docs/internals/desktop/ER.mdnow says which pathcascades and which does not.
Desktop
store::thread_delete_closurebefore touchinganything, so every removed thread's shells close and every active run stops
before the rows go (a busy child cancels the delete, exactly like a busy root).
failed deletion (the parent's cascade already removed it).
Mobile
delete_sessionreply is idempotent: already gone is success.The phone walks a selection one session at a time, so with a cascade that
sequence naturally contains a child the parent already removed.
children included — a pin moves a child in the list, not in the lineage) and
closes the conversation when the selected session was one of them.
Tests
tombstoned, unrelated thread kept; the single-thread delete keeps the child and
its lineage; each chat workspace directory removed; a lineage cycle terminates.
failure; the remote
delete_sessionreply is idempotent on a repeat.deleteSessiondrops the subtree and closes a selected descendant.Local checks (Windows):
cargo fmt --checkclean; desktopcargo test1291passed with the same 4 pre-existing platform failures seen on a pristine tree
(
\\?\canonicalization,~expansion, POSIX shell) plus one flakytiming test that passes in isolation; clippy reports nothing outside the
pre-existing Windows-only dead-code items in
src/terminal. Mobile:tsc --noEmitandeslintclean,src/remote50 suites / 1115 tests pass.