# Tasks — Orchestrator Advanced Flows ## Prerequisites - v2.7.17 on main (orchestrator + flow-runner shipped) - v2.8.0 on main (fork-lifts complete) ## Tasks ### 1. Trigger rules in Step type - [ ] 1.1 Add `TriggerRule` type to `conductor/types.ts` - [ ] 1.2 Add `trigger_rule?: TriggerRule` field to `Step` interface (defaults `all_success`) - [ ] 1.3 Write `evaluateTriggerRule(deps, rule): boolean` in `flow-runner-decisions.ts` - [ ] 1.4 Unit tests for each rule variant ### 2. Variable substitution - [ ] 2.1 Write `resolveVariables(prompt, completedSteps): string` in flow-runner - [ ] 2.2 Supports `$stepId.output` and `$stepId.output.field` (dot-path) - [ ] 2.3 Unit tests with multi-step outputs ### 3. Approval gate step kind - [ ] 3.1 Add `'approval'` to `StepKind` union - [ ] 3.2 Flow-runner: when step.kind === 'approval', pause and publish `permission_requested` frame - [ ] 3.3 Wire `permission_resolved` frame handler to unblock blocked step - [ ] 3.4 Test: approval gate pauses flow, approval resumes it ### 4. Event-sourced step log - [ ] 4.1 Create `flow_step_events` table in `apps/coder/src/schema.sql` - [ ] 4.2 Write `appendStepEvent(runId, stepId, event, payload?)` helper - [ ] 4.3 Wire events into flow-runner lifecycle hooks (start, complete, fail, skip, pause, resume) - [ ] 4.4 Unit test: events are recorded in order ### 5. Example flow with parallel branches - [ ] 5.1 Create `conductor/flows/parallel-research.ts` — splits into 3 parallel research steps, then joins with synthesis - [ ] 5.2 Uses `trigger_rule: 'one_success'` on the synthesis step - [ ] 5.3 Integration test: parallel flow completes correctly ### 6. Smoke - [ ] 6.1 Run parallel-research flow with 3 agents - [ ] 6.2 Verify synthesis step triggers on first completion - [ ] 6.3 Verify variable substitution in synthesis prompt