3.2 Gates, retry, cancel
Included from Basic tier
After this you can: answer an approval gate, retry a failed run, and cancel a running one — and read what each leaves in the record.
Before you start — tick each one:
- Lesson 3.1 — Your first change (
opschain learn 3.1)
In the GUI: the run page lesson 3.1 followed shows the run's status, and Inbox → Approvals lists every subject held for your approval.
Lesson 3.1 ran a change that went straight to success. Real changes
park on a wait step, fail halfway, or need stopping — and each of those
moments is a verb with an audit record. This lesson walks the four verbs
an operator answers a run with: continue/approve/reject on a gate,
cancel in flight, retry after a failure, and pause as the gentler hold.
Every step below uses the pick action from lesson 2.3 — its wait step
is what gives you a run to hold, cancel and retry.
1. Answer the gates
A wait: step (lesson 2.3) in a server-side change parks on the server —
the run holds at waiting until someone answers:
opschain runs create change acme/environments/dev --action pick
created change 01a13f20-…-example (pick on acme/dev) — pending
Find the waiting step's id in the run's step tree, then answer it:
opschain runs show <run-id> -o json | grep -B4 '"waiting"'
"id": "01a13f20-…-example",
"path": "pick/pick_window",
"name": "pick_window",
"kind": "wait",
"status": "waiting",
opschain runs continue <run-id> --step 01a13f20-…-example --message "window confirmed"
continued step 01a13f20-…-example of run <run-id> — now success
continue answers a plain wait step; approve and reject answer an
approval-gated one, and only the required approvers may:
opschain runs approve <run-id> --step <step-id> --message "LGTM"
opschain runs reject <run-id> --step <step-id> --message "not tonight"
approved step <step-id> of run <run-id> — now running
The --message is recorded in the audit events. A step that is not
waiting for that answer is refused by the server with a named error — you
cannot approve the wrong thing by accident. Who counts as a required
approver is the access model's territory (lesson 7.2); until then, the
login from lesson 0.1 can answer every gate. Governed sign-off — named
approvers, quorum, the approvals inbox — is an approval policy that
holds the whole run before it starts: lesson 10.1
(opschain learn governance-approvals).
2. Cancel a run in flight
Create a second pick change and let it park on its wait step; this
time, instead of answering, cancel it:
opschain runs cancel <run-id> --reason "change window closed"
cancelled run <run-id>
The optional --reason (up to 1000 characters; the GUI's cancel dialog
sends the same field) is recorded on the cancel audit event and appended
to each cancelled step's audit trail as cancelled via API: <reason>.
The run finalises cancelled, and an executing step is aborted on its
runner within one lease-renewal round-trip, freeing that runner for the
next run. An already-finished run is refused with the server's named
error:
Error: the server answered failed_precondition: Cannot cancel because it is in the "cancelled" state
3. Retry a failed run
A retry needs a run that did not succeed: the server retries a change in
error, cancelled, aborted or rejected state and refuses a
successful one by name (Change must be in error, cancelled, aborted or rejected state to be retried). The change you just cancelled is the
subject:
opschain runs retry <run-id>
created change 01a13f31-…-example (pick on acme/dev) — queued
A retry is a new run duplicating the failed one — the original stays
untouched as evidence (still cancelled in runs list), which is why
the output is a fresh created line. Steps that succeeded are preserved
and do not execute again; the failed subtree re-runs — here the
duplicate parks on the wait step again, and continue finishes it.
--follow works exactly as on create. If part of the tree is still
known-broken, replace the skip mask for the retry:
opschain runs retry <run-id> --skip-step "deploy/optional_bit/**"
A retry normally re-runs at the original's pinned commit. For a project or environment git change you can instead re-resolve the branch or tag to its current head and pin the duplicate to the moved head:
opschain runs retry <run-id> --refresh-git-rev
A sha rev re-resolves to itself, and an asset change refuses the option with a named error (its commit comes from its template version, lesson 3.4).
4. Pause instead of killing
To hold a run without killing it, pause it — the step that is running finishes, nothing new starts, gates still answer, and the hold survives a server restart:
opschain runs pause <run-id> --reason "change window closed"
paused run <run-id> — pause state pausing
pausing means a step is still finishing; it settles to paused when
nothing is running. Release it when the window reopens:
opschain runs resume <run-id>
resumed run <run-id> — pause state none
The pause and resume are audited in the run's paused_by history.
Pausing a paused or finished run, and resuming an unpaused one, are
refused with the server's named errors.
5. Record what you did by hand
Sometimes a run can only be rescued by hand — a stuck service killed on the host, a setting widened in a cloud console. Declare that act afterwards as a break-glass record on the run it rescued, after the step it followed, with a reason and the act's own window:
opschain breakglass record --run <run-id> --after-step pick_window \
--reason "the window service was down; confirmed the slot by phone" \
--window 2026-11-17T22:40Z/2026-11-17T22:46Z \
--activity "booked the slot in the vendor portal" \
--reference booking=vendor:BK-2041
recorded break-glass record 01a1e7d0-…-example on /projects/acme/environments/dev (unreconciled, evidence class reference)
window 2026-11-17T22:40:00Z/2026-11-17T22:46:00Z (UTC)
The second line is the window as recorded, in UTC. Each side of
--window may also be now or an offset from now — --window -30m/now
is the last half hour — resolved on your machine's clock and sent as UTC;
a time without a zone is refused, so add Z or an offset, or use the
relative form. The window must not end in the future: the record is
declared after the act.
The record's events land on that run's record at the step you named
(lesson 5.1 reads them). Evidence takes four kinds — --reference (an id
the other system minted), --check with its captured --check-output,
--evidence <file> (a screenshot or export) and your statement, always
present — and the record carries the strongest as its evidence class. A
change made outside any run uses --node <path> instead of --run. Every
record stays unreconciled until someone reviews it and closes it with
a note:
opschain breakglass list --state unreconciled
opschain breakglass close <record-id> --note "matched the vendor's booking log"
closed break-glass record 01a1e7d0-…-example on /projects/acme/environments/dev
Recording and closing are separate rights on the node, and only a person may use them — an agent or a service account is refused by name. In the local lane a record stays in your home's store, and the CLI says so: nobody reviews it until it reaches a server. Export the home's activity and import the file on the server, where it lands once as a record you recorded, unreconciled, keeping its window:
opschain governance activity --local --from 2026-11-17T00:00:00Z --out home.ndjson
opschain governance activity import home.ndjson
The full reference: opschain docs cli/breakglass,
opschain docs cli/governance-activity-import and
opschain docs resources/breakglass_record.
To reconcile, ask what covers the node over the incident's window — every run and every record that claims it:
opschain governance coverage --scope /projects/acme/environments/dev --from 2026-11-17T22:00:00Z
KIND ID NODE STARTED ENDED ATTRIBUTION STATUS REFERENCES
run 01a1e7c3-…-example /projects/acme/environments/dev 2026-11-17T21:58:10Z 2026-11-17T23:05:42Z WINDOW success 0
breakglass 01a1e7d0-…-example /projects/acme/environments/dev 2026-11-17T22:40:00Z 2026-11-17T22:46:00Z REFERENCE unreconciled 0
REFERENCE means the activity carries an id the other system minted, so
it matches that system's own log exactly; WINDOW means only the time
lines it up. A step makes its run REFERENCE by reporting the id with
opschain step add-reference --system <s> --kind <k> --id <id>
(opschain docs cli/step-add-reference); opschain governance activity
exports the same rows as NDJSON. Both work in the local lane over your
home's store.
6. Hold a run for a person: manual steps
Some steps no command can do — a click in a vendor portal, a change board's
sign-off, a registrar's DNS page. Declare them in the action as a
manual: step, so the run states the activity in advance, holds for it,
and records who did it and the evidence (opschain docs orchestration):
- name: verify_domain
manual:
title: Verify the sending domain
activity: Portal → Domains → ${{ properties.mail_domain }} → Verify
evidence:
- kind: reference
name: operation_id
required: true
- kind: file
name: screenshot
accept: [image/png]
timeout: 4h
When the run reaches it, the run holds at waiting and runs show prints
the rendered activity and when it fails if nobody answers:
Manual steps:
pick/verify_domain [awaiting_attestation] Verify the sending domain
activity: Portal → Domains → mail.acme.test → Verify
fails if unattested by 2026-11-18T03:12:26Z
Do the activity, then attest it with the evidence the step asks for:
opschain runs attest <run-id> verify_domain --reference operation_id=portal:op-7731 \
--evidence screenshot=domain.png --note "all four records verified"
attested manual step pick/verify_domain of run <run-id> (evidence class reference) — the run continues
Or refuse it with a reason — the step fails by name:
opschain runs refuse <run-id> verify_domain --reason "another tenant owns the domain"
continue and approve never answer a manual step, and only a person may
attest — an agent or a service account is refused by name. Your principal
id, the time, the activity as rendered and the evidence land on the run's
record. In the local lane the attached run prints the activity and waits;
run opschain runs attest … --local from another terminal and it carries
on. The full reference: opschain docs resources/step_attestation.
7. Hold a change's attempts on one record
The retry in section 3 is a new run on a new chain: nothing yet says the cancelled attempt and its retry were one change. A change record does. Open one for the change, owned by your project and scoped to the environment it touches, and approve it:
opschain changes create --owner /projects/acme --title "pick the release window" \
--scope /projects/acme/environments/dev/**
opschain changes approve CHG-2026-001
change record CHG-2026-001 opened (pending) under /projects/acme (id 019b…-example)
change record CHG-2026-001 approved under /projects/acme (id 019b…-example)
While the record is approved, every run you create inside its scope joins
it without a flag — run pick again and cancel it, then retry it: both
runs land on the record, the retry inheriting it. Name a record explicitly
with --change CHG-2026-001 on runs create or runs retry; attach a run
created before the record existed with opschain changes link, and a
by-hand act with opschain breakglass record … --change CHG-2026-001.
Read the whole story — every run with its status and how it joined, the
break-glass records and every event in order — and close the record with a
verdict once nothing under it is running:
opschain changes show CHG-2026-001
opschain changes close CHG-2026-001 --verdict completed --note "retry picked the window"
A pending record captures nothing; a record opened with --window <from>/<to> — RFC3339 with a zone, or relative: now/+2h, +10m/+2h, or
just 2h for the next two hours, echoed back in UTC — captures by scope
only inside that window (--change and
changes link are never window-bound); a workflow run joins by the one
node all its change steps target, or by its project when they target
different nodes; two approved records whose scopes both
hold a node refuse the run by name until you say which with --change; and
close is refused while a run under the record still runs. Approving and
closing are a person's verbs. The full reference:
opschain docs cli/changes and opschain docs resources/change_record.
Check yourself
- Park a change on a wait step, cancel it and retry it: what status does
runs showreport while it waits, which states may be retried, and what doesruns retryprint that proves the cancelled attempt's record is untouched?
What you learned
- A wait or approval step holds the run at
waiting;continue,approveandrejectanswer it by step id, with the--messageaudited. cancel --reasonends a run and aborts its executing step on the runner; a finished run refuses a second cancel by name.- A retry needs an
error,cancelled,abortedorrejectedrun — a success is refused by name; it is a new run (created change …) that re-runs only the failed subtree, and--refresh-git-revmoves a git change to the branch's current head. pause/resumehold a run between steps without killing anything.breakglass record --run … --after-step …declares a by-hand rescue on the run it rescued, with a reason, a window and evidence; it stays unreconciled untilbreakglass close --note ….governance coverage --scope … --from …lists every run and record claiming a node over a window, each matchable by aREFERENCEthe other system minted or by itsWINDOWonly.- A
manual:step holds the run for a person;runs attest(with its evidence) continues it,runs refuse --reasonfails it, and an unattested step fails at its timeout. - A change record (
changes create,changes approve) holds every attempt of one change: runs inside its scope join while it is approved, retries inherit it, andchanges showreads the whole story. - Every one of these verbs leaves an audit event with its actor and message — the record lesson 5.1 reads.
Next: lesson 3.3 — Git remotes and the identity policy (opschain learn 3.3), or back to your track (opschain learn).