Submatter/docs/orchestrator.md
Randall Stillwell 8b01c1b8dd feat(orchestrator): convoy driver tick loop and Redis job queue (Epic 6)
Adds apps/orchestrator with planOrchestratorAction in shared, dry-run mode,
Redis role_dispatch enqueue, gate pauses, and stall detection logging.

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-07-07 15:16:34 -05:00

30 lines
1.1 KiB
Markdown

# Orchestrator (`apps/orchestrator`)
Long-running service that drives convoy lifecycle: plans next pipeline role, enqueues worker jobs on Redis, pauses at human gates, and detects stalled agent runs.
## Run locally
```bash
# Dry-run (no Redis required)
ORCHESTRATOR_DRY_RUN=1 pnpm --filter @tasks/orchestrator dev
# Live enqueue (requires REDIS_URL)
pnpm --filter @tasks/orchestrator dev
```
## Architecture
- **Driver** — pure `planOrchestratorAction()` in `@tasks/shared/orchestrator`
- **Tick loop** — loads active convoys (`draft`, `ready`, `in_progress`), applies next action
- **Queue** — `echodo:orchestrator:jobs` Redis list (consumed by `apps/worker`, Epic 7)
- **Gates** — `convoy_review`, `pr_review`, `merged` pause until mission control approves
## Env
| Variable | Default | Purpose |
|----------|---------|---------|
| `DATABASE_URL` | required | Convoy + event reads/writes |
| `REDIS_URL` | optional | Job queue; missing ⇒ dry-run |
| `ORCHESTRATOR_DRY_RUN` | `false` | Log actions without enqueue |
| `ORCHESTRATOR_POLL_MS` | `5000` | Tick interval |
| `ORCHESTRATOR_STALL_MINUTES` | `120` | Stall detector threshold |