diff --git a/docs/dispatch-events.md b/docs/dispatch-events.md index 0c261b7..5356b0e 100644 --- a/docs/dispatch-events.md +++ b/docs/dispatch-events.md @@ -113,7 +113,7 @@ InitiativeChangesRequestedEvent { initiativeId, phaseId, taskId } |-------|--------| | `phase:queued` | Dispatch ready phases → dispatch their tasks to idle agents | | `agent:stopped` | Re-dispatch queued tasks (freed agent slot) | -| `task:completed` | Merge task branch, then dispatch next queued task | +| `task:completed` | Merge task branch (if branch exists), check phase completion, dispatch next queued task | ### Coalesced Scheduling @@ -121,7 +121,8 @@ Multiple rapid events (e.g. several `phase:queued` from `queueAllPhases`) are co ### Execution Mode Behavior -- **YOLO**: phase completes → auto-merge → auto-dispatch next phase → auto-dispatch tasks +- **YOLO**: phase completes → auto-merge (if branch exists, skipped otherwise) → auto-dispatch next phase → auto-dispatch tasks - **review_per_phase**: phase completes → set `pending_review` → STOP. User approves → `approveAndMergePhase()` → merge → dispatch next phase → dispatch tasks +- **No branch**: Phase completion check runs regardless of branch existence. Merge steps are skipped; status transitions still fire. `updateTaskStatus` tRPC routes completions through `dispatchManager.completeTask()` to emit `task:completed`. - **request-changes (phase)**: phase `pending_review` → user requests changes → creates revision task (category=`'review'`, dedup guard skips if active review exists) with threaded comments (`[comment:ID]` tags + reply threads) → phase reset to `in_progress` → agent reads comments, fixes code, writes `.cw/output/comment-responses.json` → OutputHandler creates reply comments and optionally resolves threads → phase returns to `pending_review` - **request-changes (initiative)**: initiative `pending_review` → user requests changes → creates/reuses "Finalization" phase → creates review task → initiative reset to `active` → agent fixes → initiative returns to `pending_review`