Stop creating plan_review approvals on every subtask
In co-founder mode, onTaskStarted created a plan_review checkpoint for every research / content / management task, including every subtask the assignee decomposed its work into. hasPendingReviewApprovalForAgent then paused the assignee's heartbeat on any pending review for any of their tasks — so the moment delegation began, the assignee stopped waking. Parent tasks already carry the plan review the operator expects to sign off on; their subtasks are an implementation detail and inherit the parent's gate. Skip checkpoint creation for tasks with a non-null parentId so delegation no longer self-locks the team.
This commit is contained in:
1 parent
2222a67428
commit
3a02b4d0a6
1 file changed
+12
-2
@@ -35,8 +35,12 @@ export function createCheckpointEngine(deps: CheckpointDeps) {
|
||||
return {
|
||||
/**
|
||||
* Called when a task transitions to in_progress for the first time.
|
||||
* In co-founder mode, creates a plan_review checkpoint for non-code tasks
|
||||
* so the user can review the task plan before execution begins.
|
||||
* In co-founder mode, creates a plan_review checkpoint for top-level
|
||||
* non-code tasks so the user can review the plan before execution
|
||||
* begins. Subtasks inherit their parent's review — creating a
|
||||
* checkpoint for every subtask made the whole team stall on a
|
||||
* waterfall of approvals that the operator had no chance to process
|
||||
* in real time.
|
||||
*/
|
||||
onTaskStarted(taskId: string, companyId: string, agentId: string | null): string | null {
|
||||
try {
|
||||
@@ -49,6 +53,12 @@ export function createCheckpointEngine(deps: CheckpointDeps) {
|
||||
// Only create plan checkpoints for non-code task types
|
||||
if (!taskType || !CHECKPOINT_TASK_TYPES.has(taskType)) return null;
|
||||
|
||||
// Subtasks inherit the parent's plan review; creating a fresh
|
||||
// checkpoint per subtask produces an unbounded approval fan-out
|
||||
// that blocks the assignee's heartbeat (shouldPauseHeartbeat)
|
||||
// the moment delegation starts.
|
||||
if (task.parentId) return null;
|
||||
|
||||
const approvalId = db.requestApproval({
|
||||
companyId,
|
||||
relatedTaskId: taskId,
|
||||
|
||||
Reference in new issue
Block a user