Files
Renn F dba231474b fix(lifecycle): stop cell-PM redirect clobbering review handoffs; cascade dependency prune on delete/cancel
Two live bugs the CEO hit daily, both in TaskService:

1. awaiting_qa / awaiting_documentation tasks were assigned to the cell
PM (be-pm) and deadlocked until manually reassigned. _resolve_cell_pm_redirect
forces every cell-PM-owned task type (documentation/design/research/planning/
administrative) onto the cell PM on every reassign(). The gateway hands off
to QA (i_am_done) and to the documenter (pass_review) via reassign(), so the
redirect clobbered the rightful reviewer — who has no claim right on those
states per CLAIM_RULES. The redirect is for delegation/escalation ownership
routing, not for clobbering a review handoff. Gate it on
_REVIEW_HANDOFF_STATUSES (awaiting_qa / awaiting_documentation /
awaiting_pr_review); awaiting_pm_review is deliberately excluded (the cell
PM IS the owner there, so the redirect still fires).

2. Deleting or cancelling a task left a dependent BLOCKED on it stuck
forever — the CEO caught a good-to-go task held by a stale dependency on a
deleted task. delete() and cancel() never called _unblock_dependents (the
edge-prune only the complete()/ceo_approve paths ran), so a BLOCKED
dependent was never auto-revived. (A PENDING dependent's claim was not
blocked — unmet_dependency_ids treats a missing row as "met" — but a
BLOCKED dependent is past the gate and only _unblock_dependents revives it.)
Both paths now loop _unblock_dependents over the root and every descendant;
idempotent, and a deleted id in completed_dependency_ids is a dead-end node
in the sequence graph so it cannot false-block.

Tests: 3 unit (review-handoff preserved for QA/doc/PR-reviewer; PM-review and
CLAIMED redirects still fire) + 3 integration (delete/cancel revive a BLOCKED
dependent; delete prunes a PENDING dependent).
2026-08-01 23:48:38 +02:00
..