fix: Handle spawn and branch failures gracefully in dispatch cycle
Wrap agentManager.spawn() in try/catch — on failure, block the task instead of crashing the entire dispatch cycle. Move phase status update to after branch creation succeeds — on branch failure, block the phase and skip task queuing. Fix statement-breakpoint markers in migration 0020 to use separate lines.
This commit is contained in:
@@ -66,6 +66,7 @@ AccountCredentialsRefreshedEvent { accountId, expiresAt, previousExpiresAt? }
|
||||
7. **Summary propagation** — `completeTask()` reads the completing agent's `result.message` and stores it on the task's `summary` column. Dependent tasks see this summary in `context/tasks/<id>.md` frontmatter.
|
||||
8. **Approval check** — `completeTask()` checks `requiresApproval` (task-level, then initiative-level)
|
||||
9. **Approval flow** — If approval required: status → `pending_approval`, emit `task:pending_approval`
|
||||
10. **Spawn failure** — If `agentManager.spawn()` throws, the task is blocked via `blockTask()` with the error message. The dispatch cycle continues instead of crashing.
|
||||
|
||||
### DispatchManager Methods
|
||||
|
||||
@@ -85,8 +86,9 @@ AccountCredentialsRefreshedEvent { accountId, expiresAt, previousExpiresAt? }
|
||||
|
||||
1. **Queue** — `queuePhase(phaseId)` validates phase is approved, gets dependencies
|
||||
2. **Dispatch** — `dispatchNextPhase()` finds phase with all deps complete
|
||||
3. **Auto-queue tasks** — When phase starts, pending execution tasks are queued (planning-category tasks excluded)
|
||||
4. **Events** — `phase:queued`, `phase:started`, `phase:completed`, `phase:blocked`
|
||||
3. **Branch creation** — Initiative and phase branches are created in all linked project clones. On failure, the phase is blocked via `blockPhase()` and tasks are NOT queued.
|
||||
4. **Auto-queue tasks** — When phase starts (branches confirmed), pending execution tasks are queued (planning-category tasks excluded)
|
||||
5. **Events** — `phase:queued`, `phase:started`, `phase:completed`, `phase:blocked`
|
||||
|
||||
### PhaseDispatchManager Methods
|
||||
|
||||
|
||||
Reference in New Issue
Block a user