midnight-saci

Run and follow plans

This page tells you how to submit a plan to a backend, follow the run, read its report and cancel it. All options and exit codes are in the command line reference.

Prerequisites

Submit a run

saci run plan.md --environment staging --follow

--environment names an environment of the backend configuration. Add --policy <name> to use a run policy other than default. Without --follow, the command prints the run ID and returns when the backend accepts the run.

If the connection breaks after the request was sent, the command exits 4 and prints the idempotency key that it used. Repeat the command with --idempotency-key <key>: the backend returns the run that it already accepted and does not start a second one (see when the reply is lost).

Start from a test or step

To rerun part of a plan after a failure, give the key of the unit to start from. For a unit in the entry document, use its heading ID.

saci run plan.md --environment staging --from-step 2.3 --follow

The new run includes the selected unit, its invoked procedures and all later units. The report and outcome cover this part of the plan. Make sure the target environment has the state that the selected unit needs. The new run starts with a fresh shell session.

Use a worker image built from the same release as the backend. An older worker rejects the start key before it runs any steps. Rebuild a local image or update the configured image reference. If you use a registry tag that changes, pull the updated image or set the pull policy to Always so the runtime refreshes its cached copy.

Follow a run and read the report

saci list                      # recent runs, newest first
saci status <run-id>           # state, progress and outcome
saci follow <run-id>           # progress until the run finishes
saci report <run-id>           # units, attempts, criteria and evidence

saci follow reconnects by itself when the connection fails, and continues after the last event that it printed. Ctrl-C stops follow, not the run. saci report ties each expected result to the evidence behind it. The exit code of these commands is the outcome of the run, for example 0 for passed and 1 for failed (see exit codes).

To see the same information in a browser, open the web console.

Cancel a run

saci cancel <run-id> --wait

The worker stops after its current action, skips the remaining units and runs the remaining cleanup units (see cleanup). With --wait, the command waits until the run has stopped and exits with its outcome, normally 7 (cancelled).

Next steps