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 workflow worker creates AUTOMATIC jobs through ScheduleJob using an internal admin JWT. The scheduling worker checks workflow generation and build state before emitting replay-safe dispatch events for due jobs. Manual scheduling enters the same job lifecycle with trigger MANUAL.
Job execution
The execution worker consumes the job event, claims a lease and receives the
runtime endpoint registered by runtime-agent. It ensures the resolved image,
persists an immutable creation intent, obtains one Create grant, and creates the
named/labeled container. It verifies and records the full ID and attaches it to
the job before obtaining one Start grant. Start targets that immutable ID;
lease renewal and log publication continue while execution runs. Lost mutation
replies do not authorize another transmission. Terminal state changes require
the lease token.
Settlement, cancellation and deletion close intent authority and retain cleanup obligations for observed IDs. Original-instance completion receipts release the corresponding holds; later workflow container work remains gated while a prior Start-reserved ID is unresolved.
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.
