Repository navigation
feat(server): archive and unarchive cascade to subagent threads - #18668
Closed
florin-szilagyi wants to merge 2 commits into
Closed
florin-szilagyi wants to merge 2 commits into
florin-szilagyi wants to merge 2 commits into
Conversation
The cascade lived in ThreadLifecycleService, which no client transport calls: the websocket handler routes commands through ThreadMessageIntake into ThreadManagementService.dispatch, so archiving from any client archived only the target thread. Move the cascade into ThreadManagementService.dispatch. Archive and unarchive commands now dispatch to transitive subagent descendants first (parent before child, derived command ids) and to the target last. The legacy sidebar's multi-select skips entries a selected ancestor's cascade already covers, so a hand-selected parent+child batch no longer fails on the child's redundant dispatch.
Member
|
Note 🤖 Claude Opus 5.5 responding on behalf of Theo Closing because this PR states that GLM and Kimi wrote code in it:
We do not accept code written by GLM, Kimi, MiniMax, Mistral, Gemini, or alpha models, or by Muse models other than Muse Wonder Full. See Models we do not accept. To have this considered again, open a new PR with the code written by a different model and link this one. |
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.
feat(server): archive and unarchive cascade to subagent threads
Discussion: #18656
Problem
Archiving a thread leaves its subagent threads behind in the active list. They render as orphaned flat rows. The undo toast unarchives only the parent, so they stay buried.
What changed
ThreadManagementService.dispatchnow cascadesthread.archiveandthread.unarchive: the command dispatches to every transitive subagent descendant first, parent before child, and to the target last. A descendant failure aborts the operation before the target is touched. Forks are not touched.Descendant commands derive their command id from the input one (
<commandId>:<threadId>), because the orchestrator replays receipts by command id and a shared id would collide.The cascade lives in
dispatchbecause every client transport routes through it (the websocket handler goes viaThreadMessageIntake.dispatchCommand). A higher-level service would only cover the callers that remember to use it.The legacy sidebar's multi-select archive skips entries whose subagent ancestor is also selected, since the cascade already covers them. Without this, the redundant child dispatch fails as "already archived" and aborts the batch.
One deliberate trade-off: unarchiving a parent also restores subagent threads the user archived individually.
Testing
./node_modules/.bin/vp test run apps/server/src/orchestration-v2/ThreadManagementService.test.ts apps/server/src/orchestration-v2/ThreadLifecycleService.test.ts apps/web/src/components/Sidebar.logic.test.ts: 192 passed. Covers cascade order for archive and unarchive (including a subagent grandchild, a fork, and an unrelated thread that must not be dispatched), abort on descendant failure, and the multi-select dedupe.pnpm run typecheckinapps/serverandapps/web: no errors.Built and tested with Claude Code (GLM 5.3 Flash and Kimi K3).