Submatter/docs/orchestrator.md

31 lines
1.1 KiB
Markdown
Raw Permalink Normal View History

# 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 |