Durable pipelines: hybrid CI/CD that survives restarts
One CI/CD graph across local and remote runners that resumes after a restart, cancels everywhere, and never retries an unaccounted side effect.
Last updated
A pipeline is one dependency graph whose jobs run on different execution adapters: a local process tree, a container, a remote Windows runner. Orgabot runs it as part of a mission, and the mission's own lifecycle journal is where every pipeline fact is recorded. There is no separate pipeline database, so anything that can recover a mission can recover its pipeline.
What a pipeline definition holds
Each job names the adapters it may run on (in fallback order), what to run, and optionally:
needs: the jobs it depends on.matrix: axes expanded into one job instance per combination, withincludeandexclude.if: run onsuccess(the default),failure,always, orcancelled, plus conditions on a dependency's outputs.outputs: a job appendsname=valuelines to the file named by$ORGABOT_PIPELINE_OUTPUTS, and later jobs read them as${{ needs.<job>.outputs.<name> }}.timeoutMs, andcleanup: truefor a job that runs whenever its dependencies settle, even after a failure or a cancellation.effect:pure(verification, the default), orsigning,publish,deploy,promotionfor jobs with external side effects.
The pipeline also runs under a policy snapshot: which adapters are authorized, whether infrastructure failures may fall back to the next adapter, and which jobs or effects need a human approval. A definition naming an adapter the policy does not authorize is refused before anything runs.
Job states
A job is queued, approval_blocked, resource_blocked, dispatching, running, succeeded, failed, canceled, infrastructure_lost, outcome_unknown, or skipped. Only an observed succeeded is success. A job that was submitted, or whose runner vanished, is never counted as passed.
The mission view and the CI/CD view render the same summary of each pipeline, so a cancelled, failed, or blocked pipeline reads the same in both places.
Restarts and lost webhooks
Orgabot records its intent to dispatch a job before it calls the runner, and gives every attempt a stable operation id. After a restart, the next controller first reconciles every job the journal says is in flight: it reads the run back by its handle, or asks the provider for the operation id when the handle was never recorded. Only then does it start anything new. A job that already succeeded is never rebuilt.
Provider callbacks are signed (HMAC-SHA256 over the timestamp and body), must be fresh, and must name the operation id of the attempt they describe. A duplicate, late, or out-of-order callback is recorded as evidence but never moves a job backwards. A lost callback costs one poll interval, because the controller observes runs itself.
Two controllers at once
A controller must hold the pipeline's lease to act. Taking the lease over bumps an epoch, and the journal refuses any write from an older epoch. Because dispatch intent is written first and the journal admits exactly one dispatch per attempt, two controllers racing on the same job cannot both reach the runner. This is what keeps a promotion from happening twice.
Retries and fallback
- An assertion failure (the job ran and its checks failed) or a job timeout is final. It is never retried and never moved to another runner.
- An infrastructure failure (the runner refused the job, or lost it) may retry on the same adapter, then move down the job's authorized adapter list when the policy allows fallback.
- An unknown outcome on a pure job is simply run again. On a signing, publish, deploy, or promotion job it stays
outcome_unknownand blocks the pipeline until it is reconciled, either by a provider lookup that proves the operation never arrived, or by an operator recording evidence:
orgabot pipeline reconcile <mission-id> <pipeline-id> <job-key> <attempt> --not-happened --evidence "<what you checked>"Every attempt of a job passes the same idempotency key to the provider, so a provider that deduplicates on it refuses a second side effect even across attempts. Orgabot does not claim exactly-once delivery across arbitrary providers; it claims that it never retries a side effect it cannot account for.
Cancelling and draining
orgabot pipeline cancel records the request and propagates it: running local process trees and containers are terminated as a whole, remote runs are cancelled through their provider, jobs that had not started are marked cancelled, and jobs that already completed keep their evidence. A mission that ends cancels its pipelines the same way.
A cancel is delivered, not just requested. Orgabot records the request, then records delivery only after the runner or provider accepted the cancel, and it asks again on every reconcile pass until the run is finished. A refused cancel, or a crash between the request and the call, is retried. A run whose dispatch reply was lost is looked up by its operation id first, so a run the provider accepted is found and cancelled instead of being left running.
orgabot pipeline drain is for upgrades and shutdowns. It stops starting new work, waits for local jobs up to a deadline, and releases the lease so a successor can take over at once. With --stop-local it stops still-running local verification so the successor reruns it. It never kills a side-effecting job midway, since that would create exactly the unknown outcome the rules above exist to avoid.
Commands
orgabot pipeline list [--mission <id>] [--json]
orgabot pipeline status <mission-id> [<pipeline-id>] [--json]
orgabot pipeline run <mission-id> --definition <file.json> --policy <file.json> --sha <sha> [--callback-key-id <id>]
orgabot pipeline run <mission-id> --ci-run <run-id> [--callback-key-id <id>]
orgabot pipeline resume <mission-id> <pipeline-id>
orgabot pipeline cancel <mission-id> <pipeline-id> [--reason <text>]
orgabot pipeline drain <mission-id> <pipeline-id> [--wait-ms <n>] [--stop-local]
orgabot pipeline reconcile <mission-id> <pipeline-id> <job-key> <attempt> (--happened | --not-happened) --evidence <text>
orgabot pipeline callback <mission-id> --key-id <id> --timestamp <ms> --signature <hex> --body-file <file>--ci-run runs a recorded CI run snapshot: its definition, its exact source commit and the placements the policy resolver chose become the pipeline. Only snapshots whose jobs all resolved onto local backends can run today. A snapshot that was refused, was modified after it was sealed, places a job on a backend with no pipeline adapter, or uses secrets, services, inputs, artifacts or a non-POSIX shell is refused with every reason, rather than run with that part dropped.
Adapters
localruns a job as a process tree on this host, or inside a container when the job names acontainerimage. Cancelling it stops the whole process group and kills the container by name. A local job does not inherit Orgabot's environment: it sees only basic variables such asPATH,HOMEand the locale, plus itswithvalues, so no callback secret or token reaches it. An upstream output written into a local job'srunis shell-quoted, so it is always one literal word and never runs as a command. To use an output inside a larger string, pass it throughwithand read it as an environment variable.github-actionsruns a job on a GitHub Actions runner, including Windows runners, through the same dispatch backend asorgabot ci-dispatch. The job'srunnames a configured target as<owner>/<repo>:<target>/<operation>, and the job takes nowithinputs: the source is the pipeline's own commit, and where it runs (hosted or self-hosted), what it may spend and which grants it needs come from the installation's dispatch config, not from the job. Each attempt gets one durable dispatch record linked to that pipeline, and a record can be linked to only one pipeline. Orgabot finds the run again after a lost reply or a restart by the operation id in the run name, so a lost reply never dispatches twice, and a run that was rerun on GitHub is picked up by polling even when no webhook arrives. Calls go through the GitHub App connected for that repository. Cancelling a pipeline cancels the run on GitHub. A remote job's run artifacts are recorded as references.
Registering an adapter authorizes nothing. A pipeline may use only the adapters its policy snapshot lists.
Callbacks over HTTP
A remote runner can report a job's state and outputs by sending a POST to /webhooks/pipelines on the dashboard server, with the headers x-orgabot-pipeline-key-id, x-orgabot-pipeline-timestamp (milliseconds) and x-orgabot-pipeline-signature (hex HMAC-SHA256 of <timestamp>.<body>). The body is the same JSON that orgabot pipeline callback accepts. The signature is the only credential, so this route does not need the dashboard token. A callback signed with an unknown key, or one that is stale or forged, is refused before any mission is looked up. Each key's secret is read from ORGABOT_PIPELINE_CALLBACK_SECRET_<KEY_ID> (the key id in upper case, with every other character turned into _) and must be at least 16 characters. With no secret set, every callback is refused. A pipeline accepts callbacks only when it was started with --callback-key-id, and only signed with that key. A pipeline started without one accepts no callbacks at all and settles by polling, so the key one runner holds can never report on another runner's job.