v1.2.2

Job Execution Control Plane

The Job Execution Control Plane runs immediate and background governance work, with a reliable history, safe retries, and duplicate protection.

Job Lifecycle

Every job moves through an explicit state machine. Transitions are recorded as audit events, so the full history of a job is always recoverable.

AI Governance Platform / governed event stream
job / execution-2048event order
  1. 01
    accepted

    The idempotency key resolves to one durable job identity.

  2. 02
    claimed

    A worker claims the queued job and starts a renewable lease.

  3. 03
    running

    The handler executes while attempts and lease state remain visible.

  4. 04
    committed

    The result is durably written before the worker acknowledges completion.

governed outcome

SUCCEEDED

Result committed ยท audit trail retained ยท retries remain attributable

  • QUEUED โ€” accepted and waiting for a worker.
  • RUNNING โ€” claimed by a worker and executing.
  • SUCCEEDED โ€” completed and results committed.
  • FAILED โ€” terminated after exhausting retries.
  • CANCELLED โ€” explicitly cancelled by an operator or policy.

Idempotent Submission

Submissions carry an idempotency key. Re-submitting the same key returns the existing job rather than creating a duplicate, which makes client retries and at-least-once delivery safe.

http
POST /api/v1/jobs
Idempotency-Key: submit-execution-2048

{
  "type": "evaluation",
  "payload": { "dataset_id": "support-agent", "policy_id": "production-ai-policy" }
}

// 200 OK (returns the same job on repeat)
{ "job_id": "job-5521", "status": "QUEUED" }

Retries

Failed jobs are retried according to a configurable backoff policy. Each attempt is recorded with its error, so operators can distinguish a transient failure from a systematic one. Non-retryable errors move a job directly to FAILED.

Worker Lifecycle

Workers claim queued jobs using a lease. A worker must renew its lease while running; if it stops renewing โ€” because it crashed or was rescheduled โ€” the lease expires and the job becomes eligible for another worker. This prevents jobs from being lost when a worker dies mid-flight.

Interrupted execution

Jobs whose lease expires while RUNNING are flagged as interrupted. They are re-queued only when the job type declares itself safe to retry, protecting against duplicate side effects.

Worker Health

A worker registers a heartbeat while it polls, so Studio can distinguish a healthy worker from one that has not started or has stopped reporting. This is separate from the lease heartbeat on an individual running job.

StatusMeaningFirst check
HealthyAll registered workers reported inside the configured stale threshold.Continue to monitor job queues and failure rates.
WarningOne or more workers have a stale heartbeat.Inspect worker logs, process health, and the polling/stale threshold.
UnknownNo worker has registered yet.Confirm that a worker started and uses the same durable database as the API.

Set AI_GOVERNANCE_WORKER_HEARTBEAT_STALE_SECONDS above the polling interval to avoid normal scheduling jitter appearing as a failure. Give every worker a unique worker ID. Stale records after a crash are retained for diagnosis rather than silently deleted.

Replay Worker Dispatch

The standard worker runtime consumes REPLAY_EXECUTION, REPLAY_EVALUATION, EVALUATION, and EXPERIMENT, and CAUSAL_AUDIT jobs. A replay execution commits its produced execution identity before it queues evaluation, so worker redelivery cannot create another Replay or replay execution.

Run the worker independently in local development, or set AI_GOVERNANCE_RUN_REPLAY_WORKER=true to run it beside the API:

bash
uv run python -m ai_governance.workers.replay_worker_runtime

Cancellation is checked at safe handler boundaries. If a process stops, its lease expires and eligible work can be claimed again without duplicating durable identities.

Causal Audit job flow

A Causal Audit uses the same durable job framework as Replay, but it has a different finish line. A normal replay creates a new evaluation, comparison, and drift result. A controlled causal replay instead returns a bounded outcome artifact to the Causal Audit worker, which calculates evidence influence.

CAUSAL_AUDIT job
  โ†’ validate frozen audit inputs and create controlled Replay job(s)
  โ†’ REPLAY_EXECUTION job calls the isolated runtime adapter
  โ†’ save counterfactual execution and bounded outcome artifact
  โ†’ CAUSAL_AUDIT finalization job calculates influence and classification

This hand-off gives each worker one responsibility. The audit handler governs the policy, evidence lineage, sample set, and final classification. The replay handler governs the isolated execution itself. Both commit their durable state before the next job is scheduled, so a process restart can resume safely rather than losing or duplicating a replay.

No generic Replay evaluation for controlled runs

The normal Replay evaluation and drift-comparison jobs are deliberately skipped for a controlled causal replay. Requiring a compatible source scorecard would reject a valid causal test for the wrong reason. The Causal Audit scorer uses the controlled adapter's bounded outcome artifact instead.

All required samples must complete with matching policy, evidence, replay, and score lineage. If evidence resolution, intervention generation, a replay, or scoring fails for one required sample, the audit becomes FAILED; the platform never publishes a best-effort influence value. Read Causal Audit for eligibility and reviewer-facing result meaning, or Controlled Replay Framework for the end-to-end integration and lineage model.

Persistence

Job records, attempts and state transitions are stored in the relational backend. Because state is durable, the control plane can restart at any time and resume tracking in-flight work without loss.

Operational Controls

  • Cancel a queued or running job.
  • Pause and resume a job queue by type.
  • Inspect attempts, leases and errors for any job.
  • Requeue interrupted jobs after investigation.