Skip to content

bug: Subtask dependencies are incorrectly assigned and break validation #975

@chun92

Description

@chun92

Description

When expanding a task into subtasks using task-master expand, each subtask is assigned dependencies referencing only the subtask's numeric ID (e.g., 2, 3, etc.). However, these dependencies are not treated as fully-qualified IDs (like 16.2), which leads to broken references and validation errors. Additionally, these dependencies are not visible in the task-master show command, making the issue harder to notice.

Furthermore, if a subtask is promoted to a full task via task-master move, its dependency is preserved as-is (e.g., 8) rather than updated to reflect its new context, further compounding the issue.

Steps to Reproduce

  1. Start with a clean state and create a new task.

  2. Run task-master expand --id=16 --num=0 to expand the task into subtasks.

  3. Observe that the generated subtasks have sequential numeric IDs and dependencies:

    "subtasks": [
      { "id": 1, "dependencies": [] },
      { "id": 2, "dependencies": [1] },
      { "id": 3, "dependencies": [2] },
      ...
      { "id": 9, "dependencies": [8] }
    ]
  4. Promote the last subtask to a new task:

    task-master move --id=16.9 --to=21
  5. Run validation:

    task-master validate-dependencies
  6. Observe that dependency errors are reported:

    [ERROR] Dependency validation failed. Found 8 issue(s):
    [ERROR]   [MISSING] Task 16.2: Subtask 16.2 depends on non-existent task/subtask 1 (Dependency: 1)
    [ERROR]   [MISSING] Task 16.3: Subtask 16.3 depends on non-existent task/subtask 2 (Dependency: 2)
    [ERROR]   [MISSING] Task 16.4: Subtask 16.4 depends on non-existent task/subtask 3 (Dependency: 3)
    [ERROR]   [MISSING] Task 16.5: Subtask 16.5 depends on non-existent task/subtask 4 (Dependency: 4)
    [ERROR]   [MISSING] Task 16.6: Subtask 16.6 depends on non-existent task/subtask 5 (Dependency: 5)
    [ERROR]   [MISSING] Task 16.7: Subtask 16.7 depends on non-existent task/subtask 6 (Dependency: 6)
    [ERROR]   [MISSING] Task 16.8: Subtask 16.8 depends on non-existent task/subtask 7 (Dependency: 7)
    [ERROR]   [MISSING] Task 21: Task 21 depends on non-existent task 8 (Dependency: 8)
    

Expected Behavior

  • Dependencies within subtasks should be stored using fully-qualified IDs in the form of <parent_id>.<subtask_id> (e.g., 16.2, 16.3, etc.).
  • task-master validate-dependencies should not fail due to invalid subtask references.
  • When promoting a subtask to a standalone task, its dependencies should be rewritten appropriately or dropped if invalid.
  • The task-master show command should optionally display subtask dependencies to reveal these issues in the UI.

Actual Behavior

  • Subtask dependencies are stored as numeric-only IDs (e.g., 2, 3, etc.), causing them to be interpreted as global task IDs.
  • These invalid references are not visible via task-master show, making them difficult to detect.
  • Promoted subtasks retain references to nonexistent task IDs.
  • task-master validate-dependencies fails due to missing dependencies.
  • task-master fix-dependencies does not fix these invalid subtask dependency references.

Screenshots or Logs

Please see above

Environment

  • Task Master version: v0.20.0
  • Node.js version: v24.3.0
  • Operating system: Windows 11
  • IDE (if applicable): VSCode

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Projects

    Status

    Done

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions