Skip to content

[BUG] Parent task orphaned after clearing/navigating away from delegated child task #11301

@0xMink

Description

@0xMink

Problem (one or two sentences)

Summary

There are user-triggerable paths where returning to a parent task after delegation fails because the active child task is popped via removeClineFromStack() without any delegation-aware unwind semantics. This can leave the parent task orphaned in a delegated state with awaitingChildId still set, and the user ends up with an empty chat and no way to recover the parent task without manual history repair.

Why this matters

These are normal UI actions, not edge-case runtime failures. A user who clears a delegated child task will see an empty chat with no way to recover the parent task. The system is left in an unrecoverable delegation state without manual history repair.

Suggested direction (minimal)

A delegation-aware unwind chokepoint would allow consistent semantics whenever the active task is popped, rather than relying on each caller of removeClineFromStack() to implement delegation return or repair. No architectural sermon, no 600-line refactor — just a crisp invariant that needs holding. If maintainers want a PR, happy to discuss.

Context (who is affected and when)

Any user who triggers a UI action (Clear Task, navigate to history, or start a new task) while a delegated child task is active.

Reproduction steps

Start a parent task that delegates to a child task
While the child task is active, click "Clear Task"
Observe: child is removed, parent remains in delegated state, user sees empty chat with no way to recover parent task

Expected result

Parent task is restored or delegation is explicitly resolved/cancelled. UI remains in a valid active task state.

Actual result

removeClineFromStack() pops the child without restoring the parent's delegation state. Parent is left orphaned in delegated with stale awaitingChildId, user sees an empty chat with no recovery path.

Variations tried (optional)

Same orphaning occurs via two additional paths:

Navigate to a different task from history while child is active (showTaskWithIdcreateTaskWithHistoryItemremoveClineFromStack())
Start a new top-level task while child is running (createTaskremoveClineFromStack())

App Version

v3.47.3

API Provider (optional)

None

Model Used (optional)

N/A

Roo Code Task Links (optional)

No response

Relevant logs or errors (optional)

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions