Skip to content

Runbooks

Find the symptom, then follow the steps. Most commands need an operator token in SEFRA_OPERATOR_TOKEN. sefra audit commands need SEFRA_DATABASE_URL, and sefra bundle apply needs an admin token in SEFRA_TOKEN.

Symptom Runbook
Alert with reason needs_intervention, and a step in status unknown A step’s outcome is unknown
Alert with reason needs_intervention, and a step in status compensation_failed An undo failed
Alert with reason workflow_not_started An execution did not start
An agent gets PRINCIPAL_SUSPENDED An agent was suspended
/readyz answers 503 Sefra is not ready
Many FACT_UNAVAILABLE or DOWNSTREAM_UNAVAILABLE A system of record is failing
POLICY_ERROR A policy fails to evaluate
sefra audit verify prints BROKEN The audit chain is broken

Start any incident by listing what needs a person:

sefra executions list --status needs_intervention
sefra executions get <execution id>

Sefra called your system and could not tell whether the call took effect. Do not ask the agent to retry.

  1. Read the execution and note the step, its intent and its time.

  2. Look in the system of record for the effect.

  3. If it happened, settle the step as succeeded. Give the output the intent declares:

    sefra executions settle-step <id> --step <step> --outcome succeeded \
      --output '{"payment_id": "pay_123"}' --note "Found in the payment ledger"
    
  4. If it did not happen, settle it as failed:

    sefra executions settle-step <id> --step <step> --outcome failed --note "No record in the ledger"
    

The execution then continues, is compensated, or ends as failed, as appropriate. To avoid this next time, add a probe to the intent. This example walks through it.

A step failed and Sefra could not reverse an earlier one, so your system may hold a partial result.

  1. Find the step with status compensation_failed, and read why in sefra executions audit <id>.

  2. Fix the cause, such as an expired credential or an outage.

  3. Run the compensations again:

    sefra executions retry-compensation <id> --note "ERP credential renewed"
    
  4. If it cannot be undone automatically, fix the system by hand and close the execution:

    sefra executions resolve <id> --note "Cancelled PO 1042 by hand, ticket OPS-311"
    

resolve records your statement, and it does not check the system. Write a note that the next reader can verify.

Sefra accepted the execution but could not start its workflow for over a minute. Temporal is the usual cause.

  1. Check /readyz and Temporal’s health.
  2. Restore Temporal. Sefra keeps trying and starts accepted executions when it returns, so no action is needed on each one.
  3. Confirm with sefra executions list --status in_flight that the backlog is draining.

An operator suspended it, or the denial breaker did after 20 counted refusals in 10 minutes.

  1. Find out why: read the agent’s recent refusals on the console’s Refusals page.

  2. If it was looping on a refusal, fix its instructions or the rule first.

  3. If its credential may be compromised, rotate it at your identity provider before going further.

  4. Lift the suspension:

    sefra control unsuspend agent:<name> --note "Prompt fixed, see ticket"
    

/readyz names the failing check in its answer.

Check Look at
Database PostgreSQL is up and the connection string is right
Temporal The Temporal address, namespace and TLS
Identity Sefra can reach the provider’s keys
Connector secrets Each secret named by the active bundle resolves
Bundle A bundle is active. Run sefra bundle apply on a new install

/readyz reports state and does not itself stop requests, so take an instance that is not ready out of your load balancer. What happens to a request depends on what is down. Without the database or an active bundle, Sefra refuses. Without Temporal, it can still accept an execution and starts it when Temporal returns.

Sefra refuses when it cannot read a fact, and it retries calls to a failing system.

  1. Confirm the outage with the system’s owner.

  2. If it will last, disable the affected intent, so agents get a clear answer:

    sefra control disable <intent> --note "ERP outage, ticket OPS-312"
    
  3. After recovery, enable it and check for executions in needs_intervention.

Disabling has a cost. A running plan that reaches the disabled intent fails there, and Sefra undoes its earlier steps. If those undo calls go to the same failing system, they keep retrying for up to 24 hours and may end in needs_intervention. A pause does the same to every running plan, so prefer the narrower switch.

Sefra treats a policy error as a refusal, so nothing unsafe happened, but the affected action is unavailable.

  1. Find the bundle that was activated last on the console’s Policy page.
  2. If the errors began with it, open the previous bundle there and choose Activate. This needs the sefra_admin role.
  3. Reproduce the failure in a policy test before you fix and reapply it.
  4. Policy errors count toward the denial breaker, so check for agents it suspended, and lift the suspension.

Treat this as a security incident. BROKEN at seq <n> means that a stored event does not match the chain.

  1. Do not modify the database, and do not restart to “see if it clears”.
  2. Preserve evidence: take a database snapshot and keep Sefra’s logs.
  3. Compare with your most recent stored sefra audit head value, to bound when it happened. A clean verify alone does not rule out a rewrite, because the hashes are not keyed, so make this comparison after any suspected tampering too.
  4. Follow your incident process, and report it to security@sefra.io if you suspect a defect in Sefra.