Skip to content

Determinism enforcement adapter

A run that calls a model is replayable only if the model runtime, the generation settings and the response cache it used are exactly those the control plane resolved for it. The control plane writes those three documents into the assignment, and the node's determinism gate checks, before the run is invoked, that every copy of them agrees and that each satisfies its own rules. A run that fails is stopped before it reaches the kernel. This page covers what the gate reads, each check in order, and the codes.

For how the control plane resolves these documents and chooses warn or block, see Policy transitions and runtime controls.

Three documents, three copies each

flowchart TB
  subgraph AS["ASSIGNMENT"]
    direction LR
    subgraph TOP["TOP LEVEL"]
      direction TB
      P1[("llm_runtime_pinning")]
      G1[("generation_controls")]
      C1[("llm_cache_contract")]
    end
    subgraph PL["PAYLOAD"]
      direction TB
      P2[("llm_runtime_pinning")]
      G2[("generation_controls")]
      C2[("llm_cache_contract")]
    end
    subgraph DC["determinism_contract, determinism.boundary.v1"]
      direction TB
      P3[("llm_runtime_pinning")]
      G3[("generation_controls")]
      C3[("llm_cache_contract")]
      GV[("governance.enforcement<br/>warn or block")]
    end
  end
  GATE{{"Determinism gate<br/>parity, then per-document rules"}}
  TOP --> GATE
  PL --> GATE
  DC --> GATE

Each document appears three times in the assignment, and all three copies must be identical, compared as canonical JSON. A change to any one copy after the control plane authored the assignment is therefore caught before the run starts.

The gate checks the integrity of controls the control plane has already resolved, with the warn or block mode the control plane chose. Rules about the model calls themselves, such as which model a call may use or a downgrade_model effect at the pre_llm hook, are policy rules and are evaluated by the kernel from the sealed run-plan. See The policy enforcement adapter.

The checks, in order

Check Refuses when Code
Contract present The assignment has no determinism_contract DETERMINISM_CONTRACT_MISSING
Contract version It is other than determinism.boundary.v1 DETERMINISM_CONTRACT_UNSUPPORTED
Parity Any copy of a document differs from the top-level one DETERMINISM_CONTRACT_MISMATCH
Pinning llm_runtime_pinning.required is true and complete is false DETERMINISM_RUNTIME_PINNING_REQUIRED
Generation defaults generation_controls.governed is true and a governed field differs from policy_defaults DETERMINISM_GENERATION_DEFAULT_MISMATCH
Stop limit requested_stop_count exceeds stop_max_count DETERMINISM_STOP_LIMIT_EXCEEDED
Override An override was requested and enforcement is block DETERMINISM_GENERATION_OVERRIDE_BLOCKED
Cache key llm_cache_contract.enabled is true and cache_key is empty DETERMINISM_CACHE_KEY_REQUIRED

The governed generation fields are:

temperature  top_p  top_k  max_tokens  presence_penalty  frequency_penalty
seed  tool_choice  parallel_tool_calls  stop_max_count

The stop-limit and override checks apply to governed generation controls. Enforcement is warn unless the contract's governance says block; under warn, an override is permitted and recorded by the control plane.

Outcomes

A run that passes records the gate's decision, xratud.determinism_enforcement.v1, with decision allow, the contract version, the enforcement mode, and whether generation is governed, pinning is required and the cache is enabled.

A run that fails completes as failed before invocation, with an assignment.blocked event whose reason is determinism_gate. The error carries the check's code and reason, and the evidence names what differed:

{
  "code": "DETERMINISM_CONTRACT_MISMATCH",
  "message": "determinism_contract_parity_mismatch",
  "details": {
    "stage": "pre",
    "evidence": {
      "contract_version": "xratud.determinism_enforcement.v1",
      "assignment_id": "asg_71c2",
      "run_id": "run_0e4d",
      "node_id": "summarize",
      "parity_failures": ["payload.generation_controls"]
    }
  }
}

parity_failures lists each copy that disagreed, by where it sits: payload.<document> or determinism_contract.<document>. DETERMINISM_GENERATION_DEFAULT_MISMATCH lists mismatched_fields, and DETERMINISM_RUNTIME_PINNING_REQUIRED lists the pinning's missing_fields.