feat(task): cancel cascade interrupts live children + surface depth in history tree - #13
Merged
Merged
Conversation
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(task): cancel cascade interrupts live children + surface depth in history tree
Part of the Task Tree unified subtask management plan (issue #9, PR-4). Two focused deliverables:
1. Cancel cascade —
interruptLiveChildrencancelTaskInternal()already handled "cancelled task is a child" (marks itself interrupted, keeps parent delegated) but had no path for the reverse: cancelling a parent whose children are still running in the registry left them streaming as orphans.New private method
ClineProvider.interruptLiveChildren(parentTaskId):childIdsinterrupted/completed) — never overwrites a terminal statusinlineSubtaskphase marker viaabortTask()) and persistsstatus: "interrupted"so the user can resume it latercancelTaskInternal()right after the parent's ownabortTask()settles, fire-and-forget with a logged catch — no-op in the common single-open case where the child is itself the current task (handled by the existing interruption path)The parent's delegation link is left intact, mirroring
markDelegatedChildInterrupted()on the parent side.2. Depth surfacing in the history tree
SubtaskTreeNodegains an optionaldepthfield;buildSubtree(task, childrenMap, expandedIds, parentDepth = -1)now computes it:HistoryItem.depth(written by PR-1's backfill)parentDepth + 1) for legacy items without a depth — an isolated root resolves to 0Tests (~235 lines per plan)
src/__tests__/cancel-cascade.spec.ts(new, 4 cases): aborts live children + marks interrupted; skips terminal children (never overwrites completed/interrupted); skips non-live/evicted children; no-op with no children. Uses the existingmakeProviderStub-style plain-object provider double pattern — zeroas any.webview-ui/src/components/history/__tests__/useGroupedTasks.spec.ts(+3 cases): depth from persisted field; legacy fallback to tree position (root=0, child=1, grandchild=2); explicitparentDepthargument honored. Existing 27 tests unchanged and passing.Verification
pnpm run check-types— 11/11 packages passprovider-delegation,nested-delegation-resume,new-task-delegationall pass unchanged (9/9)--max-warnings=0) clean across both packages; zero eslint suppression count increases