Skip to content

Commit c4f3841

Browse files
authored
🤖 fix: auto-clean completed sub-agents again (#2892)
Summary - restore automatic cleanup for completed sub-agent workspaces instead of retaining them in the sidebar indefinitely - keep the patch-artifact safety gate so exec-style sub-agents still finish artifact generation before deletion - preserve the interrupted+reportedAt self-heal so stale completed rows can still be recognized and pruned Background PR #2836 intentionally kept completed sub-agents around for optional sidebar expansion. That was an undue UX consideration in practice: once a sub-agent had finished, or had already produced a completed report before later showing as `interrupted`, it could stick around forever unless the user manually deleted it. Sub-agents used to disappear when they were no longer in use, and this restores that behavior. Implementation - restore structural-leaf cleanup in `TaskService.cleanupReportedLeafTask()` so completed descendants are deleted again - require ancestors to have no remaining child task nodes before they can be auto-deleted, which avoids orphaning siblings while still allowing cleanup to cascade upward once the last child is gone - keep the restart/patch-artifact recheck path so exec and exec-derived tasks still generate their patch artifacts before cleanup resumes - update task-service regressions to cover immediate cleanup, cleanup-after-patch, upward cascade, and interrupted+reportedAt deletion Validation - `bun test src/node/services/taskService.test.ts` - `make static-check` Risks - Users lose the ability to browse completed sub-agent lineage from the sidebar once cleanup runs. That is the intended tradeoff here: the prior retention behavior regressed the default UX by leaving stale sub-agents around indefinitely. --- _Generated with `mux` • Model: `openai:gpt-5.4` • Thinking: `xhigh` • Cost: `$1.05`_ <!-- mux-attribution: model=openai:gpt-5.4 thinking=xhigh costs=1.05 -->
1 parent bfe106b commit c4f3841

2 files changed

Lines changed: 158 additions & 108 deletions

File tree

0 commit comments

Comments
 (0)