feat(task): track task nesting depth with cycle-safe backfill - #20
Open
easonLiangWorldedtech wants to merge 1 commit into
Open
feat(task): track task nesting depth with cycle-safe backfill#20easonLiangWorldedtech wants to merge 1 commit into
easonLiangWorldedtech wants to merge 1 commit into
Conversation
Part 1/8 of the task-tree series (upstream-ready recomposition). Adds `depth` to HistoryItem and a cycle-safe `backfillTaskDepth()` that propagates parent depth through the delegation tree, so every task knows its nesting level. Depth is surfaced for later use by settings validation, environment details, and history-tree display. Includes the single-open-invariant spec mock for backfillTaskDepth (folded in from the series' CI fix) so this PR passes unit tests standalone. Depth contract hardening: - Children inherit their live parent's depth authority instead of assuming it, so a legacy non-authoritative parent never stamps its placeholder depth onto the child as a persisted fact (regression test added). - computeTaskDepth now processes an ancestor reached after exactly MAX_DEPTH_WALK hops; only strictly longer chains are rejected (boundary regression test added).
easonLiangWorldedtech
marked this pull request as ready for review
August 17, 2026 02:42
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.
Part 1/8 of the task-tree series.
Description
Adds a validated
depthto history items and a cycle-safebackfillTaskDepth()that propagates parent depth through the delegation tree, so every task knows its nesting level. Depth is surfaced for later use by settings validation, environment details, and history-tree display (later parts of this series).Contract rules:
Includes the single-open-invariant spec mock for backfillTaskDepth so unit tests pass standalone.
Test Procedure
pnpm --dir src exec vitest run core/task/__tests__/taskDepth.spec.ts core/task/__tests__/Task.spec.ts __tests__/single-open-invariant.spec.tsPre-Submission Checklist