Workflow creation
- Accept the commandThe HTTP gateway validates session, CSRF state, input, and the idempotency key before calling the workflows service.
- Commit state and intentPostgreSQL stores workflow state, idempotency output, and an outbox event in one transaction.
- Publish durablyThe outbox relay claims the row and publishes the workflow event to Kafka.
- Prepare executionThe workflow worker validates payload, resolves the image digest, and updates build state through gRPC.
Automatic scheduling
The scheduling worker scans due workflows, validates generation and build state, then creates replay-safe job dispatch work. Manual scheduling enters the same job lifecycle with trigger MANUAL.
Job execution
The execution worker consumes the job event, claims a lease, receives the runtime endpoint registered by runtime-agent, ensures the resolved image on that runtime, starts the container through the Docker proxy, attaches its container ID, renews ownership, and publishes output. Terminal state changes require the lease token.
Logs and analytics
Live output uses Redis pub/sub. Retained output flows through Kafka to ClickHouse and Meilisearch. Workflow, job, and log events feed replay-safe analytics updates in PostgreSQL.
Failure path
If a worker disappears, lease recovery evaluates expired running jobs. Eligible system failures are retried; exhausted or invalid work becomes terminal and container cleanup is attempted.
