Reference profile
How to run CALIBER as the reference deployment: the one shape that refuses to start on an unsafe setting, every requirement with its variable and reason, and a configuration that passes.
Use this page to run CALIBER as the reference deployment: one supported shape that refuses to start while any of the settings below is unsafe. It is the deployment the EGI reference architecture's claims (governed action, safe restart, evidence) are made about; docs/architecture/adr/0001-reference-profile.md defines the whole shape, and this page lists what the process itself enforces today.
Turn it on
Set CALIBER_PROFILE=reference. The default, development, starts with whatever is configured and behaves exactly as before. Under reference, create_app checks the configuration before it opens the database or creates the bootstrap account, so a refused start leaves nothing behind, and it lists every violation at once:
reference profile refused (2 violations):
- database_url is a SQLite file; set CALIBER_DATABASE_URL=<a PostgreSQL URL> for the reference profile [sqlite_database]
- csrf_enabled is false; set CALIBER_CSRF_ENABLED=true for the reference profile [csrf_disabled]
Each line ends with the violation's stable code in brackets. A line names the setting and the variable to change, never the value that was configured.
An unknown profile name is a configuration error. GET /ajax-api/2.0/mlflow/caliber/readiness carries a profile field, so an operator can see which rules the running process was started under.
Required Beta journey for Cookbook 22
The maintained Beta browser journey runs against this profile with a disposable PostgreSQL database, CSRF enabled, the effect reconciler enabled, and the project-scoped Harborlight connector binding. From the repository root, the CI-equivalent runner is:
CALIBER_LAB22_DATABASE_URL=postgresql+psycopg://caliber:caliber@127.0.0.1:5432/caliber \
scripts/cookbook-run-all.sh --labs 22
The required Beta journey (browser) gate installs the Cookbook 22 artifact through the public UI, checks exact two-person approval, injects a committed-but-unreadable downstream response, and recovers the resulting unknown proposal through the public effects routes. It then verifies accepted completion, the redacted evidence export, historical replay, and that reconciliation did not send a second mutation. The browser-only configuration is caliber/caliber-ui/playwright.beta.config.ts; it requires CALIBER_LAB_BASE_URL and never starts or reuses a server itself.
For an operator-triggered recovery, list the proposal for the affected run with GET /ajax-api/2.0/mlflow/caliber/system/effects?source=proposal&proposal_state=unknown&workflow_run_id=WR-..., then submit only an operational reason to POST /ajax-api/2.0/mlflow/caliber/system/effects/proposals/{proposal_id}/reconcile. The route asks the configured downstream for authoritative evidence; it does not accept an operator assertion that the effect happened and it never resends the effect.
What it requires
| violation code | setting | environment variable | required | why |
|---|---|---|---|---|
sqlite_database | database_url | CALIBER_DATABASE_URL | a PostgreSQL URL | SQLite allows one writer and the reference profile's recovery and ownership guarantees need row locks and real transactions. |
csrf_disabled | csrf_enabled | CALIBER_CSRF_ENABLED | true (with CALIBER_CSRF_SIGNING_SECRET set) | Without CSRF protection a page the approver visits can submit an approval for them. |
dev_fallback_enabled | auth_dev_fallback_enabled | CALIBER_AUTH_DEV_FALLBACK_ENABLED | false | The no-header fallback makes an unauthenticated request an admin. |
insecure_bootstrap | auth_bootstrap_allow_insecure_default | CALIBER_AUTH_BOOTSTRAP_ALLOW_INSECURE_DEFAULT | false | It allows an admin/admin bootstrap account when no password is set and the session cookie is not marked secure. |
trusted_header_without_proxy_secret | auth_mode | CALIBER_AUTH_TRUSTED_PROXY_SECRET_ENV | session, or trusted_header with the name of the variable that holds the proxy secret | Trusting an identity header without a proxy secret lets any client claim any identity. |
egress_policy_disabled | egress_policy_enabled | CALIBER_EGRESS_POLICY_ENABLED | true | The egress policy is what stops a tool or webhook from reaching internal addresses. |
mcp_insecure_http | mcp_allow_insecure_http | CALIBER_MCP_ALLOW_INSECURE_HTTP | false | Plain-HTTP MCP servers send tool calls and results in the clear. |
mcp_allowlist_not_in_profile | mcp_stdio_command_allowlist, mcp_remote_host_allowlist | CALIBER_MCP_STDIO_COMMAND_ALLOWLIST, CALIBER_MCP_REMOTE_HOST_ALLOWLIST | empty (the profile lists no MCP command or host) | An allowlisted stdio command is arbitrary code on the CALIBER host and an allowlisted remote host is an endpoint nobody reviewed; the dispatcher admits an MCP call, never a server. |
plugin_not_allowlisted | CALIBER_PLUGIN_ALLOWLIST | CALIBER_PLUGIN_ALLOWLIST | naming every installed optimizer plugin's distribution, or the plugin uninstalled | A plugin is code that runs inside the control plane and can write the artifact CALIBER promotes; the profile loads one only when its distribution is named, and refuses any other installed plugin. |
workflow_file_root_unconfined | workflow_file_root | CALIBER_WORKFLOW_FILE_ROOT | unset or a directory, never unconfined | unconfined lets a host-filesystem node read or write any path the server can reach; the profile confines host paths to a configured root or refuses them. |
self_approval_allowed | approval_allow_self_approval | CALIBER_APPROVAL_ALLOW_SELF_APPROVAL | false | The account that started a run could approve its own protected action. |
apply_distinct_approver_disabled | apply_require_distinct_approver | CALIBER_APPLY_REQUIRE_DISTINCT_APPROVER | true | The account that requested a refinement job could apply its own candidate to production, and a job with no recorded requester could be applied unreviewed. |
memory_inference_enabled | memory_infer | CALIBER_MEMORY_INFER | false while CALIBER_MEMORY_ENABLED is true | LLM-inferred memory writes create durable, free-form facts nobody owns; the owned memory lifecycle does not exist yet. |
http_lookup_cleartext | effect_http_verifiers | CALIBER_EFFECT_HTTP_VERIFIERS | every lookup_url is https | The read-back by key carries no credentials and its answer is what commits an effect: over cleartext anyone who can see or alter it can forge a receipt for an effect that never happened. |
fault_barriers_enabled | fault_barriers | CALIBER_FAULT_BARRIERS | unset | An armed fault barrier makes the process exit on purpose; it exists only for scenario tests. |
The messages in the refusal name the setting and the variable to change. The table is checked by caliber/tests/test_profile.py: a rule that is not listed here, or a row without a rule, fails the build.
MCP allowlists (B12.3b, #746)
CALIBER_MCP_STDIO_COMMAND_ALLOWLIST (default ${PYTHON}, the interpreter running CALIBER) and CALIBER_MCP_REMOTE_HOST_ALLOWLIST (default localhost,127.0.0.1,::1) decide which MCP servers the gateway will start or reach. An allowlisted stdio command is arbitrary code on the CALIBER host and an allowlisted remote host is an endpoint nobody reviewed, and the dispatcher admits an MCP call (connector mcp-tool, Governed MCP tools), never a server. So the Beta profile lists no MCP command or host: caliber.profile.REFERENCE_MCP_ALLOWLIST is an empty tuple (ADR 0001, amendment of 2026-10-31), and under CALIBER_PROFILE=reference a process whose either allowlist holds any entry refuses to start with the code mcp_allowlist_not_in_profile. The shipped defaults are entries the profile does not list, so a reference deployment sets both variables to the empty string explicitly:
reference profile refused (1 violation):
- mcp_remote_host_allowlist lists an MCP command or host the reference profile does not allow (it allows none); set CALIBER_MCP_REMOTE_HOST_ALLOWLIST to empty for the reference profile [mcp_allowlist_not_in_profile]
Recovery: set the variable named in the line to the empty string (CALIBER_MCP_REMOTE_HOST_ALLOWLIST=). Leaving it unset does not help: the unset value is the non-empty default, which is refused too. When both allowlists offend, one line names both variables. The message never quotes an entry. Blank items (,, spaces) are not entries.
- What an empty allowlist means at run time. The gateway already refuses a server whose command or host is not allowlisted (
mcp_server_not_ready), so with both lists empty no MCP server is reachable in a reference deployment, including the first-party PostgreSQL database servers (EP-114). That is the intent for the Beta: the exact dispatcher contract of a server must be supported before an entry is added to the tuple, which is an ADR change, not a setting. - The development profile is unchanged. It never runs this check; the defaults and any entries keep working there.
- Oracle.
caliber/tests/test_profile.py(each code, ordering, messages, the requirements table) and the scenariocaliber/tests/egi_scenarios/test_b12_mcp_startup_rule.py, which starts real reference processes: each unlisted entry exits the process before it serves, and the same environment with both lists empty answers its health route. - Not covered here. The rule reads the two settings only. It does not inspect the registered server records, the administrator's
tool_policies(an unclassified tool is already refused by the policy gate in both profiles), the other allowlists (CALIBER_MCP_STDIO_PYTHON_MODULE_ALLOWLIST,CALIBER_MCP_MANAGED_SIDECAR_HOSTS: they only narrow a command or host that the two lists already admit), or OpenAPI integration settings. - The shipped compose stack is a development deployment. It does not set
CALIBER_PROFILEand it passes the two variables through${VAR:-default}, which treats an empty value as unset, so it cannot express "empty" for a reference run. Start a reference deployment from its own environment, as in A configuration that passes.
What it also does at runtime
Beyond refusing to start, the reference profile bounds every request body: a body above CALIBER_REFERENCE_MAX_BODY_BYTES (default 1 MiB) is answered 413 with {"reason": "request_too_large", "max_bytes": N}, whether the client declared a large Content-Length or streamed the body without one (or understated it). The check is the outermost layer, so an oversized request is refused before authentication, CSRF or routing reads it. A request at exactly the limit is accepted, and the development profile installs no limit.
Two kinds of request have a limit of their own, because their routes accept more than 1 MiB. The larger limit applies; the default is never lower than a route's own:
| request | limit | setting |
|---|---|---|
multipart/form-data (skill zips, attachments, workspace imports, storage objects) | 256 MiB | CALIBER_REFERENCE_MAX_UPLOAD_BYTES; raise it together with CALIBER_WORKFLOW_STORAGE_MAX_UPLOAD_BYTES (250 MiB), which each route still enforces, tighter, afterwards |
| the GitHub webhook route | CALIBER_GITHUB_WEBHOOK_MAX_BODY_BYTES (2 MiB) | the route's own setting; the global 1 MiB never lowers it |
A refusal carries x-request-id (the caller's, or one generated) and writes one warning log line naming the method, path and size. The body is refused, not drained, so a client that keeps sending a very large body may see a connection reset rather than the 413.
Governed webhook and API-request nodes
Manifest-backed webhook and api_request nodes use the registered private http effect backend. Before a request is sent, the runtime records an immutable proposal containing the node occurrence, URL, method, headers, timeout and body. Dispatch then rechecks the exact bound approval and the captured execution-owner lease in one transaction, emits the durable dispatch event, and only then calls the private transport. The path does not call a public CALIBER route or recursively invoke the OpenAPI execution surface. Egress is checked before the proposal is submitted and by the default client at connection time.
The generic HTTP backend cannot assume that every endpoint supports durable idempotency or a lookup-by-key API. It therefore emits Idempotency-Key from the proposal's stable logical key (a workflow-supplied Idempotency-Key header with any other value is refused before anything is sent: the lookup that settles the effect asks by the logical key), but requires the runtime caller to provide an authoritative receipt verifier for the endpoint. The verifier must read the downstream's own state and return receipt facts matching the proposal's connector, resource, intent hash and attempt. In the worker that verifier is the read-back by key at an endpoint the operator listed (CALIBER_EFFECT_HTTP_VERIFIERS, see The generic HTTP connector's read-back). A missing verifier, missing exact approval or missing lease is refused before transport; a response that cannot be verified does not become committed and remains recoverable as an unknown effect, which the reconciler settles by the same lookup. The platform makes no universal exactly-once claim for arbitrary HTTP services.
In the reference profile a manifest-backed plan without this governed context is refused rather than falling back to the raw sender. Outside the reference profile it is not refused: see Profiles and a missing governed context. Legacy plans without a workflow manifest retain the existing _perform_guarded_effect ledger behavior and do not create an effect proposal. The runtime integration that owns a run must bind the context with the run id, exact approval provider, live execution-owner lease and endpoint-specific verifier. Since #1051 the worker does bind it in the reference profile (see The worker binds the governed path); since #1055 a webhook or API-request node whose exact URL the operator listed in CALIBER_EFFECT_HTTP_VERIFIERS is dispatched and read back by key, and any other URL is refused no_authoritative_verifier before its proposal is recorded.
Governed registered tools (B04.3)
A workflow tool node that names a registered Python tool is routed by the tool's registry row, read from the database for the tool being run: its name, owner, version, module, callable and declared side-effect level. The manifest binding, an exported bundle and the model do not decide it (IRToolBinding and ToolRegistryEntry carry no owner, so there is nothing in them to forge). A plan is governed when it is wired to the registry (an identity reader) or to an authority (a governed context); the table below lists every place the runtime builds a plan and which it is. OpenAPI bindings are routed the same way by Governed OpenAPI tools, and MCP bindings by Governed MCP tools.
| the registry row is | the tool node |
|---|---|
a CALIBER built-in (@caliber, version 1.0, its own module and callable) the protected-effect inventory refuses (EP-055: read_text_file, list_folder_files, grep_files, regex_search; sandbox_python) | refused before it is bound or called: registered tool '<name>' refused: unsupported_effect_path; nothing is recorded |
a CALIBER built-in classified read (and declared read) | runs inline, as before |
| any other CALIBER built-in | proposed, approved and dispatched at the inventory class (or the declared class when stricter) |
| a row that reuses a built-in's reserved name without being the seed's own row, a tool with no readable row, or an unrecognised declared level | classified irreversible_write, the fail-closed class, and dispatched; never inline |
an administrator-registered tool declared read | runs inline, as before |
an administrator-registered tool declared write or external_action | proposed, approved and dispatched; the proposal records irreversible_write because the inventory does not list it; the recorded class is always the stricter of the inventory's class and the class the row's declared level implies |
| a row whose module, callable or backend differs from the binding | refused: registered tool '<name>' does not match its registry row |
A protected call follows the same boundary as the governed HTTP nodes: the runtime records an immutable proposal (connector: registered_tool, resource registered-tool/<name>/<version>, the tool's arguments and input), asks the run's authorization provider for the exact approval and the captured execution-owner lease, and dispatch rechecks both in one transaction, consumes the approval and writes the dispatch event before the private registered_tool backend calls the bound tool. The tool is called with the arguments recorded in the proposal, not with what the caller still holds, and never retried (the binding's max_retries is ignored for a governed call): a tool that raises or times out leaves the proposal unknown for the reconciler. A local callable has no downstream key to replay, so the platform makes no exactly-once claim; it guarantees at most one claim per logical effect, and re-executing a finished node does not call the tool again. The registered_tool backend is a pinned entry of the reference profile's trusted connector table (REFERENCE_CONNECTORS): its implementation, capability record (no key to replay, no lookup) and settings (invoker, receipt_verifier) are admitted, and it accepts the risks write_not_exactly_once and key_retention_unconfirmed by name. As for HTTP, the run's context must supply an authoritative receipt_verifier; a response it cannot verify does not become committed.
Every refusal is a ToolExecutionError carrying a stable code and no argument, input or tool output:
registered tool effect proposal refused: bad_field # arguments or input too large or not plain JSON
registered tool effect authorization was not granted # no exact approval: the proposal stays `proposed`
registered tool effect authorization failed: ValueError # the provider raised; only the type is reported
registered tool effect dispatch refused: proposal_not_approved # not approved, or the node already ran
registered tool effect did not commit: ambiguous:unclassified_error # the tool raised: effect unknown, not retried
'tool_node' requires a governed effect context to run protected registered tool 'open_ticket'
registered tool 'open_ticket' identity could not be read: ConnectionError
Recovery: a proposed effect needs an exact approval, after which the run can be resumed or resubmitted (the proposal is reused for the same node occurrence, so the tool still runs once); an unknown effect is settled by the reconciler (B05) or an operator, never by re-running the node; a manifest-backed deployment whose run owner has not bound a governed context must keep protected registered tools out of its workflows in the reference profile, because it refuses them there (read-class tools are unaffected; outside the reference profile see Profiles and a missing governed context). Every construction site of a runtime plan (RuntimePlan() in the code, and what it does with a protected registry tool:
| plan built by | used for | registry reader | protected registry tool |
|---|---|---|---|
promoter.build_plan | worker runs, synchronous version runs, sub-workflows, Aria previews | bound | a worker run of an admitted reference-profile run gets a governed context (#1051); its nested subworkflows inherit that context only for operator-listed HTTP endpoints, while registered/OpenAPI/MCP effects remain refused no_authoritative_verifier; synchronous and preview plans have none: refused in the reference profile, legacy guarded path in development (#1068); a preview stubs it |
refinement._replay (via orchestrator/workflow_stages.py::run_workflow_eval) | candidate evaluation | bound by the stage | refused (typed, nothing recorded); read-class tools run |
calibration._replay_calibration_manifest (via evaluate_workflow_calibration_candidates in the stage) | calibration replay | bound by the stage | refused; read-class tools run |
promoter deploy-gate replay | release gate evaluation | none, but preview=True | stubbed, never run for real |
export_runtime.execute_exported_workflow | standalone exports | none (no registry to read) | not governed: called directly |
| a caller that builds a plan itself (tests, SDK embedding) | any | none unless it passes one | not governed: called directly |
Public caller disposition matrix (#1051)
The plan-construction table above describes the runtime primitive. This matrix is the public-entry contract around that primitive: it distinguishes paths that own an admitted run from paths that are preview-only or intentionally refuse. A passing unit or EGI test is the evidence for the current disposition; the table is not a promise that every inventory row has a dispatcher connector.
| public caller and source | run ownership and authority | current reference-profile disposition | behavioral evidence |
|---|---|---|---|
queued workflow run, routes/workflow_runs.py → orchestrator/workflow_run_worker.py::_bind_governed_contexts | the admitted run supplies its pinned grant/manifest, the worker's captured execution-owner lease, the approval provider and the configured receipt verifier | supported for the governed worker contract; listed HTTP effects and governed agent steps propose, park, resume the same occurrence, and settle by receipt; unverified or unbound backends refuse | tests/egi_scenarios/test_b05_governed_worker_wiring.py::test_a_proposal_is_approved_over_http_resumed_and_sent_exactly_once; the revoked-approver, lost-lease and missing-verifier tests in the same module |
nested workflow, workflows/promoter.py::_default_subworkflow_runner | inherits the parent worker's exact context, reconciliation gate and stable occurrence namespace; it does not obtain independent authority | supported only for the operator-listed HTTP verifier contract; registered-tool, OpenAPI and MCP effects remain no_authoritative_verifier | tests/egi_scenarios/test_b05_http_unknown_settlement.py::test_a_listed_nested_webhook_parks_resumes_and_mutates_downstream_once; ::test_nested_unknown_effect_recovery_parks_the_parent_and_never_resends |
synchronous version run, routes/workflow_versions.py::_run_workflow_version_sync | no owner lease or admitted grant exists in the request process | rejected before execution as sync_run_not_admitted when admission is enabled; with admission disabled it still rejects approval-bearing plans and has no governed protected-effect authority | tests/test_run_admission.py::test_a_synchronous_real_run_is_not_admitted_so_it_is_refused; tests/egi_scenarios/test_v14_reference_profile.py::test_a_hostile_version_that_predates_the_profile_cannot_be_previewed_promoted_evaluated_imported_or_exported |
evaluation route, routes/evaluations.py::_build_workflow_predict | synchronous evaluation has no run-owned lease or approval checkpoint | preview-only; protected tools are stubbed/refused and are not sent to a downstream | tests/test_routes_evaluations.py::test_run_evaluation_workflow_target; tests/test_registered_tool_dispatch.py::test_an_evaluation_replay_refuses_a_protected_registry_tool |
refinement and calibration replays, workflows/refinement.py::_replay and workflows/calibration.py::_replay_calibration_manifest | stage-owned replay, not an admitted workflow run | protected mapped agents are refused in reference; read-class tools may run; no dispatcher authority is inferred from the replay | tests/test_governed_worker_wiring.py::test_the_calibration_wrapper_refuses_a_mapped_agent_in_the_baseline_and_in_each_candidate_replay |
deploy-gate replay, workflows/promoter.py::evaluate_deploy_gates | gate evaluation is a bounded preview, not a production run | preview-only; protected effects are stubbed and cannot mutate an external system | tests/test_workflow_promoter.py::test_evaluate_deploy_gate_orders_bounded_sample_and_uses_preview |
Aria preview/evaluation tools, assistant/agent_tools.py::_t_preview_workflow_* and _t_evaluate_workflow_draft | no admitted run is created by the tool call | preview-only; protected tools are stubbed/refused | tests/test_assistant_agent_tools.py::TestExecuteHandlers::test_preview_workflow_draft; tests/test_assistant_agent_tools.py::TestDatasetAndEvalTools::test_evaluate_workflow_draft_scores |
Aria run_workflow, assistant/agent_tools.py::_t_run_workflow (EP-081) | the assistant only enqueues a real run after visibility/admission checks; the worker, not Aria, owns the governed context | supported as an enqueue boundary; protected execution is governed or refused when the queued worker runs | tests/test_assistant_agent_tools.py::TestExecuteHandlers::test_run_workflow_enqueues; worker EGI evidence in test_b05_governed_worker_wiring.py |
standalone export, workflows/export_runtime.py::execute_exported_workflow | no registry-backed plan authority, run lease or approval provider | refused in reference before a runner, plan or downstream is built; development compatibility remains explicitly ungoverned | tests/test_workflow_export_runtime.py::test_reference_profile_exported_query_is_refused_before_anything_is_built_or_run; ::test_reference_profile_exported_build_is_refused_before_anything_is_built_or_run |
caller-built RuntimePlan/SDK embedding | authority is absent unless the caller supplies the governed context explicitly | not a supported reference execution boundary: protected effects refuse; development keeps the documented legacy path | tests/test_registered_tool_dispatch.py::test_a_plan_without_a_workflow_version_keeps_calling_tools_directly; ::test_the_reference_profile_still_refuses_the_same_protected_tool_without_a_context |
This matrix does not add authority to run-less Aria published-tool calls (EP-034), exports or SDK embeddings. It also does not claim dispatcher support for the unresolved inventory rows owned by #1086 and #1087. Those paths remain separately tracked and fail closed where the current profile contract already requires refusal.
The two evaluation replays used to call a candidate manifest's write tools for real (found in review of B04.3); they now refuse them, so a workflow whose protected tool must be exercised by an evaluation or calibration needs that tool replaced by a read-class stand-in until the replay can run under a governed context (#1051). The module-import paths are inventory rows EP-015, EP-016 and EP-019, refused in the reference profile by B04.7 (#774): Refused paths in the reference profile.
Two limits. An administrator-registered tool declared read is trusted as read-class: its declared level is part of the definition the deployment bundle pins and re-verifies before a run (deployment_bundle.tool_snapshot), but the platform does not observe what its code does, so register a tool that writes with write or external_action. And model-chosen tool calls inside an agent step are classified like a tool node's and refused or proposed, never run, when protected (see Model-selected tool calls); OpenAPI tool nodes are routed by Governed OpenAPI tools and MCP tools by Governed MCP tools.
No migration, no new setting and no new route; rolling back is reverting the change (a registered_tool proposal already recorded remains readable and reconcilable).
Governed OpenAPI tools (B04.4)
A workflow tool node bound to a tool published from an OpenAPI integration (execution_backend: openapi_http) is routed by the tool's registry row, as a registered Python tool is, and by the operation that row selects. Two things the registry holds decide the class, and the stricter wins: the row's declared side_effect_level and the method of the operation its own backend_config describes (a tool pack's operation is chosen by the call's operation input from the row's list of bound operations, never from the binding). The manifest binding, an exported bundle and the model decide nothing: the binding's backend_config and input_schema must equal the row's, or the node is refused.
| the row and its operation | the tool node |
|---|---|
GET, HEAD or OPTIONS, declared read | runs inline, as before: no proposal, no approval |
GET, HEAD or OPTIONS, declared write or external_action | proposed, approved and dispatched (the declared level floors the class) |
POST, PUT, PATCH or DELETE, whatever the level (an under-declared read included) | proposed, approved and dispatched: a method that is not a read method is at least a reversible_write |
| a built-in's reserved name, or an unrecognised level | classified irreversible_write and dispatched; never inline |
| a tool with no readable row, a row that is not an OpenAPI tool, or an operation the row does not bind | refused before anything is recorded or sent |
| a binding whose configuration or schema differs from the row | refused: registered tool '<name>' does not match its registry row |
| a protected call in a plan with no governed context, or replaced by an injected callable | refused: nothing is recorded or sent |
| a protected method reaching the public OpenAPI entry from anywhere else (an export, a model-chosen call, Aria, an ungoverned plan) | refused before anything is prepared or sent: unsupported_effect_path |
The proposal (connector: openapi-http, always recorded irreversible_write, because the inventory does not list a registered tool) holds the resource openapi/<METHOD> <server><path template>, built from the row, and the arguments {"tool", "version", "input"}. Dispatch rechecks the exact approval and the captured execution-owner lease in one transaction, consumes the approval and writes the dispatch event before the private openapi_http backend sends. That backend sends through the private raw transport: it rebuilds the request from the row and the recorded arguments, requires the result to be the recorded resource (method, server and path) and sends nothing otherwise, so what is sent is what the approver saw, and it can never reach the dispatcher or the public entry again.
The public entry reads; the private transport sends. execute_openapi_http_tool (and bind_openapi_http_tool, which wraps it) is the public entry of the OpenAPI executor. It sends only an operation whose method reads (GET, HEAD, OPTIONS): any other method is refused with unsupported_effect_path before the input is validated, a secret is resolved or anything is sent, so no caller of it can perform a protected effect without a recorded, approved proposal. The method is read from the tool's configuration (a pack's operation is chosen by the input), never from a claim. A configuration that resolves to no operation gets the executor's ordinary configuration refusal instead. The send itself is the module-private _send_raw, which only the dispatcher's private backends (document request and openapi_http) and the executor module itself may name; the two development-profile compatibility entries over it are named in the sections below. It never calls the public entry, so a dispatched effect cannot re-enter the dispatcher or the public path. tests/test_effect_path_matrix.py fails when any other production module names _send_raw (test_the_private_raw_transport_is_named_only_by_pinned_modules) or the public entry (test_the_raw_openapi_executor_is_named_only_by_pinned_callers). A read-method tool is still classified by the registry row before it reaches the public entry (a GET declared write is dispatched), and Aria checks a tool's declared level itself.
Everything that can be refused without sending is refused before the proposal is recorded, so no approval is requested or spent for a call that cannot be made: the input against the row's schema, the server (a plain http(s) origin with no credentials, query or fragment, because its text is persisted in the resource), the egress policy for the request URL and for an OAuth token URL, an unsupported auth kind, a caller-supplied idempotency key and a conflicting precondition. No secret is resolved and nothing is sent at that point; the transport applies the egress policy again when it connects.
Keys, preconditions and retries.
- When the row binds an idempotency key header, the platform owns the key: the transport sends the proposal's stable logical key, and an
idempotency_keyinput or aheader_paramsentry for that header is refused (openapi_key_override_refused), never sent next to it. - When the row binds a precondition header (for example
If-Match), theexpected_resource_versioninput and aheader_paramsentry must agree (openapi_precondition_conflict). The value is recorded once, as the proposal'sexpected_resource_version(so the approval is bound to it and the approver's check compares it with the current version), and the transport sends it as the bound header. A recorded precondition the row cannot send is refused, never dropped. - The transport retries only when the request really carries an emitted key: a row with no key header is sent once, even for a method the executor would otherwise retry (
PUT,DELETE). With a key, the executor's own bounded retry (the row'smax_attempts, at most 5) repeats the same key within one dispatch. The dispatcher does not redrive an ambiguous effect after that dispatch, and the binding'smax_retriesis ignored for a governed call. The in-dispatch retry is an accepted risk, not a guarantee: the capability record leaves key scope and retention unconfirmed, so a downstream that does not honour the key can commit twice. Leavemax_attemptsat 1 unless the downstream is known to replay a key.
Headers, and what is stored. header_params may not set a method-override header (X-HTTP-Method-Override, X-HTTP-Method, X-Method-Override) or a framing or hop-by-hop header (Host, Content-Length, Content-Encoding, Transfer-Encoding, Connection, Keep-Alive, Proxy-Connection, Proxy-Authorization, TE, Trailer, Upgrade, Expect; case-insensitive): classification uses the row's method, and a downstream that honours an override would turn a read into a write. The check applies to every call of the executor, an inline GET included, and is refused as openapi_header_forbidden (a governed call, before the proposal) or as an executor error that names no header (an inline call). It does not cover a method override carried in a query parameter or a body field a particular downstream might honour. The input is recorded verbatim: body, header_params, query_params and path_params are stored in the proposal's args.input (caliber_effect_proposals) and shown to the approver, so credentials belong in the row's auth_binding (a secret reference resolved at send time), never in the call's input. The proposal never records the auth binding.
What an answer proves. The openapi-http capability record promises nothing about a downstream: no key scope or retention, no lookup by key, no documented rejection status. So a 2xx is a claim that the run's authoritative receipt_verifier must confirm (an unconfirmed claim stays unknown), and every other answer, a 4xx included, is unknown rather than failed. A connection dropped or timed out after the downstream committed is unknown: the node does not run again, the reconciler has no lookup binding for this connector and leaves it (not_bound), and only the verifier, a receipt callback or an operator can settle it. The connector is a pinned entry of REFERENCE_CONNECTORS (backend kind openapi_http, settings operation and receipt_verifier, accepted risks write_not_exactly_once and key_retention_unconfirmed).
Every refusal is a ToolExecutionError with a stable code and no argument, input, header, URL or response body:
OpenAPI effect proposal refused: openapi_egress_blocked # the request or token URL fails the egress policy
OpenAPI effect proposal refused: openapi_input_invalid # input breaks the row's schema, or a path parameter is missing
OpenAPI effect proposal refused: openapi_key_override_refused # a caller-supplied idempotency key for a row that binds one
OpenAPI effect proposal refused: openapi_precondition_conflict # If-Match and expected_resource_version disagree, or are blank
OpenAPI effect proposal refused: openapi_config_invalid # the row's server or path cannot be used (credentials, query, scheme)
OpenAPI effect proposal refused: openapi_auth_unsupported # the row binds an auth kind the executor does not support
OpenAPI effect proposal refused: openapi_header_forbidden # header_params sets a method-override, framing or hop-by-hop header
OpenAPI tool 'tickets' refused: openapi_operation_unresolved # a pack operation the row does not bind
OpenAPI tool 'tickets' refused: unsupported_effect_path # no readable OpenAPI row for the tool
unsupported_effect_path: a protected OpenAPI call is sent only by the effect dispatcher # a non-read method at the public entry
OpenAPI effect authorization was not granted # no exact approval: the proposal stays `proposed`
OpenAPI effect dispatch refused: proposal_not_approved # not approved, or the node already ran
OpenAPI effect did not commit: ambiguous:http_503 # unknown: the answer proves nothing, nothing is resent
OpenAPI effect did not commit: receipt_unverified # a 2xx the verifier could not confirm: unknown
'tool_node' requires a governed effect context to run protected OpenAPI tool 'open_ticket'
Recovery: a refusal before the proposal needs the input, the row or the egress allowlist corrected (nothing was recorded). A proposed effect needs an exact approval, after which the run can be resumed (the proposal is reused for the same node occurrence). An unknown effect is settled by the receipt verifier, a receipt callback or an operator (see the recovery runbook), never by running the node again.
After the approval. The backend rebuilds the request from the row and the recorded arguments and checks it again, the egress policy included. Any failure at that point (a recorded proposal that is not the row's operation, or a destination that stopped passing the egress policy since the proposal, a transient DNS or allowlist change included) sends nothing and settles the proposal failed with the reason not_sent; the dispatch's internal refusal code is not surfaced, and the approval is already consumed: ask for a new proposal (run the node again after fixing the cause).
Not routed through the dispatcher, and what they can do now (B04.4b). Model-chosen tool calls inside an agent step (refused or proposed before they reach the entry, see Model-selected tool calls), the Aria assistant's published-tool call (EP-034: protected rows are explicitly refused in the reference profile because there is no workflow run to propose into), standalone exports and plans a caller builds itself (#1051: build_plan binds the registry reader but no governed context, so a in the reference profile a deployed workflow's protected OpenAPI nodes are refused (the worker's context has no verifier for the connector yet, #1055, #1051), and outside it they run inline through a named legacy entry, see Profiles and a missing governed context; read-class GET nodes always run) all reach the public entry, which refuses a protected method with unsupported_effect_path. For Aria specifically, the reference-profile entry refuses a declared write or external_action row, and a declared read row whose selected method is not GET, HEAD or OPTIONS, with unsupported_in_reference_profile before input validation or transport. Declared read-class GET/HEAD/OPTIONS remains available; a workflow write needs the governed route above. This is a behavior change for an Aria deployment in build mode with auto_all or full_autonomy approval, which no longer offers a write or external-action tool to the model (it could only fail), for a tool declared read whose operation is a POST (refused rather than sent), and for a standalone export whose tool writes. The operator's draft preview route (EP-033) is read-only in the reference profile (#1072): it sends through the public entry, so a draft whose operation is not a read (GET, HEAD, OPTIONS) is refused, see Draft preview is read-only. The callers of the public entry are pinned by tests/test_effect_path_matrix.py::test_the_raw_openapi_executor_is_named_only_by_pinned_callers, so a new one fails until it is routed or pinned with a reason.
Configuration, migration and rollback. No new setting, no route and no migration. The two names openapi_http and openapi-http become reserved tool names like the other connectors (409 reserved_tool_name); a tool already registered under one is untrusted and unaffected. Reverting the change restores the direct call (a proposal already recorded remains readable).
The worker binds the governed path (#1051)
In the reference profile the workflow-run worker builds the governed contexts for an admitted run it owns, from state the server holds (caliber.effects.governed_context). Nothing a request, a manifest, a tool call or a model supplies becomes authority, and a trusted input that is missing is a refusal, never an implicit allow.
| trusted input | where it comes from |
|---|---|
| the execution-owner lease | a provider the lifespan binds to the process's ExecutionRoleController (WorkflowRunWorker.bind_lease_provider), read at the moment an effect is dispatched and compared in the claim and in every settlement write. No lease: lease_unavailable, nothing is claimed |
| the approver's authority | the decision route records who decided (decided_by and the quorum). The scopes a dispatch attests are derived then from the configured user lists (CALIBER_ADMIN_USERS, CALIBER_APPROVER_USERS, CALIBER_OPERATOR_USERS) for every one of those approvers and intersected, so a scope revoked since the decision is gone (role_revoked) and a quorum is as strong as its weakest approver. Project role, membership, the requester and the initiator are re-derived by the commit recheck itself, as before |
| the requester | the run's initiator, run.created_by, read from the run row (an approval request names it; the approver must be someone else) |
| which tools may be proposed through | CALIBER_AGENT_STEP_TOOL_BACKENDS, keyed by the tool's registry identity (name, version), never by a local name in a manifest |
| the downstream an effect is sent to | the base_url of the connector's binding in CALIBER_EFFECT_CALLBACK_CONNECTORS for the run's project: the address the reconciler asks, so an effect is never sent where it cannot be looked up. No binding: connector_unbound, refused before anything is claimed |
| step limits and the run's token budget | the operator's ceilings (CALIBER_AGENT_STEP_MAX_*) and CALIBER_AGENT_RUN_MAX_TOKENS |
An agent step, end to end. An agent node bound to a mapped tool runs as a governed step; every other agent node runs as before (a governed step has no text output, so only an agent built to propose is governed). The scripted or real model proposes a protected action: the platform binds it to the inventory, records one proposed effect and the approval request bound to that exact intent, and the run parks waiting_approval on that request. A person other than the initiator decides it over HTTP (POST /workflow-runs/{id}/approval/approve). A decision does not wake the run (it records the human decision and nothing else); an operator resumes it (POST /workflow-runs/{id}/resume), which is the one point where the run runs again. The node finds its proposal instead of asking the model again, and the producer's dispatch_approved crosses the dispatcher: the approval is consumed and the dispatch claimed in one transaction under the lease before the downstream is called, the downstream is sent the proposal's stable key exactly once, and the receipt is read back by the connector's own lookup by key. committed completes the node; anything short of it (an ambiguous answer, a receipt that could not be read back, a worker killed after the send) leaves the proposal dispatched or unknown and the run waiting_effect, which the reconciler settles by key and then wakes. A rejected request is final (approval_rejected); an expired one is asked again; a revoked approver, a lost lease or an unbound connector fails the node with its fixed code and sends nothing.
What each plan shape gets. legacy_guarded_effects stays, so the development profile is unchanged.
| plan | governed context |
|---|---|
| a worker run, admitted, reference profile | the effect context, and the step context when an agent node is bound to a mapped tool |
| the same, with an agent bound to a mapped tool but no lease binding, no initiator, no usable manifest digest or a configuration that does not parse | the run fails (governed_context_unavailable) before the model is asked: never a legacy agent |
| the same, but the run was not admitted | the run fails (run_not_admitted) if an agent in it can reach a mapped tool; otherwise nothing is bound and a protected node is refused for want of a context |
| a worker run in the development profile | nothing bound: the legacy path of Profiles and a missing governed context |
a synchronous version run (build_plan outside a worker run) | no owner lease in the process that builds the plan, so no context: a protected node is refused in the reference profile and takes the legacy path in development, exactly as before. An agent in such a plan that is bound to a mapped tool, or whose handoffs can reach one, directly or through other agents, is refused when it runs (agent '<id>' can reach a tool the operator mapped to a governed backend, and this plan has no governed step for it): build_plan records the agents bound to a mapped tool (RuntimePlan.agents_requiring_governance, reference profile only) and the interpreter checks each agent's handoff closure, cycle-safe |
| a subworkflow invoked by an admitted reference-profile worker run | inherits the worker's exact effect context and reconciliation gate for the same run; only operator-listed HTTP endpoints are dispatchable, with a stable occurrence namespace per parent invocation. Registered/OpenAPI/MCP effects remain refused for want of an authoritative verifier, and agents remain without a governed step context |
| an evaluation, a gate replay or an Aria preview | run as previews (preview=True): protected tools are stubbed, so the refusal above does not apply to them |
refinement and calibration replays (the stage tells the replay which agents are mapped, agents_requiring_governance) | not previews: this change makes a mapped agent (or one that hands off to one) refused in the replay, so evaluating or calibrating a workflow whose agent is bound to a mapped tool scores an error in the reference profile (give the replay a manifest without the mapped agent); what a replay does with a protected registry tool is the registered-tools table above, and protected model-chosen tool calls in replays are #1079's |
| the deploy-gate replay | unchanged: a preview, protected tools stubbed |
| standalone exports and plans a caller builds itself | unchanged: not governed |
A workflow node is bound to the context; only an operator-listed webhook or API request is dispatched. The context the worker binds has the whole mechanism (a proposal, an approval request bound to the exact intent, a park behind it, a dispatch under the lease) and names the backends it can verify. Since #1055 that is the generic http backend, for exactly the URLs the operator listed for the run's project in CALIBER_EFFECT_HTTP_VERIFIERS (the read-back is described in The generic HTTP connector's read-back); with nothing listed the context dispatches nothing. The registered_tool, openapi_http and mcp connectors have no lookup by key the platform can call, so an outcome it could not read back would end unknown with no way out: such a node, and an HTTP node whose URL nobody listed, is refused before its proposal is recorded, so no approval is asked for or spent on it:
HTTP effect refused: no_authoritative_verifier
registered tool effect refused: no_authoritative_verifier
OpenAPI effect refused: no_authoritative_verifier
MCP effect refused: no_authoritative_verifier
A verifier for a backend (effect_context(authority, verifiers={...})) is what makes it reachable; the backends a production run reaches are document_request, through a governed agent step, and http at listed endpoints, through a webhook or API-request node. A protected MCP tool call (B04.5) goes through the same context and is refused the same way.
Limits, stated plainly.
- A governed workflow effect, or a governed agent, inside a fan-out, loop, error boundary, handoff or
parallelbranch cannot park the run: the run is refused up front (agents) or fails (effects). - The legacy
requires_approvalgate of a tool node still asks first, with its own node-level request; a governed effect then asks the exact-intent question, so such a node is approved twice. - A proposal that names a resource version is sent only through a connector whose downstream enforces the precondition atomically with the write (
document_requestdoes: a stale version is the downstream's 412, a definitive rejection). The platform has no read of its own for another connector's target, so a versioned proposal for any other connector isversion_unverifiable. - A revoked approver, a lease that is gone before the claim, or a connector with no binding ends the run
failedwith the proposal stillproposeduntil the run's own end settles it (the run's end moves a never-dispatched proposal tofailedwith the reasonrun_failed, and withdraws its live requests, see Settling what a run never dispatched); a downstream that rejects ends it with the proposalfailed. A refusal or an error that arrives after the downstream was called (settling refused because the lease moved on, a verifier that raised) is not a failure of the run: the proposal is read again, an open one (dispatched,unknown) parks the runwaiting_effectfor the reconciler and a committed one completes the node. - A webhook or API-request node whose effect ends
unknown(a timeout after the send, a 5xx, a 2xx the lookup cannot see yet) fails its run (ToolExecutionError: HTTP effect did not commit: ...): unlike a governed agent step it does not park. The proposal staysunknown, and the reconciler settles it by the listed lookup without sending again. Settling it does not resume the failed run, and a run that is woken after a settlement (a dispatcher killed after the send) finds its one logical effect alreadycommittedand fails withHTTP effect was already recorded as committed; not run again: the response of the original send was never durable, so the node cannot complete from it. Before running such a workflow again, read the proposal: a new run is a new effect with a new key, and the downstream may already hold the first one (see the recovery runbook). - Model-chosen tool calls of an agent that is not governed are not routed (#768). An agent that is bound to a mapped tool, or can reach one through handoffs, is either governed (the worker's own graph) or refused in every plan
build_planand the refinement and calibration replays build outside a preview; a plan a caller builds by hand and passes noagents_requiring_governanceis not covered (it is not governed either: see the table). - If the store is down at both the settlement and the re-read that follows a failed dispatch, the run fails
store_failed; the proposal is still the reconciler's (it was claimed, so it isdispatchedorunknownand is settled by key). CALIBER_AGENT_STEP_TOOL_BACKENDSoutside the reference profile is ignored and logged at startup (there is no lease to dispatch under).
No migration. The new setting is CALIBER_AGENT_STEP_TOOL_BACKENDS (default []: no agent is governed, and a reference profile with the default behaves as before). Rolling back is reverting the change; a recorded proposal stays readable and reconcilable.
The generic HTTP connector's read-back by key (#1055)
The generic http connector has no platform-wide read-by-key contract: a webhook is any URL. What it has is per endpoint, and the operator's decision. CALIBER_EFFECT_HTTP_VERIFIERS is a JSON array of {"project_id", "resource", "lookup_url"} (default [], validated at startup, read once by the reconciler loop and per run by the worker). For effects of that project whose recorded resource (the URL the node sends to, compared exactly: scheme, host, port, path and query as the workflow writes it) is resource, the downstream is asked at lookup_url (http or https, a host, no credentials, no query, no braces). A manifest, a tool call or a model chooses only which listed resource an effect is for, by naming its URL; it cannot add one or point a lookup somewhere else, and an unlisted URL is refused before it is recorded.
The contract the downstream implements: GET <lookup_url>?idempotency_key=<key> answers 200 with a JSON object holding the request it stored under that key: idempotency_key (the proposal's logical key), request_id (its own id, 1 to 239 printable characters; unique per endpoint, see below), method, url and body (the JSON value it stored, null when there was none; numbers are compared as JSON numbers, so 12 and 12.0 are the same and 12.5 is not). Anything else is not a receipt: a 404, a 5xx, a redirect, another status, an unreadable body, or a stored request whose key, method, URL or body is not the proposal's (compared as canonical JSON). A proposal that expects a resource version is never verified (this connector cannot read one back). The lookup is a plain read through the same read-only executor the reconciler uses, so the egress policy applies (an internal address needs the operator's allowance) and no credentials are sent: expose it on a network the platform may reach. The reference profile refuses a lookup_url that is not https (http_lookup_cleartext; the development profile accepts http): the key is a public digest and the answer is what commits an effect, so a cleartext path would let anyone who can see or alter it forge a receipt. Each lookup has a 5 s timeout (it runs after every 2xx, on the worker thread, under the dispatch lease; a slow downstream leaves the effect unknown for the reconciler). The executor does not cap the size of an answer (a limit that predates this change): list only endpoints you operate.
Request ids are per endpoint. The database keeps one receipt per (connector, downstream_request_id) and every http endpoint shares the connector, so the receipt records <first 16 hex of sha256(resource)>:<request_id>: stable across restarts and config order, and two endpoints (or projects) that both issue 1 cannot starve each other. Within one endpoint an id still belongs to one proposal: a downstream that reuses an id for a second effect gets a receipt_conflict and that proposal stays unknown (it cannot take another endpoint's ids). It must read its own writes: a 2xx the sender saw is visible to the very next lookup.
What the platform does with it, and nothing else:
| Moment | What the platform does |
|---|---|
| right after a 2xx | asks the lookup once; a stored request that is this effect becomes a verified receipt and the proposal committed; anything else leaves it unknown (receipt_unverified) |
| after a timeout, a 5xx, a settle that failed, an abandoned or expired dispatch | the proposal is unknown; the reconciler (loop, or the operator's reconcile) asks the same lookup by the same key. It never sends the effect again |
the lookup finds nothing (404) | still unknown, pass after pass: for this connector a 404 is never "it did not happen" (absence_proves_noncommit is false), because the request may still be in flight |
| the lookup cannot be reached, or the resource is not listed | lookup_failed, or not_bound (nothing is asked) |
The capability record (http, version 1) says so and its digest is pinned in REFERENCE_CONNECTORS: lookup_by_key true with read_your_writes, no precondition, no documented rejection status, key scope and retention unconfirmed (so the connector still carries the write_not_exactly_once and key_retention_unconfirmed accepted risks). It changes the pinned digests of the http connector, which is the re-admission the record promises. A downstream that reuses a key for a different request, or whose lookup is not honest, is outside what the platform can know: the receipt is as sound as the endpoint the operator chose to list.
The attested operator resolution of a permanent unknown is now a separate, evidence-bearing mechanism (#1054): an admin on the execution owner may POST .../system/effects/proposals/{proposal_id}/attest-failure with resolution: "failed", an operator reason and an opaque downstream evidence reference. It uses the existing unknown -> reconciled -> failed transitions, records the decision in the same audit transaction and wakes parked runs. It cannot attest committed; only a verified receipt can produce that state. Without downstream evidence, the proposal stays unknown and its dependents remain blocked, exactly as the runbook says. The registered_tool, openapi_http and mcp connectors remain unverifiable and refused. The receipt callback (POST .../effects/callbacks/receipt) still knows only document-request.
Draft preview is read-only (#1072)
The operator's draft preview (POST /openapi-integrations/{id}/tool-drafts/{draft_id}/preview, inventory EP-033) fires one real upstream request for an unpublished draft. It is gated by the caliber.admin or caliber.operator scope, the project action resource.execute and the draft's allow_in_preview flag, and it is audited, but allow_in_preview is set by the same operator who fires the call. A write sent through it would therefore be self-approvable: no second person, no proposal, no lease and no receipt.
- Reference profile (and a process with no config, which is treated as the reference profile). Preview sends through the public entry, so it sends only a read: a draft whose operation is
GET,HEADorOPTIONSpreviews as before, and any other method is refused before the input is validated, a secret is resolved or anything is sent. The answer is409withreason_codeunsupported_effect_pathand a fixed message that names no method, server, path, draft or input value. The refusal is audited aspreview_openapi_tool_draftwitherror: unsupported_effect_path; no request left the platform. A write goes through a published tool in a workflow, where the dispatcher proposes, approves and sends it. - Development profile. Unchanged: preview sends any method through the named legacy entry
execute_legacy_openapi_draft_preview, still gated byallow_in_previewand audited. It is a compatibility exemption for a laptop, not the governed path, and the reference profile never reaches it.
tests/test_effect_path_matrix.py pins both names: the route may name the public entry (RAW_OPENAPI_CALLERS) and the legacy entry (LEGACY_PREVIEW_CALLERS), and no production module outside the dispatcher and the executor names the private _send_raw (RAW_TRANSPORT_CALLERS lost the route). There is no new setting, route or migration. A deployment that previewed a write in the reference profile now gets the 409; read previews are unaffected.
Governed MCP tools (B04.5)
An MCP server is untrusted: its tool names, descriptions, annotations such as readOnlyHint, and results are data the platform reads, never a classification. A workflow tool node bound to an MCP tool and an MCP node are therefore classified from three things CALIBER itself holds, for exactly the tool being called:
- the MCP server record (
caliber_mcp_servers: transport, command or URI, arguments, the names of its environment variables and headers), read from the database for the run's identity, never from the manifest binding or the model; - the tool policy an administrator wrote (
tool_policies:allowed,side_effect_level,requires_approval), which the policy gate already requires to be explicit and complete: a tool the server lists but nobody classified is refused, not guessed at; and - the protected-effect inventory (EP-114), which applies to the first-party PostgreSQL MCP server only, and only under the reference profile (B04.7, #774, switched every inventory row; see Refused paths in the reference profile). That server is recognised from the record and the deployment settings, never from the tool names a server reports: a
stdioserver that runs the CALIBER interpreter with-m caliber.mcp_servers.db, or a remote server whose host the operator listed inCALIBER_MCP_MANAGED_SIDECAR_HOSTS(the shipped compose stack runs the three first-party database servers as such sidecars). That setting attests an isolation boundary, not an identity, so a third-party server on an attested sidecar host is treated as the first-party one too and its tools named like EP-114's are refused (the conservative direction): list only hosts that run the first-party servers if that matters. A server on any other host, however it names its tools, is third-party and is classified by its own administrator's policy.
| the server record, policy and inventory say | the tool node or MCP node |
|---|---|
side_effect_level: read (an approval-requiring read keeps the workflow binding's own approval gate) | runs inline, as before: no proposal |
write | proposed, approved and dispatched; recorded irreversible_write (the inventory does not list a third-party MCP tool) |
external_action | proposed, approved and dispatched; recorded irreversible_write |
the server lists the tool but there is no complete policy for it, the policy is invalid or has allowed: false, the tool is not in the discovered list, or the server is not ready (status, transport, allowlist, blocked address) | refused with a stable code before anything is recorded or sent |
| a write tool of the first-party database server (EP-114), whatever the administrator classified it as, under the reference profile | refused: unsupported_effect_path (the development profile classifies it by the policy like any tool) |
| a server the run's identity cannot read, or a timeout the connector does not accept | refused: mcp_server_unavailable, mcp_timeout_invalid |
| a protected call in a plan with no governed context (reference profile; the development profile runs it inline as before, see below), or replaced by an injected callable | refused: nothing is recorded or sent |
The binding's declared side_effect_level and a server's readOnlyHint decide nothing: a binding that claims read cannot make an administrator's write inline, and a server that claims a tool is read-only does not change it.
The proposal (connector: mcp-tool) holds the resource mcp/<server_id>/<tool> and the arguments {"server_id", "tool", "server_digest", "arguments"}. server_digest binds the server record and the three classification fields the decision was made from (no credential value: the names of the environment variables and headers and the authentication type are in it, a rotated token is not). Dispatch rechecks the exact approval and the captured execution-owner lease in one transaction, consumes the approval and writes the dispatch event before the private mcp backend sends. That backend reads the server record again and classifies the call again: the recorded server, tool, resource and digest must be the trusted call's, and the call must still be protected, so an administrator who blocked, reclassified or edited the server after the approval was requested is seen, and nothing is sent (the proposal is settled failed, reason not_sent, and the approval is already consumed: ask for a new proposal). The recorded arguments are what is sent.
Execution policy is preserved, and checked again. The backend sends through the gateway's own transport, so the tool-policy gate, the stdio command, module and environment checks, the isolation wrapper, the remote-host allowlist and the resolved-address check all run again at dispatch, and a rate limit is consumed by the call that really goes out (an exceeded limit is proven_not_sent: failed, approval spent). The address check is made when the connection is prepared, not pinned to the connection: a DNS answer that changes between that check and the connect is an existing limit this change does not close.
What an MCP server can confirm: nothing the platform can rely on. MCP has no idempotency key, no precondition and no lookup by key, so the mcp-tool capability record promises nothing and the connector is a pinned entry of REFERENCE_CONNECTORS (backend kind mcp, settings call and receipt_verifier, accepted risks write_not_exactly_once and key_retention_unconfirmed).
- A returned result is a claim. It becomes
committedonly when the run'sreceipt_verifierreturns facts for this proposal; otherwise the proposal staysunknown(receipt_unverified). Most MCP servers cannot read their own effects back through a channel the platform trusts, so a deployment that wantscommittedneeds a verifier that asks the system of record by something the workflow put in the call's arguments (the platform sends the server no key). - Anything that may have reached the server and did not return a result is
unknown, notfailed: a timeout, a dropped session, an MCP error, and a result the server marksis_error(an untrusted server can say a call failed that ran). Only a failure the gateway proves came before the request (policy, egress, command allowlist, a session that never opened, a rate limit) isfailed. The call is sent once: the dispatcher does not redrive an ambiguous effect, the binding'smax_retriesis ignored for a governed call, and the reconciler has no lookup for this connector (not_bound), so anunknownMCP effect is settled by the verifier, a receipt callback or an operator. - The result is untrusted data. It must be plain JSON of at most 256 KiB and 32 levels of nesting; anything else is
unknown(ambiguous:result_out_of_bounds) and is neither stored nor returned. The returned object is a JSON round trip, so nothing of the server's making survives into a record or a response. No credential is read into a record: the proposal holds the arguments and the digest, never the server's environment, headers or authentication.
Under the reference profile the gateway entry points refuse a protected call. invoke_tool_sync and invoke_tool_by_server_id_sync (what the runtime's MCP-bound callables, MCP nodes and exported workflows call) run only a tool whose trusted classification is read, and raise EffectRefused (mcp_effect_requires_proposal; unsupported_effect_path for a first-party database write tool) for every other, with nothing sent. Under the development profile (the default) they let a protected call through, as before the dispatcher (#1068; development is an allow-list, so any other profile refuses): that inline call has no proposal, exact-intent approval, lease or receipt and is not the governed path (see "Profiles and a missing governed context" below). The one caller of the ungated transport (invoke_tool_raw_sync) is the dispatcher's mcp backend; tests/test_effect_path_matrix.py pins every module that names the gateway, so a new caller fails until it is routed or pinned with a reason. The operator's discover, test and playground routes use the async transport directly (EP-038 to EP-040, exempt: they are not agent-reachable and need the operator scope).
Every refusal is a ToolExecutionError with a stable code and no argument, URL, header or result:
MCP tool 'issue_write' refused: mcp_tool_unclassified # listed by the server, no complete administrator policy
MCP tool 'issue_write' refused: mcp_tool_not_discovered # not in the discovered list (run discover-tools)
MCP tool 'issue_write' refused: mcp_tool_not_allowed # the policy says allowed: false
MCP tool 'issue_write' refused: mcp_server_not_ready # status, transport, allowlist or address blocks the server
MCP tool 'issue_write' refused: mcp_tools_not_discovered # nothing discovered yet (run test-connection and discover-tools)
MCP tool 'insert_rows' refused: unsupported_effect_path # a first-party database write tool (EP-114)
MCP tool 'issue_write' refused: mcp_server_unavailable # the record cannot be read by the run's identity
MCP tool 'issue_write' refused: mcp_timeout_invalid # the node's timeout is not a finite number of seconds, at most 300
MCP node 'n' refused for 'srv'/'tool': mcp_effect_requires_proposal # a caller-built plan reached the gateway with a write
MCP effect authorization was not granted # no exact approval: the proposal stays `proposed`
MCP effect dispatch refused: proposal_not_approved # not approved, or the node already ran
MCP effect dispatch refused: connector_config_not_admitted # the backend settings are not the pinned ones
MCP effect did not commit: not_sent # failed: a policy, egress or session failure before the request
MCP effect did not commit: ambiguous:may_have_been_sent # unknown: the request may have reached the server; nothing is resent
MCP effect did not commit: ambiguous:result_out_of_bounds # unknown: the answer was not bounded plain JSON
MCP effect did not commit: receipt_unverified # a result the verifier could not confirm: unknown
'tool_node' requires a governed effect context to run protected MCP tool 'issue_write'
Recovery: a refusal before the proposal needs the policy, the server record or the allowlist corrected (nothing was recorded), for example PATCH /mcp-servers/{server_id}/tools/{tool_name}/policy with an explicit allowed, side_effect_level and requires_approval. A proposed effect needs an exact approval, after which the run can be resumed. A failed effect needs a new proposal. An unknown effect is settled by the receipt verifier, a receipt callback or an operator (see the recovery runbook), never by running the node again: check the server's own system of record first.
Behaviour changes to plan for. What happens to a protected MCP call depends on the profile (the classification itself does not):
| the call | reference profile | development profile (the default) |
|---|---|---|
MCP node or tool node, an authority is bound (governed_effects) | proposed, approved, dispatched, but only for a server the gateway can reach: the reference profile requires both MCP allowlists empty, so no server is reachable yet (MCP allowlists) | proposed, approved, dispatched |
MCP node or tool node in a build_plan plan, no authority bound (#1051) | refused: requires a governed effect context to run protected MCP tool | runs inline, as before B04.5, behind the node's own approval gate: not governed (legacy_guarded_effects) |
a model-chosen call inside an agent step of a build_plan plan | refused by the loop gate before the tool is entered (_refused marker, code protected_tool_requires_governed_step); proposed in a governed agent step (Model-selected tool calls) | runs inline, as before: not governed |
| a caller-built plan (no registry reader, no context), a generated export | refused by the gateway entry point (EffectRefused; a model sees an error marker) | runs inline, as before: not governed |
| a first-party database write tool (EP-114) | refused: unsupported_effect_path | classified by the administrator's policy like any tool |
| an unclassified, blocked, undiscovered or not-ready tool | refused (both profiles) | refused (both profiles) |
An operator can still call any tool from the playground (EP-039/040, exempt).
Not covered by this change: a governed path for the development profile (it keeps the alpha inline call until #1051), a key channel to MCP servers that could use one, pinning the resolved address to the connection, or contexts for synchronous, preview, evaluation, calibration and export execution.
Configuration, migration and rollback. No new setting, no route and no migration. The names mcp and mcp-tool become reserved tool names like the other connectors (409 reserved_tool_name). Reverting the change restores the direct call (a proposal already recorded remains readable).
Profiles and a missing governed context (#1068)
build_plan (worker runs, synchronous version runs, sub-workflows) binds the registry reader but no execution-owner lease and no exact-intent approval provider. Since #1051 the worker binds a GovernedEffectContext after build_plan for an admitted run in the reference profile (The worker binds the governed path); the plans build_plan returns to every other caller still have none, and this section is what they do. The dispatcher routing of B04.2, B04.3 and B04.4 made every protected node of a manifest-backed plan fail for that reason in every profile, which broke the shipped cookbook labs (03, 04, 05, 07, 08, 09, 16 and 19) on main. The decision, from ADR 0001 ("Features outside the shape keep working in development", "The profile never silently falls back to a weaker control"), the B04.2 scope ("keep _perform_guarded_effect for runs without a manifest (legacy)") and #774 (the refusals are config.profile == "reference"): the refusal is a reference-profile control, not a development-profile one. build_plan therefore sets RuntimePlan.legacy_guarded_effects from the profile, and a protected node with no governed context behaves like this:
| node | reference profile (CALIBER_PROFILE=reference) | development profile (the default) |
|---|---|---|
| webhook or API-request node, no context | refused: '<node>' requires a governed effect context for manifest HTTP execution | _perform_guarded_effect: egress policy, then the legacy effect ledger (at most one send per run, node and input across a restart; a definitive failure is retryable, an ambiguous one is reported indeterminate) |
| protected registered tool, no context | refused: '<node>' requires a governed effect context to run protected registered tool '<name>' | runs inline, as before B04.3, behind the node's own approval gate (requires_approval); no ledger, as before |
| protected OpenAPI tool, no context | refused: '<node>' requires a governed effect context to run protected OpenAPI tool '<name>' | runs inline, as before B04.4, behind the node's own approval gate, through the named legacy entry bind_legacy_openapi_http_tool (the private raw transport; the public entry still refuses a protected method) |
| protected MCP tool or MCP node, no context (B04.5) | refused: '<node>' requires a governed effect context to run protected MCP tool '<name>' | runs inline through the gateway entry point, as before B04.5, behind the node's own approval gate; unclassified and blocked tools are still refused |
read-class tool, GET OpenAPI node or read-class MCP tool | runs inline | runs inline (unchanged) |
| any node, a context is bound | governed path | governed path: a bound context is never bypassed and a refusal from it is final |
What the development path does not guarantee. It is not the governed path and gives none of its guarantees: no persisted proposal, no exact-intent approval (the node's own approval is a legacy gate that approves "this node may run", not "this exact request"), no distinct-approver check at the effect, no execution-owner lease recheck, no receipt, no registered_tool/http/openapi_http connector admission, no reconciler. The HTTP path keeps the legacy ledger's at-most-once claim; the tool paths have only what they had before the dispatcher. Nothing about it is a Beta or reference claim (ADR 0001: features outside the shape stay out of Beta claims), and the operator effects view labels such rows legacy_ledger, not proposals.
What stays refused in every profile. Only the "no governed context" refusal is profile-dependent. Everything else in the route still applies in both: the built-ins the inventory refuses (EP-055 host-file tools, sandbox_python: unsupported_effect_path), a binding that is not its registry row, an unreadable registry, a tool with no readable OpenAPI row, an OpenAPI call replaced by an injected callable once governed, egress policy, and the preflight checks. A model-chosen OpenAPI call and Aria's published-tool call are not tool nodes, so they never take the legacy entry. Model-chosen calls use the public executor entry, which refuses a protected method (unsupported_effect_path); Aria's published-tool entry additionally applies the EP-034 reference-profile refusal to the trusted row and selected method (unsupported_in_reference_profile). In a build_plan plan of the reference profile the loop gate refuses a protected call earlier, with a typed code (Model-selected tool calls). Calibration and refinement build RuntimePlan directly, so their flag is False and a candidate manifest's protected tools are refused there. The evaluation route (routes/evaluations.py) calls build_plan, so in the development profile its plan carries the flag; that is harmless, because a preview blocks HTTP nodes and the governed tool routes return None in a preview (a replay does not reach the legacy path, and the legacy OpenAPI entry is never bound for a preview).
How the switch is made. RuntimePlan.legacy_guarded_effects defaults to False (fail-closed), so a plan built by any caller other than build_plan and every reference-profile plan refuses. build_plan sets it to config.profile == "development", an allow-list, so a profile added later is fail-closed until it is listed; a missing config is the development profile, as everywhere else in build_plan. One helper, _legacy_effects_allowed(plan) (the flag and no bound context), is the only place the runtime decides it, for the HTTP, registered-tool and OpenAPI routes and for the legacy OpenAPI binding. bind_legacy_openapi_http_tool is named only by workflows/runtime.py (pinned by tests/test_effect_path_matrix.py::test_the_development_profile_legacy_entry_is_named_only_by_the_runtime). There is no setting, environment variable, route or migration, and no approval hook: nothing returns True for an authorization.
Cookbook labs. The labs run the development profile and create manifest-backed plans, so they depend on this path: the worker binds the governed context (#1051) in the reference profile only. Their UI specs depended on a second profile-blind rule: the console's Run control (#968) required an approved workspace release and environment for every project workflow, which the development server does not require, so its Run button stayed disabled. The console now offers and requires the pair only when GET /capabilities reports workflow_runs.lineage_required (true exactly where the server refuses a run without lineage: the reference profile). The Cookbook labs workflow now also runs on pull requests that touch the workflow runtime, the effect dispatcher, integrations, policy, the run worker and routes, profile.py and config.py, and on every push to main that touches them (it takes about fifty minutes, so it is not a required check).
Moving off it. #1051 wired the context in the worker (an authorization provider, the execution-owner lease, park and resume while an approval is pending), for the reference profile only: the development profile has no execution-owner lease to dispatch under, and no generic connector except http at operator-listed endpoints has an authoritative receipt verifier (#1055). legacy_guarded_effects is therefore not removed: it goes when the development profile can dispatch under a lease and the workflow connectors can be verified. A deployment that needs the exact-intent guarantees must run CALIBER_PROFILE=reference, where a protected workflow node is refused rather than sent without them.
Memory is owned, derived and read-mostly
Until the owned memory lifecycle (M20: retention, legal hold, deletion) exists, the reference profile does not offer free-form durable memory (B12 memory, #667). The /memory API and the in-run memory tools behave as follows:
- No free-form partition.
agent_idmust name an agent or workflow, andrun_ida workflow run, that the caller can see;user_idmust be the caller's own identity, admins included. A scope value that is present but not a non-empty string is a400, not ignored. A run id alone is refused (403). - The partition is pinned to the caller. With an
agent_id, the memory is the caller's own within that agent or workflow (the server addsuser_id); with none, it is the caller's own namespace, qualified by the active project (<project>:<user>). A client never chooses whose memory a read or write reaches, andmetadatamay not carryuser_id,agent_id,run_idoractor_id(400), because mem0 filters on those stored fields. - One refusal, no disclosure. A partition that does not exist, one that belongs to another project or user, and a label that names nothing all answer
404 memory partition not found; no id is echoed. - Writes are verbatim.
POST /memoryrequiresinfer=false(403otherwise), because LLM-inferred writes create durable facts nobody owns; and startup refusesCALIBER_MEMORY_INFER=truewhile memory is enabled (table above). - No bulk deletion.
DELETE /memoryanswers403: deleting memory needs the lifecycle's retention and legal-hold rules. - Bounded reads.
top_kis capped at 100. - In-run tools.
memory_search,memory_add,memory_listandlist_entitiesact on the run initiator's memory within the workflow (the initiator is set by the server, never by the model); a run with no initiator gets no memory tools. - Same rules below the route. The service layer refuses bulk delete, inferred writes, run-only partitions and partition keys in
metadata(MemoryLifecycleUnavailableError). It does not itself check that anagent_idoruser_idbelongs to the caller: the route and the in-run tool binding do that and are the only callers.
The development profile keeps the previous behaviour. The service uses mem0 2.x's supported scope contract for search and list: entity identifiers are passed in the filters mapping, not as top-level arguments. add and delete_all retain mem0's entity-keyword API, while list_entities already passes its scope as filters. This keeps the installed mem0 release and the service wrapper on the same boundary without changing the reference profile's ownership or lifecycle refusals.
Trace payload visibility in review surfaces
Reference-profile trace visibility and trace-payload visibility are separate decisions. A caller may see a trace or a review queue without being allowed to read request, response, span input, span output, or governed trace attributes. For a project-owned experiment, the current project owner and editor roles may read those payloads; viewers and reviewers do not. An administrator without membership in the owning project is not an implicit payload reader.
The observability trace detail route and the review-queue alignment-example route use the same fail-closed contract: non-payload identifiers, status, timing, review question answers, provenance, and assessment identifiers remain, while governed request/response values are replaced with stable [redacted:<field>] placeholders. The queue detail route itself contains item identifiers and review metadata only; it does not grant payload access.
POST /eval-datasets/{dataset_id}/examples/from-trace first resolves trace identity and visibility without mapping payloads. It then requires trace.payload.read before copying the source request or response. A visible trace without that permission receives 403, a foreign or unknown trace receives the same 404 as a missing trace, and neither refusal changes the dataset version or inserts an example. Supplying explicit input or expected values does not bypass the source-trace authorization check. An authorized example records the from-trace and source trace tags.
The development profile retains its earlier behavior; these payload gates are part of the reference-profile contract.
Governed effect spans: the ids that link a trace to its rows (B11.3a, #737)
A governed effect crosses four persisted records: the effect proposal, the policy decision that authorised the run, the runtime approval that was consumed, and the effect itself, which is its verified receipt. The spans of that path name those rows, so an operator can go from a trace to the database without reading any payload. The module is caliber.observability.span_attributes; B11.3b (#745) reads the same attributes back as a causal chain.
| Span (type) | Opened by | Attributes it can carry |
|---|---|---|
effect.approval.commit_check (CHAIN) | approval_valid_at_commit | caliber.proposal_id once the locked proposal is read; caliber.approval_id once the request is bound to that proposal's exact intent, policy and evidence; caliber.decision_id from the run's current policy decision, only when every check passed |
effect.dispatch (TOOL) | dispatch | caliber.run_id from the validated proposal/run relationship; caliber.proposal_id from the proposal read; caliber.approval_id and caliber.decision_id from the validator's answer; caliber.effect_id after the settlement has committed |
effect.receipt.write (CHAIN) | record_receipt | caliber.run_id from the persisted proposal/run relationship; caliber.proposal_id; the proposal's recorded approval (caliber.approval_id for an exact-intent approval, caliber.decision_id for a policy decision); caliber.effect_id once the receipt is stored in the caller's transaction |
run_tags(ctx, node_id=..., proposal_id=..., decision_id=..., approval_id=..., effect_id=...) accepts the same four ids for a caller that has read them from a row, and emits each as caliber.<name> only when given.
The effect.dispatch and effect.receipt.write spans also carry caliber.run_id when the immutable proposal has a matching persisted CaliberWorkflowRun row. This is a separate, payload-free run-correlation attribute, not a fifth causal-link id and not part of the GET /workflow-runs/{run_id}/causal-links four-key union. In particular, an out-of-runtime reconciler call can still be correlated to its workflow run from the proposal row. If the proposal/run relationship is missing or malformed, the attribute is omitted; the persisted proposal, receipt and run rows remain the authoritative fallback for B11.3b.
An id is a link only if a row backs it. An attribute is absent, never blank or guessed, when the platform has not read that row: a proposal that never reached a verified receipt has no caliber.effect_id (unknown and failed included), the receipt-write span has no caliber.decision_id for an exact-intent approval (the proposal row does not store it), and the approval id a caller passes to dispatch is a claim until the validator has bound it to the proposal, so a refused dispatch never carries it. caliber.effect_id is the receipt id: the platform's only record that the downstream effect happened and was read back.
What can reach a span. Four causal-link keys plus one run-correlation key, one allow-list, no payload:
- Only the four causal-link keys above, the separate
caliber.run_idcorrelation key,caliber.refusal_codeand the tracer's owncaliber.status,caliber.error_typeandcaliber.errorare set on these spans. No URL, argument, request, response, scope, approver, evidence hash or exception message is ever an attribute. - A value must be a plain string that is an opaque identifier: ASCII letters, digits,
.,_,:,-, starting with a letter, at most 128 characters. Anything else (a number, an email address, whitespace, a path, a longer string) is dropped, not truncated: a truncated id would name a different row. - A workflow manifest cannot assert a link. Its
mlflow.trace_group_tagsare merged into the run tags first, and the six reserved keys are removed from them, so a tag namedcaliber.proposal_idorcaliber.run_idis ignored. - A failure inside one of these spans is recorded as the exception type and, only when it is a platform refusal (
ProposalError,EffectRefused,ApprovalCommitRefused), its stablecaliber.refusal_codesuch asstale_version; thecodeof any other exception is not copied. The exception is re-raised after the span has closed, so MLflow's own exception event, which keeps the message, never sees it on these three spans. The re-raised exception still passes through any enclosing span (the workflow node span,trace_run), where MLflow records its message as it did before this change. - Tracing never changes the outcome of an effect: a redactor or tracer failure while setting one of these attributes is logged at debug level and the attribute is absent (the value is never sent unredacted).
Who can see them. The ids, caliber.refusal_code and the existing run, node and job ids are on profile.SAFE_SPAN_ATTRIBUTES, so a caller who may see a trace but not read its payload (B11.4b, above) sees them; every other span attribute stays [redacted:attributes.<key>], which includes caliber.error. An id does not widen who can open a trace: the trace, and then the row, still follow experiment and project visibility. caliber.approval_id is also the name of an existing release tag (AP-..., a prompt-version approval, see the prompts architecture page); on these spans it is always a runtime approval (RAP-...), told apart by the span name.
Refusal and recovery, with exact examples.
- A stale approval. The recheck finds the resource moved on. The
effect.approval.commit_checkspan hascaliber.proposal_id,caliber.approval_id,caliber.refusal_code = stale_versionandcaliber.status = failed, and nocaliber.decision_id;effect.dispatchhascaliber.proposal_idand the same code. Nothing was sent, the approval is unconsumed and the proposal is stillproposed. Recovery: request a new approval for the current resource version. - An approval id that is not this run's. The recheck answers
not_found; no span carries that id, only the proposal (read from the row) and the code. Recovery: use the id returned when the request was created. - A lease lost after the effect was sent.
effect.dispatchhas the proposal, approval and decision (the claim had committed),caliber.refusal_code = lease_lostand nocaliber.effect_id; no receipt exists and the proposal staysdispatched. Recovery is unchanged: the reconciler asks the downstream by key under the new lease. - An answer nobody could verify (an ambiguous transport result, or a 2xx the downstream's own query did not confirm). The proposal becomes
unknown;effect.dispatchcompletes withoutcaliber.effect_id. A missing effect id is the signal, not an error.
Not covered, said plainly. The node span of a workflow run does not carry these ids (the dispatcher's own spans do, and the same ids are in the database); the legacy effect-ledger path used by a plan with no governed context emits none; and the receipt-write span describes a write: if the caller's transaction is rolled back afterwards, the dispatch span, which names the effect only after commit, is the authority. Tracing is inert unless MLflow is installed and tracing is enabled, and an exporter failure never changes what the effect does.
Configuration, migration and rollback. No new setting, no migration and no stored data change. The spans open inside the transaction that holds the approval locks, but make no database call of their own. Rolling back is reverting the change; traces already recorded keep their attributes.
Reading the links back: GET /workflow-runs/{run_id}/causal-links (B11.3b, #745)
The spans above name rows; this endpoint returns the rows. It answers, for one run, with the persisted records that connect it to its governed effects, by id, digest, state and timestamp only, so a reviewer (or the evidence package of B14) can follow run -> manifest -> step context -> proposal -> approval -> decision -> receipt without reading a payload. It is read-only and is implemented by caliber.observability.causal_links (read_causal_links), which takes an already-authorized run row and never an id from a request.
Who may call it. The same access as reading the run (a run you cannot see is 404) plus a role in the run's project (read: viewer, reviewer, editor or owner), evaluated on every request from the caller's current membership. A caller who can see the run but has no role in its project, a caller from another project, a platform administrator with no project role (caliber.admin is not a project role) and an unknown id all get the same 404 (workflow run '<id>' not found), and a malformed parameter from such a caller is also that 404, never a 400. Nothing in the query string (a project, a second run id) widens access. A run with no project is gated by its workflow's visibility alone, as the admission manifest is.
Sections and paging. section is effects (the default), context_manifests or policy_decisions; only that list is filled and the other two are []. limit is 1 to 200 (default 50). cursor is the opaque next_cursor of the previous page (the id of its last row); while has_more is true pass it back. Pages are keyset pages ordered by (timestamp, id), so rows that share a timestamp are neither skipped nor repeated, and a cursor that names no row of this run, or is not one this API issued, is 400 cursor is invalid (a cursor from another run opens nothing). A page costs a fixed number of queries (the run manifest, the page, and one lookup each for contexts, approvals, decisions and receipts), not one per effect.
What an effect shows. For each proposal: proposal_id, node_id, occurrence_id, node_step_id, state, connector, connector_version, effect_class, intent_hash and the two timestamps, then four links, each with a status and, when it is not simply linked, a stable code. The statuses: linked (a row of this run), not_required (the record shows the link is not on this effect's path), pending (the effect is still in flight, so the row is expected to appear), missing (the chain needs a row, the effect is settled or the stored id names nothing, and there is none: a broken chain) and unrecorded (the platform does not store this link against the effect, so it can be neither followed nor called broken). In-flight work is never missing:
| Link | linked | Other statuses and codes |
|---|---|---|
context_manifest | the latest context manifest of this node occurrence (highest attempt, then highest revision), by id, revision, attempt and digest | unrecorded / no_context_manifest_for_node_step (a step that is not an agent step has none, and the proposal does not say which kind of step it came from, so its absence is neither followable nor proven broken) |
approval | an exact-intent approval request the proposal records, bound to this proposal in this run: ids, digests, request status, superseded_by, requested, decided, expires and consumed timestamps | not_required / approved_by_policy_decision; pending / approval_not_consumed (a request exists but the dispatcher has not consumed it; its id and status are shown), approval_not_requested; not_required / failed_before_approval (settled failed with no approval ever recorded); missing / approval_row_missing (the stored approval id names no row bound to this proposal in this run) |
decision | the policy decision that authorised the effect, by id and run: the one a policy-approved read names, or, for an exact-intent effect consumed since migration 0134, the commit-time decision stored on its approval request. Id, action, result, reason codes, policy version, input hash, evaluated-at | unrecorded / decision_recorded_per_run_only (an exact-intent effect consumed before 0134, below); pending / not_approved_yet; not_required / failed_before_approval; missing / decision_row_missing (the stored decision id names no decision of this run) |
effect | the verified receipt: effect_id (the receipt id, the id caliber.effect_id carries), attempt, receipt and response digests, verified-at, and committed (true when the proposal records that receipt as the one that settled it) | pending with not_dispatched, outcome_pending, outcome_unknown or reconciled_without_receipt, by the proposal's state (the effect is not settled); not_required / failed_without_receipt (settled failed: nothing was verified and nothing will be); missing / receipt_row_missing (settled committed, which requires a receipt, but no receipt row is there) |
missing_links lists only the missing links (a broken chain) and unrecorded_links the unrecorded ones, so a complete chain (missing_links == []) is distinguishable from a broken one, and a healthy exact-intent effect consumed since migration 0134 has missing_links == [] and a linked decision (unrecorded_links names only context_manifest for a non-agent step; one consumed earlier also names decision). An absent effect_id is the marker for an effect that has no verified receipt, in the API as on the span; it is never filled in from a neighbouring row, a timestamp or the proposal's state.
span_attributes is the caliber.* attribute map that the effect's resolved rows support, built by the same allow-list function (causal_attributes). It is a derived union, not what any one span carries: each span binds only the ids it had read when it closed (the receipt span binds the proposal's recorded approval ref even if that row is gone). The commit-time decision_id of an exact-intent effect is listed when its approval request stored it and the decision row resolved for this run; for an effect consumed before 0134 it is not listed (the dispatch span still carries it). An id is listed only when its row resolved for this run. Nothing is read from the tracing backend, so it cannot confirm that a trace was exported.
Digests. manifest_digest (run and context manifests), receipt_digest and a policy decision's input_hash are bare lowercase SHA-256 hex (64 characters). intent_hash, evidence_hash, policy_digest and response_digest are sha256:-prefixed (71 characters). They are stored in those forms and returned unchanged; compare like with like.
The decision of an exact-intent approval (B11.3c, #1061). The commit-time check (approval_valid_at_commit) records a run decision (resource.execute on workflow:<id>, the run authority) and the dispatch span names it. Since migration 0134 the dispatcher also stores that decision's id on the approval request it consumes (caliber_runtime_approval_requests.commit_decision_id), in the same claim transaction and the same UPDATE that sets consumed_at, from the ApprovalCommit the validator returned; a refused or rolled-back dispatch leaves neither. The proposal's frozen columns are not touched. The API resolves the id by run (and the request by proposal, as for approval), so for an exact-intent effect consumed after 0134 decision is linked with the decision's fields, caliber.decision_id is in span_attributes, and the id equals the PolicyDecision row in section=policy_decisions and the span's caliber.decision_id. A stored id that names no decision of this run is missing / decision_row_missing.
The database enforces the write (PostgreSQL and SQLite triggers): an INSERT cannot carry the column; an UPDATE may set it only from NULL, to a non-empty value, on a bound request whose consumed_at moves from NULL to a value in that same UPDATE; once set, neither it nor consumed_at can change. There is no backfill. A request consumed before 0134 keeps NULL, its effect's decision stays unrecorded / decision_recorded_per_run_only and its caliber.decision_id is not in span_attributes; the run's decisions are still listed per run (section=policy_decisions), and the API does not pair them by time. A consumer such as the evidence package (B14.1, #818) should treat decision: unrecorded on an exact-intent effect as "run authority asserted per run only" for those older effects: include the run's policy_decisions section and do not fail the chain or invent a pairing. The approval request's approval_request v1 contract is unchanged (the column is lifecycle state, like consumed_at, not part of what the approver is asked), and the causal-links response schema gains no field: the decision link already carries the decision's fields.
Whole-run markers. run_manifest is linked (id, schema version, digest, creation time; the manifest body stays at /admission-manifest), legacy (legacy_run_has_no_manifest: a run admitted before manifests has none and never will) or missing (manifest_row_missing: an admitted run whose row is not there). acceptance and evidence_package are {status: not_available, code: acceptance_record_not_available | evidence_package_not_available} when the corresponding record is not present; an evidence package (B14) is not synthesized. trace_id is the run's stored trace id, a pointer only.
Replay observations (B09.3, #799). A replay-enabled runtime plan may bind an ObservationRecorder to a workflow run. After each agent/provider turn it writes one immutable model observation and one immutable read observation for each observable tool result. The database row stores the run, project, principal, node occurrence, attempt, request digest, content digest, provider provenance and storage reference; the bytes are written to the configured StorageBackend. Identical requests at different loop occurrences therefore remain separate, while a changed request or content at an already-recorded occurrence is a conflict. Reads resolve the project and principal scope before touching storage and then verify both byte length and SHA-256, so a foreign-scope read cannot probe an object and a changed object cannot become replay input. Migration 0136 must be applied before enabling this recorder; rolling code back leaves the immutable table and objects unused.
Bounded historical replay (B09.4, #805). An authorized project reader can ask the platform to compare the stored acceptance decisions with a pure re-judgment of one admitted run:
POST /ajax-api/2.0/mlflow/caliber/workflow-runs/WR-1/replay
X-CALIBER-Project: project-a
Content-Type: application/json
{}
HTTP 200 returns an enveloped ReplayReport with schema_version: "v1", the immutable manifest id/digest, the selected observation ids and count, the criteria version, one decision comparison per governed proposal, and matches_original. The optional body is {"observation_ids":["OBS-deadbeef"]}. The list is non-empty, unique, lowercase OBS- ids and is bounded at 256; an omitted list selects all observations visible to the caller, also bounded at 256. Each verified object is bounded at 1 MiB.
This endpoint is synchronous and read-only. It calls neither a model/provider nor a downstream reader, dispatcher or effect connector; it does not write a decision, run summary, audit row or any other SQL state. It reads the immutable admission manifest with legacy: false, checks that the pinned workflow version and project match the run, scopes the observation index by run/project/principal before reading object bytes, and verifies each content digest and byte length. The current supported replay shape is deliberately narrow: document-request proposals judged by harborlight-v1, with recorded JSON case reads projected to case_id and document_requests (each request may contain only the fields the live acceptance projection reads). A recorded model observation is accepted only in the v1 runtime shape {final_output, structured_output, tool_calls, model, prompt_version} with tool_calls a list. Unsupported connectors, criteria versions, observation kinds or payload shapes are refused; replay never guesses a replacement or falls back to live execution.
Refusals are explicit and carry the stable code in detail; no stored observation bytes are included. Examples:
POST .../workflow-runs/WR-1/replay {}
409 {"detail":"observations_missing: the run has no visible observations"}
POST .../workflow-runs/WR-1/replay {"observation_ids":["OBS-deadbeef"]}
409 {"detail":"observation_scope: one or more observations are outside the replay scope"}
POST .../workflow-runs/WR-1/replay {}
409 {"detail":"observation_integrity: an observation failed its storage integrity check"}
The first two examples recover by supplying the exact project/principal-scoped observation ids and retaining the manifest/object pair; the third requires restoring the immutable storage object from the deployment's backup or discarding the replay request. A malformed request is 400; missing/tampered/foreign/malformed/unsupported or over-bound observations, missing/tampered pins, and an un-replayable decision set are 409. None of those responses starts a new run or invokes a live dependency. This is a bounded comparison surface, not the B14 evidence package and not a second storage contract: replay consumes B09.3 rows and the existing run-manifest and acceptance contracts only.
Isolated counterfactual fork (B09.5, #812). A counterfactual is a new, separately authorized run, never a mutation or retry of the historical source. The service-level entry point is caliber.replay.runner.fork_counterfactual(session, backend, ...); it reads the source's verified observations and governed proposals, then writes only the new run's manifest, counterfactual_spec, candidate observations and acceptance decisions. The new caliber_workflow_runs.source_run_id is deliberately separate from parent_run_id, which remains retry lineage.
The required call supplies a non-empty changed_pins object and an independent budget. The default ScriptedCandidateAdapter is deterministic and provider-free; a live adapter must declare requires_live_authorization and the caller must pass authorize_live_evaluation=True. The adapter receives only a copied, verified case record and immutable pins: it receives no SQL session, provider, dispatcher or protected-effect handle. Protected writes are recorded as disabled in the fork specification and no effect proposal or receipt is dispatched. The fork records one read observation per distinct candidate case in StorageBackend and decisions use cf- candidate ids, so source decisions and observation bytes remain untouched.
from caliber.replay.runner import ScriptedCandidateAdapter, fork_counterfactual
report = fork_counterfactual(
session,
storage_backend,
run=source_run,
project_id="project-a",
principal="operator_a", # authorization actor
source_principal="editor_a", # source evidence scope
changed_pins={"model_routes": ["fake/counterfactual"]},
candidate_adapter=ScriptedCandidateAdapter(
{"MORT-1": {"case_id": "MORT-1", "document_requests": []}}
),
)
session.commit() # the caller owns the transaction boundary
Refusals are stable and fail closed: counterfactual_source_invalid for an unscoped or incomplete source, counterfactual_pins_invalid for an empty/unchanged/unsupported pin set, counterfactual_budget_exceeded for either bound, counterfactual_adapter_refused for a malformed or failed adapter, and counterfactual_authorization_required for an unauthorized live adapter. Recovery is to correct the authority, pins, budget, or scripted fixture and submit a new fork; the source is never retried or rewritten.
Migration 0137 adds the nullable source_run_id and counterfactual_spec columns plus a source index. It is readers-first: apply it before deploying a writer, and do not backfill existing runs. Rolling back drops only the new columns and index; counterfactual rows should be retained or explicitly removed under the deployment's evidence-retention policy before that rollback. No configuration default or public HTTP/SDK route is added by B09.5; a future public surface must preserve this authorization and storage contract rather than calling a provider directly.
What it never returns. No prompt, argument, intent body, resource of a proposal, resource version, downstream request id, manifest or context body, requested_by / decided_by / subject_user_id, decision prose or policy purpose. The queries select only the columns above, and the response schema (CausalLinksSchema) forbids any other field, so a column added to a table cannot reach a caller by accident. Connector and node names are manifest- and registry-defined identifiers and are shown; a policy decision's resource is the platform identifier the decision was asked about (workflow:<id>, effect:<proposal id>). Every lookup by an id stored on a row is also filtered by the run and, for an approval, by the proposal, so a stored id that names another run's row is reported missing, not followed.
Refusal and recovery, with exact examples.
- Another project's run, or a run that does not exist:
GET /workflow-runs/WR-1/causal-linksis404{"detail": "workflow run 'WR-1' not found"}for both. Recovery: ask a member of the run's project, or check the id. - A removed project member:
404from the next request, whatever they could read a moment ago. Recovery: restore the role. ?section=payloads:400 section must be one of effects, context_manifests, policy_decisions.?limit=500:400 limit must be between 1 and 200. A cursor kept from another run or a tampered one:400 cursor is invalid; start again withoutcursor.- A proposal with
effect.status = pendingandcode = outcome_unknown: the downstream's answer could not be verified. There is noeffect_idto find; the reconciler asks the downstream by key (see Reconciler below). Reading this endpoint does nothing to it.
Consistency. A page is assembled from a handful of reads in one request, not from one snapshot: an effect being dispatched while you read can show an approval as pending and its effect as pending, and a later read shows both linked. A link that appears is always a row that exists; none is ever inferred.
SDK, configuration and rollback. client.workflows.runs.causal_links(run_id, section=, limit=, cursor=) (sync) and client.workflows.causal_links(...) (async) return a typed CausalLinks page (CausalEffect, CausalContextManifest, CausalPolicyDecision and the link models are in caliber_sdk.models); an unknown field is kept in extra and a missing status decodes as None, never as linked. No new setting. The endpoint is a read, but the exact-intent decision link needs migration 0134 (above), which adds one nullable column and two triggers and changes no stored data; migrations run before the new code serves. Rolling the code back leaves the column in place and unused (the old code ignores it); alembic downgrade 0133 drops it with its triggers, and the decision ids it held (the decisions themselves are immutable rows and stay).
A configuration that passes
CALIBER_PROFILE=reference
CALIBER_DATABASE_URL=postgresql+psycopg://caliber:CHANGE_ME@db.internal:5432/caliber
CALIBER_AUTH_MODE=session
CALIBER_AUTH_BOOTSTRAP_ADMIN_PASSWORD_ENV=CALIBER_BOOTSTRAP_PASSWORD
CALIBER_AUTH_BOOTSTRAP_ALLOW_INSECURE_DEFAULT=false
CALIBER_AUTH_DEV_FALLBACK_ENABLED=false
CALIBER_ADMIN_USERS=admin
CALIBER_APPROVER_USERS=approver
CALIBER_CSRF_ENABLED=true
CALIBER_CSRF_SIGNING_SECRET_ENV=CALIBER_CSRF_SIGNING_SECRET
CALIBER_EGRESS_POLICY_ENABLED=true
CALIBER_MCP_ALLOW_INSECURE_HTTP=false
CALIBER_MCP_STDIO_COMMAND_ALLOWLIST=
CALIBER_MCP_REMOTE_HOST_ALLOWLIST=
CALIBER_APPROVAL_ALLOW_SELF_APPROVAL=false
CALIBER_APPLY_REQUIRE_DISTINCT_APPROVER=true
Two of the variables name other variables that hold secrets (CALIBER_BOOTSTRAP_PASSWORD and CALIBER_CSRF_SIGNING_SECRET); set those in your secret store, not in this file. What happens when they are missing differs, and neither case is a profile refusal:
- No CSRF signing secret: with CSRF on, the server refuses to boot (a
RuntimeError, not the profile'sConfigError). That check runs after the database is opened and the bootstrap account is written, so unlike a profile refusal it can leave those behind. - No bootstrap password: the server starts and logs a warning, but nobody can sign in.
- No role lists:
CALIBER_ADMIN_USERS,CALIBER_OPERATOR_USERSandCALIBER_APPROVER_USERSdefault to empty, and the bootstrap account is then a viewer that cannot create projects; the server logs an error. The example names an admin and an approver. Because self-approval is refused, an approver must be a different account from whoever starts a run.
The database must be migrated (caliber-migrate) before the first start.
Migrations that shipped in the alpha never change
An alpha database sits at the head of the migrations that caliber-v0.1.0a1 shipped; upgrading it means running the migrations after that head. That is only safe while the migrations up to that head are exactly the ones the alpha ran, so they are frozen (B16-Upgrade.1, #702). caliber/tests/fixtures/alpha_0_1_0a1_migration_checksums.json records the SHA-256 of every migration file in the tag, read from the tag's objects, together with the tag's commit, the alpha head and the alembic version table (caliber_alembic_version). The head is derived from those files (the one revision nothing revises), never written in by hand.
Two checks guard it, because each alone can be defeated:
caliber/tests/test_upgrade_from_alpha.py::test_shipped_migrations_unchangedcompares the working tree with the manifest. It needs no history, so it runs everywhere and never skips. It fails if a migration is edited (a line-ending change counts), renamed or removed, or if one is inserted into or branched off the shipped history. A change that edits a migration and its manifest entry passes it.test_the_manifest_matches_the_release_tag(andpython caliber/tests/migration_checksums.py generate --check) regenerates the manifest from the tag and compares, which fails that change. The backend-core CI job fetches the tag and setsCALIBER_REQUIRE_ALPHA_TAG=1, so there a missing tag is a failure, not a skip; elsewhere the test skips when neither the tag nor its commit is in the checkout..github/CODEOWNERSalso sends any change to the migrations directory or the manifest to the owner.
Migrations added after the alpha are fine as long as they descend from the alpha head, and they need no manifest update. Each failure names the file and the way out, for example:
0050_assistant_attachments.py: changed since caliber-v0.1.0a1 (sha256 6c27..., shipped 4306...). Restore it from the
shipped commit (`git show 3f3b562...:caliber/src/caliber/db/migrations/versions/0050_assistant_attachments.py > ...`,
from the repository root) and put the change in a new migration that revises the current head.
A changed or missing file is restored from the recorded commit (the command is in the message and does not depend on the tag name being present). A new migration that revises a shipped revision is re-parented onto the current head (alembic heads). python caliber/tests/migration_checksums.py verify runs the working-tree check from the command line. Regenerate the manifest (... migration_checksums.py generate, with the tag fetched) only if the fixture itself was wrong.
.gitattributes marks the migrations -text, so a Windows checkout with core.autocrlf=true cannot rewrite their line endings (the checksums are of exact bytes).
For the alpha-upgrade tests that follow (#708, #715): create the alpha database by running alembic upgrade <alpha head> through the working-tree migrations directory, with the manifest's version_table. That reproduces the alpha schema only because those files are frozen, which the never-skipping check enforces. Never read the migrations from the tag in CI; it is not in the checkout.
The seeded alpha database (B16-Upgrade.2, #708)
caliber/tests/alpha_seed.py builds a database an alpha operator could really have, for the upgrade test that follows (#715). It is an offline test fixture, not an operator bootstrap path.
- Schema.
alembic upgrade <alpha head>through the working-tree migrations (the head and the version table come from the manifest above). Before migrating, it re-verifies that the migration directory alembic reads is byte-identical to the manifest, so the schema built is the alpha's. Nothing is read from the tag. - Data. Raw
INSERTstatements from literals in the file, using the alpha table and column names, notcaliber.db.models. Every row lists every column, so no value comes from a database default or a clock: the same bytes on every run, on SQLite and on PostgreSQL 16. 35 tables, 140 rows: three users (one disabled), three projects (one archived) with their environments and members, a session and access tokens, workflows with published and draft versions and deployments, nine runs in every status (includingrunningandwaiting_approval), their events and checkpoints, runtime approvals, effect-ledger rowsin_progress(two, unresolved),completedandfailed, a workflow service and token, secrets as ciphertext with the tool that references one, a skill, an eval dataset and run, a prompt refinement loop (prompt text lives in MLflow, not in this database), audit rows and runtime tables. Every hash and ciphertext derives from a public constant; the users' login phrase isALPHA_SEED_PASSWORD.seed_sha256()fingerprints the data and is pinned in the test. - For #715.
alpha_database(dialect, tmp_path, name)yields a created and seeded database;migrate_database(url)upgrades it;read_seeded_rows(url)againstexpected_rows()(per table; a table the upgrade rewrites needs its own assertion),row_counts()andschema_shape(url)(compare with a fresh install) check the result.
It fails loudly instead of seeding the wrong database, with AlphaSeedError:
not a caliber-v0.1.0a1 database: it records <revision> in caliber_alembic_version, the alpha head is <alpha head>
caliber_projects already holds 3 row(s); seed an unseeded alpha database
the migrations alembic reads are not the ones caliber-v0.1.0a1 shipped, so the schema built from them would not be the alpha's
Recovery: use a new, empty database (the fixture creates it); a wrong revision means something migrated it past or short of the alpha head; the third message means a shipped migration changed, so restore it as described above.
PYTHONPATH=caliber/src caliber/.venv/bin/python -m pytest caliber/tests/test_upgrade_from_alpha.py
The postgresql cases run in the "Migration parity (PostgreSQL)" CI job (CALIBER_TEST_POSTGRES_URL, the pgvector/pgvector:pg16 image, because migration 0060 needs the vector extension).
The upgrade proof is test_alpha_database_upgrades_to_head in caliber/tests/test_upgrade_from_alpha.py. For each available dialect it migrates the seeded alpha database to the single current Alembic head, compares every seeded row and the complete reflected schema with a fresh head database, and verifies that historical workflow runs remain explicitly manifest_legacy with no invented runtime lineage. The two unresolved in_progress effect-ledger rows remain visible with no completion timestamp. The same test then uses the current workflow API to create and publish a new workflow and submit a governed run, proving that the upgraded database supports new admission without rewriting historical data. SQLite runs locally; PostgreSQL 16 runs when CALIBER_TEST_POSTGRES_URL is configured in the migration-parity job. A failed upgrade must be restored from a fresh database and investigated before retrying; the test does not attempt an automatic rollback of an operator database.
A stored secret never leaves the platform
caliber/tests/test_secret_canary.py (B12.5b, #666) stores EGI_CANARY_<uuid4> as egi-canary through the encrypted secret store, points llm_api_key_env at secret://egi-canary, and runs the core journey over HTTP with logging at DEBUG: sign in (the trusted proxy header), create a project, register an agent, publish, promote and run a workflow, run a calibration run to a candidate and apply it, read the LLM provider status (which resolves the secret inside the request; the test fails if nothing in the journey did), and export the audit log, plus refused requests. It fails if the value appears in any response (status, headers, cookies, body; the helper calls too), any log record (message, arguments, extra fields as the JSON formatter renders them, traceback), any caliber_workflow_run_events row or any audit row. The failure paths of resolution (a revoked secret, corrupted ciphertext, a provider built from a revoked secret) are scanned the same way, and a control test plants the value in every scanned surface to prove the scan can fail. It runs in the Backend core job and the full backend suite.
Not covered: the prompt registry routes and MLflow traces need a live MLflow registry, which ordinary CI does not have; the journey's prompts are the agent prompts in the workflow manifest, which the calibration run rewrites. Sign-in by session login is covered by test_auth_sessions, not by this journey.
Running it found that CALIBER_LOG_LEVEL=DEBUG with the default S3 log sink recursed: the S3 client's own DEBUG records re-entered the handler, so each record caused a growing number of S3 writes. The handler now ignores records emitted while it delivers a batch.
Run manifests are written once
Migration 0114 adds caliber_run_manifests (B02.1a, #656): one row per workflow run holding the canonical manifest bytes (manifest_bytes) and their SHA-256 (manifest_digest). The row is immutable:
- a database trigger refuses
UPDATEandDELETEon SQLite and PostgreSQL (PostgreSQL also refusesTRUNCATE), so a bulk SQL statement fails as well as an ORM one:caliber_run_manifests is immutable: UPDATE refused; - the ORM raises
ImmutableRecordErrorbefore any SQL for an instance update or delete and for an ORMupdate()/delete()statement (Session.bulk_*_mappingsand Core/raw SQL skip the ORM and are refused by the trigger instead); - a second manifest for the same run violates
uq_run_manifest_run, and a digest that is not the SHA-256 of the bytes is refused (by the ORM everywhere, and by a CHECK on PostgreSQL).
Runtime role. The migration revokes UPDATE, DELETE and TRUNCATE on the table from PUBLIC. That only protects a deployment that runs the application as a role other than the table's owner, and caliber-migrate, scripts/install.sh and the shipped compose files use one database URL for both, so by default the application is the owner and is held only by the triggers and the ORM guard. For the privilege layer, run caliber-migrate as the owner and the application as a role granted only what it needs:
GRANT SELECT, INSERT ON caliber_run_manifests TO caliber_runtime;
GRANT SELECT ON caliber_workflow_runs TO caliber_runtime; -- already held; the insert trigger reads it
-- no UPDATE, DELETE or TRUNCATE on caliber_run_manifests; avoid ALTER DEFAULT PRIVILEGES ... GRANT ALL
A trigger can be disabled by the table's owner or by a session with session_replication_role = replica; only the missing privilege holds against the runtime role. The reference profile does not check which role the application connects as (listed under "Not enforced yet"). The trigger functions are pinned to the migration's schema with pg_temp last in search_path, so a temporary table cannot shadow caliber_workflow_runs.
Legacy runs. caliber_workflow_runs.manifest_legacy is true by default, so every run that existed when 0114 ran, and every run created by a path other than admission, is legacy. Such a run has no manifest and can never get one (a manifest needs an existing, non-legacy run, also raised for a run that does not exist), and the flag cannot be changed afterwards (caliber_workflow_runs.manifest_legacy is write-once), so a historical pin cannot be fabricated. Admission (#680, below) creates a run with manifest_legacy = false in the same transaction as its manifest. A client with DELETE on runs can still delete a legacy run and re-insert the same id as a non-legacy one; that needs write access to runs and is not guarded here.
Retention and deletion. A run that has a manifest is retained evidence: retention pruning (CALIBER_WORKFLOW_RUN_RETENTION_DAYS) skips it, and DELETE /workflows/{id} answers 409 (cannot delete workflow: its runs have immutable run manifests) while any of its runs has one, because removing the run would either violate the manifest's foreign key (PostgreSQL) or orphan it (SQLite). Legacy and manifest-less runs are pruned and deleted as before. Rolling the schema back past 0113 drops the table and therefore the manifests, never the runs; upgrading again starts with no manifests and marks every existing run legacy.
Reading a run's manifest (B02.5, #695)
Two endpoints, two different manifests; neither changes the other.
| endpoint | what it returns |
|---|---|
GET /workflow-runs/{run_id}/manifest (unchanged) | the workflow manifest the run executed: workflow_run_id, workflow_id, workflow_version_id, manifest_mode, manifest_hash, manifest. Served for every run, legacy included. |
GET /workflow-runs/{run_id}/admission-manifest (new) | the run's immutable admission manifest: workflow_run_id, schema_version, legacy, manifest_id, run_manifest (the stored record verbatim: pins, subject, workload, purpose, scope, grant id, request digest) and manifest_digest (the SHA-256 of its canonical bytes, so a reader can check it). |
The new endpoint needs the same access as reading the run (a run you cannot see is 404, indistinguishable from a missing one) plus a role in the run's project (read): a caller who can see a run, for example through a public workflow, but has no role in its project also gets that same 404, never the project's name. A run with no project is gated by the workflow's visibility alone. A legacy run (admission was off, or a path that is not admitted) answers 200 with legacy: true and schema_version, manifest_id, run_manifest and manifest_digest all null: no history is fabricated. An admitted run whose stored manifest does not read back, is missing or is not in canonical form (so its digest could not be checked) is 409 (manifest_corrupt / manifest_missing). The SDK has client.workflows.runs.admission_manifest(run_id) (sync) and client.workflows.admission_manifest(run_id) (async), returning an AdmissionManifest (legacy is None, never "admitted", when the server did not say); the console API client has getWorkflowRunAdmissionManifest. run_manifest is the stored record verbatim, so it carries the subject's user id, the grant id, the request digest and, when a rule bundle is pinned, its absolute server path: treat the endpoint as project-member-visible evidence.
Building a manifest (admission, #676)
caliber/src/caliber/run_manifest.py turns resolved inputs into the manifest record and its canonical bytes. It is a pure function: no SQL, clock, randomness or provider call, so the same input always gives the same bytes and digest. It does not choose or persist the manifest (admission, #680 and #684, does); the caller stores BuiltManifest.row_values() with CaliberRunManifest.
pinned = pin_rule_bundle(path, expected_sha256) # only when rule bundles are enabled; reads the file once
built = build_run_manifest(
manifest_id=new_manifest_id(), workflow_run_id=run_id, pins=ResolvedPins(...),
subject=Subject(...), workload=Workload.for_workflow(name, digest), purpose="...",
scope=DeploymentScope.fixed(project_id), created_at=now_utc,
rule_bundle=pinned, rule_bundles_enabled=True,
)
- Resolved, never named. Every pin must be the concrete value the run will use, and resolving it is the caller's duty: the builder cannot see the database, so it rejects what it can recognise as a moving target. After Unicode (NFKC) folding, a segment that is a floating word (
latest,current,head,default,stable,main,master,nightly, ... as inv-latestorgpt-4o-latest), a wildcard version segment (1.x) or a range or wildcard character (*,^,>=,${...}) isunresolved_pin; a prompt, tool or skill pin is exactly<name>@<version>and only the version is checked;bundle_digestis a full lowercase SHA-256. Strings must be NFC, at most 512 characters (64 for the manifest and run ids), and lists at most 256 entries. Lists are sorted and may not repeat (duplicate_pin), so the order of resolution never changes the digest. A manifest is never filled in later. - Fixed scope.
DeploymentScopecarries organization (tenant_id), project, region and residency, all server-derived and enforced: the builder refuses (bad_scope) a scope whose organization, region or residency is not the deployment's (localin the reference profile, ADR 0001). A caller that names another organization isorganization_switch; a subject acting in another project than the run's scope isproject_mismatch. The manifest recordsproject_id(optional in the v1 schema, absent for a run outside any project). - Rule bundle. When rule bundles are enabled the bundle is loaded and verified first (
pin_rule_bundle, #726): a missing, oversized, changed or malformed file, or one whose context-manifest citation would exceed 256 KiB (see "The rule bundle at context use"), isrule_bundle_refusedand no manifest is built; a verified bundle's symlink-resolved absolute path and SHA-256 are recorded (make onePinnedRuleBundleper admission: it is a snapshot, not a handle on the file). Enabled without one isrule_bundle_required; one given while disabled isrule_bundle_unexpected. The digest in the manifest is the digest of the bytes that were verified, so editing the file afterwards changes nothing about this run (the context code re-verifies the bytes when it uses them, #736: see "The context manifest", "The rule bundle at context use"). - The request digest.
request_digest(optional, 64 lowercase hex) is the SHA-256 of the canonical admission intent (see "Admitting a run"). A malformed one isbad_pin. It is part of the sealed bytes, so it cannot change after admission. - The digest excludes itself.
manifest_digestis the SHA-256 of the canonical bytes (sorted keys, no whitespace, UTF-8, noNaN); the record carries no digest field. - Self-consistent result.
BuiltManifestre-reads its own bytes on construction (digest, schema, UTF-8, no duplicate key or lone surrogate), so bytes and digest cannot disagree;row_values()includescreated_at. - Strict writer, tolerant reader. The builder is stricter than the v1 schema (which takes any non-empty string), so records written before it still validate and
read_manifest(bytes, digest)still reads them.
| code | meaning | recovery |
|---|---|---|
unresolved_pin | a pin is empty, missing or a floating selector | resolve it to a version or digest, then retry |
bad_pin | a pin has the wrong type or shape (for example a digest that is not 64 lowercase hex) | fix the resolver |
duplicate_pin | the same reference twice (a knowledge base may be pinned at several versions, each once) | name each once |
bad_scope | a scope field is empty or not a clean identifier | fix the deployment configuration |
organization_switch | the caller asked for another organization | none: this deployment serves one organization |
project_mismatch | the subject's project is not the run's project | admit the run in the subject's project |
bad_field | manifest id, run id, purpose or timestamp is malformed (a naive datetime) | supply clean values and an aware time |
rule_bundle_refused | the configured bundle's bytes are missing, changed or invalid, or its context citation is over 256 KiB (262144 bytes) | restore the bundle or update the pinned digest deliberately; shorten source_ref values or split a bundle that is over the cap |
rule_bundle_required / rule_bundle_unexpected | enabled without a verified bundle / a bundle while disabled | align the configuration and the call |
invalid_manifest | stored bytes are not a valid manifest, or do not match their digest (read_manifest) | treat as corruption: the row is immutable evidence |
Admitting a run (B02.2a, #680)
With admission on (always under CALIBER_PROFILE=reference, otherwise CALIBER_ADMISSION_ENABLED=true), every run a user queues is admitted: the run, its grant, its policy decision and its immutable manifest are created in one transaction, or none of them are. The paths covered are the create-run route (POST /workflow-runs), a retry of a failed run (POST /workflow-runs/{id}/retry, a new run admitted afresh), the event trigger (POST /workflows/{id}/trigger) and the assistant's run_workflow tool. The first three authenticate and check resource.execute in the workflow's project before admission; the assistant path checks the workflow's visibility first and the caller's role when the grant is issued (inside the same transaction, with the same outcome). A synchronous real run (POST /workflow-versions/{id}/run) is never queued, so with admission on it is refused (409, sync_run_not_admitted): use the queue.
- Pins first. Before any row is written, everything the run depends on is taken from the version's sealed deployment bundle (prompts, tools, MCP tools, skills, knowledge-base versions, the models its agents name, the policy version, the bundle's own digest) and the configured rule bundle is loaded and verified (
CALIBER_RULE_BUNDLE_PATH/_SHA256). The manifest is built by the builder. A version that was never compiled, whose bundle fails its integrity check, or that has an unresolved runtime dependency, is refused (409,bundle_unavailable); so is a rule bundle that is missing or changed (manifest_refused: rule_bundle_refused). An unresolved evaluation dataset does not stop a run. The worker executes exactly what the pins describe: an admitted run's manifest snapshot is the bundle's sealed resolved manifest (prompts inline, tool versions exact, knowledge-base versions and child workflows resolved), not the authoring manifest, so moving a prompt alias after admission changes nothing about the run. (Skills are embedded in the bundle's snapshots; embedding and chat models of knowledge nodes are not part of the model pins yet.) - One transaction. The run is inserted with
manifest_legacy = false, then the grant is issued (never beyond the caller's current role), the decision is recorded under the policy (policy-v1: risk ceiling 4), and only on an allow the manifest is stored. A denial (403, with the decision's reason codes) or any later failure rolls the transaction back: no run, grant, decision, manifest or event remains, and no partial admitted run can be dispatched. - Retries. A request that reuses an idempotency key is authorized first, then returns the original run and manifest when it is the same request from the same caller (same workflow, release selector, explicit version selector, input, files, project, release/environment/model, priority and session) even if the alias has since moved, been deactivated or now points at a version that fails a preflight, or the workflow is paused (the key is looked up, after the caller is authorized, before the target is resolved); any difference, including another caller, is a
409(intent_conflict, one message for every difference, so it is not an oracle). "The same request" is the canonical intent: the workflow, the selectors as named (never what they resolved to), the input, the purpose and the server-derived scope. Its SHA-256 is stored in the immutable manifest asrequest_digestand the retry is compared with that, not with anything on the mutable run row (the intent itself is also kept in the run's summary for diagnosis; a run admitted before the digest existed is compared on its stored intent when that is complete, and is a409when it is not; a legacy run is compared on the fields its own row keeps). An input that is not text is compared as canonical JSON, so the key order of an object does not matter and a string that prints like the object is a different request. A trigger names its alias only if the caller did: the intent records what was asked, not the alias the trigger picked. An admitted run whose manifest is missing or cannot be read fails the retry closed (500,manifest_refused). The key's scope is (workflow, source, key), so the same key from another source or in another project's workflow is a different request. A key that names a run created while admission was off returns that legacy run (it has no manifest). Two requests racing on one key admit exactly one run, and the loser gets the same answer a later retry would (PostgreSQL scenario). - Lineage (B02.4, #691). Under
CALIBER_PROFILE=referenceevery run started through the create-run route, the event trigger, the cron scheduler or a service token names the workspace release and environment it runs against (workspace_release_idandenvironment_id, together; optionallymodel_idandconfig_sha256): a run without them is422with{"error": "lineage_required"}before anything is read or written (run_launch.require_lineage,LineageRequiredError), and the run is created with its immutable runtime lineage. A lineage that is not valid for the project (unknown or foreign release or environment, a config digest that is not the release's, a release that is not eligible) is409; a malformed one (empty ids, a digest that is not 64 lowercase hex) is400. A retry keeps the lineage of the run it retries (a fresh lineage record for the new run, refused with409if the release is no longer eligible) and a run that never had one cannot be retried in the reference profile (422). Development leaves lineage optional. Not covered, tracked: the assistant's run tool (a chat has no release to name) is refused with the same code. In the reference profile (GET /capabilitiesreportsworkflow_runs.lineage_required: true; development reportsfalseand the console then offers no picker and sends no lineage, #1068) the console's Run and Trigger actions load the project's active environments and approved workspace releases, offer only exact current-release/environment pairs, and submit both IDs. If no eligible pair is available, the controls show the samelineage_requiredrefusal and do not issue a run or trigger request; the server still revalidates project scope, approval and freshness (#968). - Who and what. A user-started run has the authenticated caller (
session,patortrusted_header) as its subject. A scheduler or service-token run has a server-createdservice_principalsubject instead:principal_idisservice_principal:cron:<workflow_id>for the scheduler orservice_token:<token_id>for the service route. The principal is fixed to the local tenant, workflow project, pinned workload, purpose and allowed action/resource set; it carries no ambient user scopes and is not admitted through human project membership. The workload is the workflow pinned to its version digest, the purpose isworkflow_run:<path>with the route's own word (api,event,retry,assistant,cronorservice), never the client-chosensourcefield, and the scope is the fixed deployment (localorganization, region and residency) plus the workflow's project. The caller must be acting in the workflow's project, and a credential bound to another project is refused (403). A workflow outside any project cannot be admitted (409,project_required); a manifest override on a manual run cannot be pinned, so it is not admitted (409,manifest_override_not_admitted).
| response | code | meaning and recovery |
|---|---|---|
422 | lineage_required | the reference profile starts no run without runtime lineage: name a workspace_release_id and an environment_id together (the body is {"error": "lineage_required", ...}); nothing was stored |
409 | project_required | the workflow has no project; move it into one |
409 | bundle_unavailable | compile and publish the version again (its sealed bundle is missing, altered or unresolved) |
409 | manifest_refused | a pin is floating or ambiguous, the rule bundle is missing or changed, or the project belongs to another organization; the message says which |
409 | intent_conflict | the idempotency key belongs to a different request; use a new key |
403 | source_not_approved | reference profile: a knowledge-base version the run can read (directly, through a child workflow, or on a query node) is not an approved context source of the project, or a query takes its versions from an input; approve the named versions, use the project's own knowledge bases, or name the versions on the node, then run again |
409 | manifest_override_not_admitted | save the manifest as a version, publish it and run that |
409 | sync_run_not_admitted | submit the run to the queued /workflow-runs endpoint |
403 | policy_denied / grant_refused | the policy or the caller's role does not allow it; the reason codes are in the message |
403 | service_principal_required / service_principal_unconfigured | reference admission requires a configured server-owned scheduler or authenticated service-token principal; no run, grant, decision or manifest is stored |
403 | service_principal_revoked / service_principal_expired / service_principal_*_mismatch | the server principal is revoked, expired or does not match the fixed tenant, project, workflow, workload, purpose, action or resource binding; correct the server-side configuration and retry |
503 | authority_unavailable | the grant or decision store could not answer; nothing was stored, retry |
Scheduler and service-token admission (B02.6/B02.7, #958/#967). In the reference profile, the scheduler and service route create a typed server principal and use the same admission transaction as user-started runs. The scheduler binds the principal to the active deployment's project and sealed workflow-version workload. The service route first validates the bearer token's workflow, scope, expiry and revocation, then binds the principal to that token, the workflow's project and the sealed workload. Both paths derive runtime lineage from the deployment's persisted environment class and require exactly one active Workspace environment of that class with a current release. They do not fall back to prod or to an unrelated sole active environment; a missing, invalid, or ambiguous mapping is refused before any run, grant, decision or manifest row is stored. The admission transaction then rechecks that the mapped release is approved and still current, so a revoked or stale mapping returns 409 and stores nothing. A public service with no authenticated token is refused in the reference profile. When CALIBER_ADMISSION_ENABLED=false, development scheduler and service paths remain supported as legacy runs and their summaries explicitly carry admission_mode: legacy and legacy_reason: service_principal_admission_disabled. Preview and index rows are not executable runs.
Executing an admitted run (B02.2b, #683). The worker reads the run's manifest back (workflows/run_pins.py::load_run_manifest: digest, schema and run id checked) and executes only what it pinned. It builds the plan from the version's sealed bundle (its resolved manifest and embedded skill snapshots), so a moved deployment alias, a prompt alias pointing at new text, a skill with new content or a different active knowledge-base version changes nothing about a run that was admitted before it (scenario V10). What the bundle only names is verified against the registry before anything is built, and a mismatch fails the run closed with a named code instead of running on something else: each registered tool's definition (module, callable, backend, side-effect level, approval flag, named secrets), each MCP tool's discovered schema and policy, each child workflow (a published version whose own sealed bundle is the pinned digest, checked down the whole tree), the provider and the default model an inherit agent gets.
| error code | meaning and recovery |
|---|---|
manifest_missing | an admitted run has no manifest (never produced by admission, which stores both or neither): the run is not dispatched |
manifest_corrupt | the stored manifest does not read back or names another run: treat as corruption of immutable evidence |
pins_mismatch | the run's version, or the manifest it would execute, is not the pinned one |
pins_changed | the version, a tool, an MCP tool or a child workflow is not what was pinned (recompiled, edited in place, removed, archived or unpublished): submit a new run |
model_route_changed | the deployment's provider, or the default model an inherit agent would get, is not one the run was pinned to: restore it or submit a new run |
authority_denied | the run's grant, subject or workload no longer authorizes it (see "Who a run acts as"): the summary names the policy's reason codes. grant_revoked / not_a_member: submit a new run as someone who may; grant_expired: the run outlived its grant (below), submit a new run or raise CALIBER_ADMISSION_GRANT_TTL_SECONDS |
authority_unavailable | the authority store could not answer: the run is failed, not dispatched (nothing is assumed allowed; a failing statement's aborted transaction is rolled back first); resubmit once it is back |
grant_unbound / identity_invalid | the manifest names no grant (a run admitted by a build before B03.4, queued or parked across an upgrade, fails here: resubmit it), or its principals do not read back (corruption of immutable evidence) |
Who a run acts as (B03.4, #684). After the pins check and before anything is built, the worker calls workflows/run_identity.py::identity_for_run. It takes the exact grant id the manifest names (grant_id, sealed at admission; there is no "newest grant" lookup and no ambient grant) and the subject and workload the manifest recorded, and asks the policy (decide) whether that subject, running that workload, may still resource.execute the workflow for the manifest's purpose now. It gates dispatch; it does not change which principal the run's tools act as (the MCP preflight still runs as the workflow owner). The grant must be the run's, the subject's and the workload's; not revoked or expired; the subject must still be a member of the project (or its owner) in a role that permits the action; and the policy's own checks (version, purpose, risk) must allow it. The decision is recorded, allow or deny, so a run's history shows every time it was cleared to run; nothing in the manifest, the grant or the earlier decisions is changed, and a denial revokes nothing. A resumed run is dispatched by the same worker, so a resume is checked exactly like a first run: a grant revoked or a member removed while a run waited for approval means the run fails at resume with authority_denied, having executed nothing more. A grant has a lifetime (CALIBER_ADMISSION_GRANT_TTL_SECONDS, default 24 hours from admission) and nothing renews it: a run that waits longer than that, for an approval, an event, a timer or a long queue, fails at its next dispatch with grant_expired. Size the TTL to the longest wait a workflow may have. The check's row locks (grant, membership, project) are released by a commit right after the decision, so they are not held while the plan is built. A legacy run has no identity and keeps its legacy behaviour; no grant is manufactured for it. A manifest written before it named a grant (admitted by a development build) is refused (grant_unbound) rather than guessed at.
Admission refuses a version whose child workflow has no sealed bundle to pin (409 bundle_unavailable: publish the child, then compile the parent again).
Still live at run time, said plainly: the deployment's other model settings (reasoning effort, base URL, API choice, parallel tool calls, prompt cache), MCP server addresses and credentials, the values behind named secrets, the embedding and chat models of knowledge nodes, and the contents of files and datasets that the bundle identifies by digest or version rather than embeds. A recompile of a version after a run is admitted fails that run (even one parked waiting for approval), by design.
Not done by the worker yet: checking the run's authority at each effect inside a run (it is checked once per dispatch, including resume) and fencing each transition with the execution lease.
Run principals: subject and workload
A run acts as two distinct principals, defined as immutable values in caliber/src/caliber/policy/principal.py (B03.1, #657). The subject is who started it: user_id, auth_method (session, pat or trusted_header) and, as server-side context only, the project. The workload is what runs: a name and one workflow-version digest. The workload id is wl_ plus the full 64-hex SHA-256 digest; it is derived, never chosen, and a manifest that carries any other id is refused. Only user_id and auth_method are written for the subject: a project_id in a manifest subject is refused. The types are pure; persisting them (#680) and resolving them for a run (#684) come later, so this page lists no setting for them.
The types are stricter than the manifest schema, which accepts any non-empty string: a workload digest must be a full bare SHA-256, and an id, name or grant id may not contain control, format or line-separator characters. A user_id that caliber.auth would treat as anonymous (anonymous, any case, or one containing a comma) is refused, and so is any scope caliber.auth does not define. A pat subject becomes an identity only with its credential_id (and the token's credential_project_id when it is bound), so a project binding is never dropped.
Refusals raise PrincipalError; the recovery for each:
| refusal | recovery |
|---|---|
workload_id must be the one derived from the full workflow_version_digest | build it with Workload.for_workflow(name, digest); never copy an id from elsewhere |
workflow_version_digest must be a full lowercase 64-hex SHA-256 digest | pass the workflow version's whole bare digest, not a prefix, uppercase or sha256: form; a version with no digest (a legacy version) cannot be a workload |
subject must have exactly ['auth_method', 'user_id']; extra ['project_id'], missing [] | drop project_id from the manifest subject and pass it as Subject.from_manifest(data, project_id=...) |
a pat subject needs its credential_id to become an identity | pass credential_id (and credential_project_id when the token is bound) to to_identity |
Run grants
A run acts under a grant (B03.2, #664; caliber/src/caliber/policy/grants.py, migration 0115, table caliber_run_grants). It is bound to an exact run and an exact grant id, to the run's subject and workload (run principals), to a project, to explicit sets of allowed actions and resources, to the policy version it was issued under and to an expiry. Issuing one is part of admission (#680). This page lists what the store and the check guarantee:
- Exact identifiers, no fallback. Every check names the run id and the grant id. There is no "newest grant" and no ambient one; a different run, an unknown grant and a mismatch are all
grant_not_found, so ids cannot be probed. - Closed vocabulary, explicit sets. Actions are the names in
caliber.resource_access.PROJECT_ACTIONS(an unknown action cannot be granted;release.break_glass_applyis deliberately not in it). Actions and resources match exactly: no wildcard, prefix, case folding or ordering by name or risk. - A grant never exceeds the subject's role. Issuing refuses an action the subject's current role is not in the set for (
PROJECT_ACTIONS[action]), and every use rechecks the current role (role_not_allowed), so a demotion narrows a standing grant at once. The project owner counts asowneronly when the caller supplies live scopes that still include the owner-role scopes; without themowneris treated aseditor. - Rechecked every time, in this order:
grant_revoked,grant_expired(the expiry instant itself is expired),not_a_member(the subject's current active membership, or ownership, of the grant's project),action_not_allowed(not in the grant),role_not_allowed,resource_not_allowed. A database failure while reading any of it isauthority_unavailable: a denial, never an allow. Datetimes must be timezone-aware (UTC is stored). - Revocation and membership changes cannot be raced (PostgreSQL). A check takes a row lock on the grant and a shared lock on the membership and project rows it relied on, in the caller's transaction; a revocation, a member's removal and a demotion each wait for a check in flight, and a check that starts after one sees it. Under REPEATABLE READ or SERIALIZABLE a change committed after the transaction's snapshot is
authority_unavailable. Run the transition a check guards in the same transaction as the check. SQLite gives no such guarantee (the driver does not even begin a transaction before the first write); it is development only and the reference profile refuses it. SQLite'sINSERT OR REPLACEalso bypasses the triggers below (a development-only gap). - Immutable but for a whole revocation, in the database. Triggers refuse changing any column but the three revocation fields (
caliber_run_grants is immutable except for revocation), refuse any change once revoked (a revoked grant stays revoked) and refuseDELETE(TRUNCATEtoo on PostgreSQL). A CHECK makes a revocation whole:revoked_at,revoked_byandrevoke_reasonare all null or all set. The ORM refuses the same (ImmutableRecordError), including editing a committed revocation. As with run manifests, run the application as a role withoutDELETEorTRUNCATEon the table; the profile does not check which role it uses.
Refusals and what to do:
| code | meaning | recovery |
|---|---|---|
grant_not_found | no grant with that exact run id and grant id | use the ids admission returned for this run; never look one up by recency |
grant_revoked | the grant was revoked | request a new run or a new grant through admission |
grant_expired | expires_at has passed | the run must be re-admitted; a grant is never extended |
not_a_member | the subject is no longer an active member (or owner) of the project | restore the membership, or stop the run |
action_not_allowed | the action is not in this grant | request a grant that names it (it must be in the vocabulary) |
role_not_allowed | the subject's current role is not allowed to perform the action | change the role deliberately, or use a different action |
resource_not_allowed | the resource is not in this grant | request a grant that names the exact resource |
authority_unavailable | the store could not answer | retry after the database recovers; nothing was authorized |
Issuing refuses (GrantError): an empty or oversized set, an action outside the vocabulary or beyond the subject's role, a subject who is not a current member, a run that does not exist or belongs to another project, a naive datetime, and an expiry that is not in the future.
This task stores and checks grants; it makes no policy decision and records none (B03.3 and B03.5). Rolling the schema back past 0114 drops the table and therefore the grants, never the runs.
Experiment ownership
In the reference profile CALIBER, not the first editor, decides who owns an MLflow experiment (caliber/src/caliber/observability/experiment_registry.py; B11.registry, #665; migration 0118, table caliber_experiment_owners, keyed by the tracking backend and the canonical experiment id). Registering an agent, creating or updating a workflow, or publishing from the assistant with an experiment reference:
- creates the experiment server-side, tagged with its owner, when it does not exist (
provenance=created); - refuses an experiment that already exists but nobody registered (
409), unless an administrator is registering it, who may adopt it (provenance=adopted); and refuses a numeric id that names no experiment; - refuses an experiment another project or user owns (
409), whichever alias (name or id) is used, even when two requests race (the primary key admits one row); - fails closed (
503) when the tracking backend cannot answer, and registers nothing.
The authorization check (project write access) runs before the claim, so a request that is refused creates nothing. The registry row shares the request's database transaction (a rollback leaves no owner), but the MLflow experiment does not: if a request fails after CALIBER created the experiment, the experiment stays, carrying the tags CALIBER wrote (caliber.owner_kind, caliber.owner_id, caliber.created_by). The scope those tags name may register it on retry; nobody else may (an experiment without those tags is an existing one, refused as above). MLflow's own API is not scoped, so anyone who can reach it can still create or tag experiments directly.
For data from before the registry, an administrator runs POST /observability/experiment-claims/migrate once: an experiment claimed by exactly one scope becomes that scope's, one claimed by two or more is quarantined, and the report lists registered, quarantined, skipped_existing, mismatched (already registered, but a legacy claim names another scope too) and unresolved. It is safe to run again, and to run twice at once. Each quarantine is settled with POST /observability/experiment-claim-conflicts/resolve (the owner is a project that exists, a user, or public with no id; one administrator wins a race, the other gets 404). A resolved experiment is visible to its owner (under any alias it wrote, and without any text claim) and hidden from the losing scope even though that scope's old agent or workflow claim still names it; it no longer appears in the conflicts listing. The SDK has migrate_experiment_claims() and resolve_experiment_conflict(). Details of aliases, quarantine and visibility are in the observability architecture. Development keeps the earlier behaviour: an unregistered experiment goes to whoever binds it first, and a name that resolves to nothing stays a plain reference.
Known limits: the registry's key includes the tracking backend's URI (credentials and query dropped, scheme and host lower-cased, trailing slash removed), so repointing CALIBER at another server starts a new registry and a default per-directory file: store differs by working directory; use a tracking server. Fleet, prompt-target and skill-target agents that CALIBER names itself are not registered until an administrator runs the migration. There is no release or transfer path: deleting the agent or workflow does not free the experiment (an administrator cannot reassign an active owner yet).
Who may read a trace's payload (B11.4a, #672)
Seeing that a trace exists (it is listed, counted, its metadata shown) follows the experiment's visibility. Reading what is in it (span inputs, outputs and tool arguments, which can hold personal data) is a separate, stricter permission, trace.payload.read, held by the project roles owner and editor; a reviewer or viewer is refused. caliber.observability.trace_access.can_read_payloads(session, identity, experiment) decides it:
- the reference must name an existing experiment; its owner is the registry's active row (a quarantined row means no owner) or, for an experiment the registry has no row for (development, or before the legacy migration), the single scope all agent and workflow claims name (none, or two scopes, means no owner);
- a project owner: the caller must be acting in that project (the active project and any project-bound credential are that project) and their current membership role must allow the action (
decide_project_access(..., "trace.payload.read")); demotion, removal or deactivation take effect on the next call, andcaliber.adminis not an implicit project role, so an administrator who is not a member is refused. An archived project keeps its members' access, as every other read path does; - a user owner: only that user. Public experiments have no payload readers (intentional: their payloads are the least accountable). No owner, a missing project, an empty or non-string reference, an unreachable tracking backend or database are all refused: the function returns
Falseand never guesses; - platform scopes (
caliber.viewerand so on) are not checked here; the calling route must still require them.
What a caller without it gets (B11.4b, #677). In the reference profile the trace routes decide this per experiment (once per request) before any payload goes into a response. GET /observability/traces/{id} for a caller who may see the trace but not read its payload returns the same shape with every governed field replaced by [redacted:<field>]: each span's inputs and outputs and its attributes.tool_arguments, attributes.retrieved_documents and attributes.model_output (the list is profile.GOVERNED_TRACE_FIELDS), plus the whole-trace request and response. Real tracers also put the same payload in other attributes (mlflow.spanInputs, mlflow.spanOutputs, mlflow.chat.messages, caliber.tool.input, caliber.tool.output), so redaction is fail-closed: every span attribute that is not on the short list of known payload-free ones (profile.SAFE_SPAN_ATTRIBUTES: run, node, job, proposal, decision, approval and effect ids, refusal code, status, model name, token and cost counts, tool name and latency, span type) is redacted as [redacted:attributes.<key>]. Keys are never deleted or added, and everything else (span ids, names, times, status, attributes.caliber.run_id, tokens, cost) is identical to what an editor sees. GET /observability/traces redacts request_preview and response_preview the same way, and GET /observability/metrics is computed from the redacted summaries (the numbers are unchanged; no payload appears). The run trace (GET /workflow-runs/{id}/trace) and the assistant's get_workflow_run_trace tool apply the same rule, decided by the run's project (owner or editor reads; a run outside any project belongs to the user who started it). A trace the caller may not see at all is still a 404, never a redacted 200. Outside the reference profile nothing is redacted, as before.
The same boundary is enforced at span creation for governed OpenAI Chat and Responses tool calls. Their shared helper emits only the payload-free SAFE_SPAN_ATTRIBUTES and deliberately omits caliber.tool.input, caliber.tool.output, provider tool arguments and provider tool results. An unauthorized trace reader therefore receives safe metadata rather than a payload that was emitted and later redacted. The adapter conformance suite captures both governed paths with a fake tracer and plants a secret in the argument and result to verify that it does not cross the boundary. The ungoverned development path retains its existing tool-span attributes.
Recovery: a viewer or reviewer who needs the contents asks a project owner or editor to read them, or is made an editor (PATCH /projects/{id}/members/{user_id}); an administrator who needs them must be a member of the project (admin is not an implicit project role). Not governed, said plainly: the review-queue item view and "create example from trace" in evaluation datasets also surface trace payloads and still follow experiment visibility only (tracked in #960); a trace's tags and feedback assessments (free text that can quote a payload) are returned as before; the permission is decided after the trace has been fetched into the server's memory (it is never returned), because the experiment is only known from the trace; and MLflow's own API is unscoped (see above).
The execution-owner lease
In the reference profile exactly one process holds the execution-owner lease and only the holder runs the background loops (ADR 0002). B13.2 (#668; caliber/src/caliber/ownership.py, migration 0116, table caliber_execution_owner) is the lease and its fencing token; the lifespan wiring that makes the loops obey it is B13.3 (#673, below). What the lease guarantees:
- Database time. Expiry is decided by the database's clock (
clock_timestamp(), so a long transaction does not see a lapsed lease as live) inside the statement that tests it; a process's own clock never extends a lease. - One owner.
acquirereturns the lease orNone. It is a new acquisition only: when the lease has expired (or never existed) the token grows by exactly one (the first is 1); while a lease is held and unexpired the answer isNonefor everyone, including the holder's ownowner_id, so a restart that reuses a stable id cannot adopt a paused predecessor's token. The holder extends its lease withrenew(lease), which keeps the token. - Exact fencing.
renew,releaseandassert_fencedcompare the owner id and the captured token for equality, and an unexpired lease; there is no "token is older than the latest" test and no fresh read of a current token. A stale or future token, another owner's, or another lease name's, is refused (LeaseLost). - Fenced transitions.
assert_fencedruns in the caller's transaction before an owner-only transition and, on PostgreSQL, holds a row lock until that transaction ends, so a takeover waits for the transition rather than overtaking it (the check happens under a valid lease and the transition is serialized before any takeover; the commit itself may land after the database-time expiry). SQLite gives no such guarantee; it is development only. - Isolation. Written for READ COMMITTED (PostgreSQL's default): a contended
acquireblocks and then returnsNone. Under REPEATABLE READ or SERIALIZABLE a contendedacquire, or a fence racing a heartbeat committed after the snapshot, raisesLeaseLost(fails closed). - Fails closed. An unavailable lease store is
LeaseLost(every database error is reported that way, programming errors included: log its__cause__), not a lease. A heartbeat that arrives after expiry extends nothing and never resurrects the lease; the process must acquire again and gets a new token. - Bounds (
LeaseError).ttl_secondsfrom 1 to 3600;owner_idat most 128 characters; the lease name at most 64.
Guidance for the loop wiring: renew every ttl / 3 at most; keep fenced transactions much shorter than ttl minus the renewal interval (a fenced transaction blocks the owner's own renewal and every other fenced transition); give fenced and acquiring transactions a SET LOCAL lock_timeout, since a stuck session holding the row would block failover (idle_in_transaction_session_timeout bounds it too).
Rolling the schema back past 0116 drops the table; the next acquirer starts at token 1.
Who runs the loops (B13.3, #673)
In the reference profile the loops start only while this process holds the lease and stop when it is lost (caliber/src/caliber/execution_role.py, wired in server.py::_build_lifespan):
- Owner or secondary. At startup a process makes one attempt to acquire, so its role is known before the first request, then ticks every
CALIBER_EXECUTION_LEASE_SECONDS / 3(default lease 30 s, minimum 3 s). The holder renews the exact lease it captured; a process that does not hold it keeps trying to acquire./readinesscarriesexecution_role:ownerwhile this process runs the loops,secondarywhile it only serves requests (the event bus and every HTTP route run in both; no loop, webhook dispatcher, scheduler or worker runs in a secondary). - Losing the lease fails closed. The owner keeps a local deadline of two thirds of the lease after the start of its last successful renewal. A renewal that fails, finds the lease gone or does not answer by that deadline (a slow or hung database included) stops the loops, and the role reads
secondaryfrom the moment the stop begins; the process tries to acquire again on later ticks and a fresh acquisition has a higher token. The lease calls run on their own thread, never the loops' threads, and on PostgreSQL carry alock_timeoutandstatement_timeoutof a third of the lease. If the loops fail to start after an acquisition, the ones that did start are stopped, the lease is released and the process stayssecondary(the error is logged and the next tick tries again). - Takeover. When the owner dies its lease lapses by database time and a secondary becomes the owner within one lease plus one tick plus the time to start the loops (the V14 scenario asserts 2 x the lease, SIGKILL included). A clean shutdown stops the loops while it keeps renewing the lease, then releases it, so the successor starts only after the loops have stopped and does not wait for expiry.
- Heartbeats.
caliber_worker_heartbeatstherefore lists owner-only workers from one process only (the holder's). - Outside the reference profile there is no lease: the loops start as before when background tasks are enabled (role
owner), and a process with background tasks disabled reportssecondary. - Not yet fenced per transition. The loops still claim rows themselves, and they stop concurrently (the webhook dispatcher first). A loop mid-transition when the lease is lost finishes that transition, bounded by
CALIBER_SHUTDOWN_GRACE_SECONDS, so an old owner's last transition can overlap a new owner's first one by up to that grace after a lease loss. Fencing each transition withassert_fencedis #684. - Events raised on a secondary. HTTP routes on a secondary publish webhooks and alerts (
job.applied,agent.rolled_back, SLO incidents) to the in-process event bus, and no dispatcher runs there: with the defaultCALIBER_WORKFLOW_RUN_EVENT_BACKEND=in_processthose events are not delivered by any process. Use a shared backend (database,natsorredis) so the owner's dispatcher sees them. The outbox below makes run events durable independent of the backend; it does not yet carry webhooks and alerts. Live run streams for a run that executes on the owner reach only the owner's subscribers on the in-process backend.
Events: the outbox
A business transition and the event that announces it commit together or not at all (B13.4, #685; caliber/src/caliber/events/outbox.py). Publishing to a queue after the commit loses the event when the process dies between the two; publishing before it announces something that never happened. So there is no queue in the transaction: append_run_event writes the run event and a caliber_event_outbox row inside one savepoint, and a background publisher delivers the rows afterwards.
- On in the reference profile, or anywhere with
CALIBER_EVENT_OUTBOX_ENABLED=true. Off, nothing changes. - The row is the event.
event_idisrun-event:<run id>:<sequence>, so recording it twice is the same row; the same id with different content is refused (OutboxConflict). The row holds an ADR 0003event_envelope(the payload is referenced bydatarefanddatahash, never inlined) and the payload itself. - Delivery is at least once.
OutboxPublisher(an owner-only loop; it appears in the worker inventory) claims due rows one by one with a conditional update (exclusive on SQLite too;FOR UPDATE SKIP LOCKEDon PostgreSQL) and a lease, hands each to every registered consumer (one that is down does not keep the others from the event), and marks the rowdelivered. A consumer that fails is retried with exponential backoff (CALIBER_EVENT_OUTBOX_MAX_ATTEMPTS, default 20); a row that exhausts its attempts isdeadand kept for an operator. The attempt is counted when the row is claimed, so an event whose handoff kills the process or hangs still runs out of attempts. A publisher that dies holding a claim is covered by the lease: the row is due again when it expires, and a second publisher redelivers it; a publisher that outlives its lease can no longer settle the row. Lease times come from the publishers' clocks (one publisher runs at a time, the execution owner). - Stopping. Losing the lease or shutting down finishes the handoff in flight (bounded by
CALIBER_SHUTDOWN_GRACE_SECONDS), releases the rest of the batch without counting an attempt, and claims nothing more. - No payload in errors.
last_errorand the log carry the consumer's name and the exception class, never its message (a database error's text can include the statement's parameters, which are the payload). - Consumers deduplicate.
SqlInboxConsumeracknowledges by committing a row incaliber_event_inboxwhose key is(consumer, event_id), so a redelivery after a crash is ignored;claim_unprocessed(a plain read: no lock, no lease) andmark_processed(idempotent) let a single consumer track its own work. - A full notification queue loses nothing. The in-process bus and SSE stay notifications: a slow subscriber's bounded queue drops its copy. The outbox row was committed with the transition and is delivered regardless.
- Retention. Delivered rows are pruned after
CALIBER_EVENT_OUTBOX_RETENTION_DAYS(default 7); dead rows are kept, and so are inbox rows (a consumer's own retention). Deleting a workflow deletes its runs' outbox and inbox rows with them. - What it does not do yet. The default registers no consumer, so rows are delivered at once and pruned; it publishes nothing to the bus or to webhooks (that would duplicate the notifications that exist). Webhook and alert events are not in the outbox. Consumers arrive with the features that need them.
Inbound events: the inbox
An inbound event (a webhook, a connector callback) can be sent twice, arrive on two workers at once, or reach a process that dies half way through. caliber/src/caliber/events/inbox.py (B13.5a, #689) makes each one apply once. This is the inbox for events from outside; caliber_event_inbox above is the end of our own outbox handoff and is unchanged.
- Identity is
(consumer, source, event_id), the primary key ofcaliber_inbox_events. The row also stores thepayload_hash(sha256:<hex>, fromcaliber.events.outbox.payload_hash) the event arrived with and astatus:received,processedorignored. - One transaction.
process_once(session, consumer=..., source=..., event_id=..., payload_hash=..., apply=...)inserts the reservation, runsapply(the business transition, in your session), and marks the rowprocessed, inside savepoints of your transaction. It never commits: you commit, so the three stand or fall together. Handing the event to a durable queue instead is the same call with anapplythat callscaliber.events.outbox.enqueue; the sender may be answered once that commit returns. - Results.
processed(withapply's value),duplicate(the same identity and payload were already taken: acknowledge it, nothing is applied) orignored(applyraisedInboxIgnored: whatever it wrote is undone and the row is recorded, so a redelivery is a duplicate). - Refusals. The same identity with a different payload raises
InboxPayloadMismatch(a different message reusing an id; the stored hash is never overwritten and nothing is applied). A blank, over-long or control-character-bearingconsumer(64),source(64) orevent_id(160), or apayload_hashthat is notsha256:plus 64 lowercase hex digits, raisesValueErrorbefore the database is touched. - Recovery. If
applyraises, the reservation goes with it, so the sender's retry is processed: a failed transaction is never treated as already processed. If the process dies before the commit, the database discards the transaction and the outcome is the same. Concurrent duplicates serialise on the primary key: on PostgreSQL the second waits for the first (with no timeout of its own: a first delivery that hangs holds the key, so give the transaction alock_timeout), then reportsduplicateif it committed or takes over if it rolled back. On SQLite a concurrent duplicate fails at once with a lock error and the retry is aduplicate.
from caliber.events.inbox import process_once
from caliber.events.outbox import payload_hash
with session_factory() as session:
result = process_once(
session,
consumer="documents",
source="connector",
event_id=delivery_id,
payload_hash=payload_hash(body),
apply=lambda: advance_run(session, body),
)
session.commit()
# result.outcome is "processed", "duplicate" or "ignored"; InboxPayloadMismatch means answer 409
- Limits. This is at-most-once application per key, not exactly-once delivery: the sender may still send it many times, and each is acknowledged.
applymust not commit or roll back the session (if it does,InboxContractErroris raised; its writes may already be committed with a reservation stillreceived, which every later delivery sees as aduplicateand an operator must resolve), and a side effect outside the transaction (a call to another service) is not covered by it. Rows are kept untilprune(session, older_than=...)forgets them; use a cutoff older than the sender's longest redelivery window, because a forgotten id is applied again.
Who consumes it (B13.5b, #693)
- The connector receipt callback is the consumer:
POST /ajax-api/2.0/mlflow/caliber/effects/callbacks/receiptcallsprocess_oncewith consumereffect-callback, a source that is a digest of the connector and the project, the delivery id as the event id, and the hash of{project_id, idempotency_key}. Its answers are the inbox's: the same signed delivery again is200 {"data": {"status": "duplicate"}}(answered before any query of the downstream), the same delivery id carrying another key is409 {"reason": "inbox_payload_mismatch"}, and a delivery whose transition is refused is rolled back whole (the reservation too), so the connector's retry is processed. The exact request, signature and every other answer are in the Receipt callback section below. - Out of order. The callback carries no version of its own: it names a key and the platform asks the downstream. The ordering is the proposal's compare-and-set
version(B05.2), so a delivery that arrives after the proposal has settled is acknowledged with the settled outcome and moves nothing:200 already_committed(a new delivery id), orcommittedwith the first receipt's id when it had read the proposal before the commit won (no second receipt, no second audit row).InboxIgnored/ theignoredstatus exist for a consumer whose events carry a version to compare; no consumer uses them yet, and the callback does not. - The GitHub webhook is not a consumer of this table. It already has a durable, signature-verified delivery inbox,
caliber_workspace_source_events(unique on source, delivery id and payload hash; migrations 0098 and 0101), inserted and committed in one transaction.POST /ajax-api/2.0/mlflow/caliber/webhooks/githubanswers a repeat delivery202 {"data": {"received": true, "duplicate": true}}with no second row, and the same delivery id with different evidence the same generic401as every other rejection (deliberately not a409, so an unauthenticated caller cannot tell it from a bad signature). Reserving each delivery incaliber_inbox_eventsas well would store it twice and change that public contract for no gain, so the route is unchanged; a test pins that it writes nothing tocaliber_inbox_events. - Recovery. A delivery answered
5xxor never answered (the process died before the commit) left no reservation: the sender's retry is processed. A connector that gets409 inbox_payload_mismatchis reusing a delivery id for a different message: send the new message under a new id. A reservation stuck atreceived(InboxContractError, see Limits) is the one case that needs an operator.
Effect proposals
A run that asks to change something outside CALIBER first records a proposal (B05.1, #700, ADR 0003; caliber/src/caliber/effects/records.py, table caliber_effect_proposals, migration 0123). B04.1 adds the two public services in caliber/src/caliber/effects/dispatcher.py: submit_proposal records the immutable intent without calling a connector, and dispatch is the sole supported boundary for an approved effect. Connector capability, receipt verification and reconciliation remain separate contracts below; no caller may bypass this boundary by invoking a public route recursively.
- Two separate things. The logical key
(deployment, run, node, occurrence_id)says which effect: a retry presents the same occurrence and finds the same proposal, a legitimate repeat (a loop that notifies the same endpoint twice) presents the next occurrence and gets its own. The intent says what exactly:Intent(connector, connector_version, effect_class, resource, args, expected_resource_version), stored as canonical JSON (intent_bytes) with its algorithm (intent-v1) and its digestintent_hash(sha256:plus 64 hex digits; on PostgreSQL a CHECK ties the digest to the bytes). Changing the connector version, the effect class or any other intent field changes the digest. - One digest, reused. Approvals and receipts compare against
Intent.digest(equivalently the storedintent_hash) and never compute a hash over fewer fields, so an approval of one intent cannot cover another. - Same key, same intent: idempotent. Same key, different intent: refused.
record_proposalreturns the existing proposal (created=False) for a retry and raisesProposalConflict(codeintent_conflict; the calling route answers 409) for a different intent; the stored intent stands and the error carries the key and both digests, never the arguments. A malformed field (blank, over-long or control-character-bearing text, non-JSON arguments, an unknown effect class, an intent over 256 KiB) raisesProposalErrorwith codebad_field; an unknown run,run_not_found; a constraint failure that is not the key,store_failed(without the driver's text, which would carry the arguments).argsmust be plain JSON of exact Python types (string-keyeddict,list,str,int, finitefloat,bool,None, nested at most 64 deep) so two different Python values never share a digest; the converse is not promised (intent-v1is not RFC 8785):1and1.0, or NFC and NFD spellings, are different intents, and a retry that respells one gets a conflict, never a silent match. - Immutable. Database triggers refuse a change to the intent columns and
DELETE, refuseDELETE(andTRUNCATEon PostgreSQL), and the ORM refuses every edit (it cannot move a proposal at all: onlytransitioncan). On SQLite (development) raw SQL can still bypass them withINSERT OR REPLACEor by deleting a run with foreign keys off, which also letsINSERT OR REPLACEreplace a settled proposal; PostgreSQL has no such path.statemoves only through the transition table below. A workflow whose runs have proposals cannot be deleted (409, "immutable effect proposals"), and retention never prunes such a run. - Reading is checked.
read_proposalrebuilds the ADR 0003proposalv1 record (with the optionaloccurrence_id,connector_versionandintent_algorithm) and recomputes the intent from the stored columns: an edited row iscorrupt, and an intent algorithm this build does not know isunsupported_algorithm, never read as the nearest.
from caliber.effects.records import Intent, ProposalConflict, record_proposal
intent = Intent(
connector="document-request",
connector_version="1",
effect_class="irreversible_write",
resource="cases/MORT-1/document-requests",
args={"document_type": "pay_statement"},
expected_resource_version="7",
)
with session_factory() as session:
try:
recorded = record_proposal(
session, workflow_run_id=run_id, node_id="ask", occurrence_id=occurrence_id, intent=intent
)
session.commit() # recorded.created is False when this effect was already recorded
except ProposalConflict as conflict:
session.rollback() # answer 409: conflict.stored_intent_hash is the one on record
- States and compare-and-set (B05.2, #705).
caliber.effects.records.transition(session, proposal_id, to_state, expected_version=...)moves a proposal alongTRANSITIONSand nowhere else:proposedtoapprovedorfailed;approvedtodispatchedorfailed;dispatchedtocommitted,failedorunknown;unknowntoreconciled;reconciledtocommittedorfailed;committedandfailedare final. Nothing is skipped (even a policy-approved read isapprovedbefore it isdispatched) and there is no way fromunknownback todispatched: recovery is a question to the downstream, never a second dispatch. The caller passes theversionit read (proposal_state), the UPDATE is conditioned on it, and a caller that read an old version getsStaleVersion(codestale_version) instead of overwriting a newer state; the same actor repeating a move that was already recorded getsapplied=Falseand no second write. Each move records its evidence:approvedneeds the B06.3ApprovalCommitreturned byapproval_valid_at_commit: it must be an exact-intent approval for this proposal and run, with current policy, evidence, authority and resource-version pins still valid. The dispatcher consumes that same request only after the validator succeeds; a legacy policy decision is not a write approval.dispatchedrecordsowner_id,attemptanddispatched_at; a move out ofdispatchedmust present the same owner and attempt or it isstale_ownerand records nothing;failed,unknownandreconciledrecord a shortreasoncode (never a payload) andunknown_at/settled_atare stamped. The database enforces the same table: a trigger refuses an illegal edge, a state change that does not advance the version by exactly one, a change to the evidence columns without a state change, and any change to acommittedorfailedrow (a test keeps the trigger's list identical toTRANSITIONS). Refusals:illegal_transition,stale_version,stale_owner,lease_lost,evidence_required,approval_refused,bad_field. A move into a state must also leave that state's evidence in the row (the trigger checks it, so raw SQL cannot skip it). Omitted evidence is never a wildcard: a caller that cannot present the owner, reason or approval a move needs is never told it "was already recorded". Under REPEATABLE READ or SERIALIZABLE PostgreSQL refuses an UPDATE of a row another transaction changed after the snapshot (a serialization failure): roll back and retry from a fresh read. A repeat is recognised only while the proposal is where the move left it; once it has moved on, the retry isstale_versionand the caller readscurrent_state.attemptis 1 to 2147483647 andreasonis the latest move's (the history belongs to the audit trail). - Submission and dispatch are separate.
submit_proposalapplies the protected-effect inventory before it records an intent. Refused inventory entries (including untrusted sandbox paths) are not proposed; unknown tools fail closed toirreversible_write. The action form and explicit intent fields must agree exactly; conflicting duplicates are refused (conflicting_intent_inputs).dispatchaccepts only the canonicalapproval_valid_at_commitvalidator; a caller-supplied substitute is refused (approval_validator_untrusted) and cannot bypass expiry, supersession, authority or revocation checks. It also binds every registered private backend to one connector name and version, refusing a proposal/backend mismatch (backend_intent_mismatch) before claiming anything. Missing validator (approval_validator_missing), missing captured execution lease (lease_missing), absent exact approval (proposal_not_approved), or an unregistered backend (unsupported_backend) are all fail-closed refusals without a downstream call. The claim transaction locks and rechecks the proposal and approval, consumes the approval, movesproposed -> approved -> dispatched, and enqueueseffect.proposal.dispatched; only after commit does it invoke the registered private backend. A backend is never the public OpenAPI route itself. - The approval route records; the dispatcher consumes (B06.4, #735).
POST .../workflow-runs/{run_id}/approval/approveand.../approval/rejectdecide a proposal-bound request when itsruntime_approval_idis named, whatever backend its proposal will use: the route reads only the request row. Order of work: the projectapproveaction (a caller who is refused never takes a lock), then the run lock, then the request lock (the order the dispatcher and the request writer use), then the caller's authority over this request (the node'srequired_rolescope, and for an approval not being the requester;403), and only then the stable state refusals below, so a project member who may not decide a request learns nothing of its state. The decision, audit row and workflow event are recorded; the route never setsconsumed_atand never calls a backend. The approver is the authenticated principal (the body forbids any other field) and may not be the run's initiator or the request'srequested_byunlessCALIBER_APPROVAL_ALLOW_SELF_APPROVALis set. A request the route cannot decide is a409with a stablereason_codeand a static, payload-free message, nothing written:already_consumed,superseded,withdrawn,expired,approval_not_current(another node's request),already_decided(approved or rejected). On PostgreSQL the route's lock waits are bounded bySET LOCAL lock_timeout(5 s, the Apply claim's bound); a wait that runs out is503approval_busy(retryable, nothing decided, nothing held), because these handlers run on the event loop and a stuck lock must not pin one. So is a deadlock in which the decision is the victim (SQLSTATE40P01, a writer that takes the run and request rows in the opposite order) and, on SQLite, the busy timeout (database is locked, which surfaces at the decision's first write because SQLite has no row locks); the mapping covers the whole decision session (_decision_session), and any other database error is not mapped. Clock. Expiry is judged by the application clock (datetime.now(timezone.utc)) read after the run lock is won, the same clock that wroteexpires_at(so a request is never judged by two clocks); at the claim it is the dispatcher'snow(defaulting to the same clock). The database clock is deliberately not used (ownership.database_nowis "never for deciding expiry"): nodes that share a database need synchronized clocks, and a request is honoured or refused by the node's clock to within its skew, which is why the window is half-open and the tests pin the microsecond. The dispatcher then rechecks the exact intent, evidence, policy, version and every approver's current authority in its claim transaction (run, proposal, request locks, under the lease the execution owner captured): each approver of the quorum must still hold the projectapproveaction and not be the run's initiator or the requester, and the quorum (approval_count) must be met by approvers who remain authorized (role_revoked/self_approvalotherwise,not_approvedwhen the recorded approvers are fewer than the quorum). The platform scopes are one set the producer attests for the approving principals; membership and role are read per approver. Known limitation: the platform scopes of earlier approvers of a quorum are not re-derived at the claim. They were checked when each approved (the decision route), and at the claim only the last approver's attested scopes are applied (the one set the producer passes); a scope an earlier approver lost after deciding is not seen, while a lost project role or membership is. It setsconsumed_atin the same commit asproposed -> approved -> dispatchedand the outbox row, so concurrent dispatchers consume once. If the process dies after that commit and before the remote call, the durable dispatched row and outbox entry remain recoverable; a retry reads the proposal state (already_dispatched) and does not send again. The sameUPDATEstores the commit-time policy decision's id on the request (commit_decision_id, migration0134; see the causal-links section), so a refused or rolled-back claim leaves neither the consumption nor the id. A decision does not wake the run. It stayswaiting_approvaluntilPOST .../resume(operator scope) requeues it.
from caliber.effects.dispatcher import EffectRefused, admit_backend, dispatch, submit_proposal
proposal = submit_proposal(
session,
workflow_run_id=run_id,
node_id="ask",
occurrence_id=occurrence_id,
action=proposed_action,
admission=admit_backend("document_request"), # a kind your own code chose; see "Trusted connector admission"
)
session.commit()
try:
result = dispatch(
session_factory,
proposal.proposal_id,
approval_id=runtime_approval_id,
approver_scopes={"caliber.approver"},
lease=execution_lease,
backend_kind="document_request",
backend_config={"base_url": downstream_url},
approval_validator=approval_valid_at_commit,
)
except EffectRefused as refused:
# Stable code only; re-read the proposal and approval before deciding whether to retry.
logger.info("effect refused: %s", refused.code)
If the private transport returns proven_not_sent or a definitive rejection, the proposal settles failed. A committed HTTP response is only a claim: the connector verifier must return a receipt matching the logical key and intent before the proposal becomes committed. A timeout, process loss or verifier failure leaves a recoverable dispatched/unknown record; do not call dispatch again with a new occurrence. Hold the execution lease and use the reconciler's lookup-by-key path to settle it, or retry after a lease_lost refusal with a fresh lease and a fresh read.
- Fenced by the lease (B05.5a, #734). Every move into or out of
dispatched(dispatching, and committing, failing or markingunknown) must carrylease=, theLeasethe owner captured when it acquired the execution-owner lease (see below), withlease.owner_id == owner_id. In the same transaction as the write (and, insettle_dispatch, the receipt),caliber.ownership.assert_fencedcompares the persisted owner and fencing token for equality and the expiry against the database's clock; on PostgreSQL the lease row stays locked until the transaction ends, so a takeover waits for the settle instead of overtaking it. No lease isevidence_required(and a value that is not aLeaseisbad_field); another owner's lease isstale_owner; a lease that is expired, taken over (an older token), never issued (a future token) or not the execution-owner lease at all (another lease name) islease_lost. A fence that could not be asked (the database failed, timed out, or was serialized away) isstore_failed, notlease_lost: roll back and retry from a fresh read. Each refusal records nothing: a stale worker cannot commit, cannot fail, and cannot even mark the attemptunknownitself, and a receipt it was about to record is rolled back with the refused move. The attempt staysdispatchedfor the reconciler (below), which asks the downstream by key under the new lease. A repeat of the owner's move is fenced too:applied=Falsetells a worker "recorded, this attempt is yours", and a worker that lost its lease must not hear that and go on to send the effect (it islease_lost). Recovery: re-readproposal_state; if it is stilldispatchedunder another owner, do nothing and let the reconciler find it; never re-dispatch. Moves that are not the owner's (approved,reconciled, the callback's commit) are not fenced by it, and neither isrecord_receipton its own: a receipt is a verified statement about the downstream, and onlysettle_dispatch(receipt and state move together, lease first, then receipt, then proposal) is the owner's commit path. Moving a dispatched proposal under a different owner's lease, which the reconciler must do, is not possible here by design (stale_owner): it has its own entry point,abandon_dispatch(below).
from caliber.effects.records import StaleVersion, proposal_state, transition
state = proposal_state(session, proposal_id)
try:
transition(
session,
proposal_id,
"dispatched",
expected_version=state.version,
owner_id=lease.owner_id,
attempt=1,
lease=lease, # captured at acquire(); expired or taken over means ProposalError "lease_lost" and nothing recorded
)
session.commit()
except StaleVersion as stale:
session.rollback() # someone else moved it: re-read stale.current_state and decide again
- Limits. The occurrence id is allocated and persisted by the caller before the effect is attempted; this module records it and cannot tell whether a caller reused one wrongly.
deploymentis this installation's one configured organization (ADR 0001). Connector capability, receipts and reconciliation remain separate services below.
Settling what a run never dispatched (#1074)
A governed step records its effect as a proposed proposal and parks behind an approval request. Until #1074 a run that then ended without dispatching it (the request was rejected, the run failed, was cancelled or expired) left the proposal proposed and its request pending or approved for good, and an approved decision nobody consumed could be stopped only by revoking the approver's role or superseding the request. Now:
- No new state, no migration. A never-dispatched proposal ends in the existing terminal state
failed(theproposedtofailededge of ADR 0003, a compare-and-set onversion) with a shortreason:run_failed,run_cancelled,run_expired,run_completedorapproval_rejected, andsettled_at. It carries nodispatched_at,owner_id,attemptor receipt, which is how a reader tells "never sent" from a failed dispatch. A request moves to the new terminal statuswithdrawn(caliber_runtime_approval_requests.statushas no database check on its value, so no migration is needed); onlystatusmoves, the recorded decision and approvers stay as they were. See the ADR 0003 amendment. - When. In the transaction that writes the run's terminal status: the reject route (
approval_rejected), the cancel route for a run that is not executing, and the worker's failure, cancellation, completion, expiry and checkpoint-maintenance paths (caliber.effects.run_settlement.settle_run_effects). Every live bound request of the run (pending, or approved and not consumed and not superseded) is withdrawn; a legacy node-level request (it guards no effect) and a rejected, superseded or consumed request are left alone. One audit row (settle_run_effects) lists the ids (the first 50) and the exact counts, and only when something changed. - Backstop. The owner-only effect reconciler loop sweeps runs that are already over and still hold a
proposedproposal or a live bound request (a run that ended before this existed, or by a path that missed it) once a minute under the execution-owner lease, at most 50 runs per sweep, each in its own transaction (a refusal or a database error on one run is logged by code or class and the sweep goes on). A full batch of 50 continues after its last run on the next sweep, so a run that keeps failing cannot starve those behind it; it is idempotent. A settlement error in a run's own end path fails that end transaction (accepted: see the ADR amendment). Until it reaches such a run the dispatcher's claim refuses it anyway: the claim re-reads the run under the run lock and answersrun_ended, sending and consuming nothing. - What is never touched. Only
proposedis settled. Adispatchedorunknownproposal (the effect may have been sent) belongs to the dispatcher and the reconciler, which ask the downstream by key;approved,reconciledand settled proposals and a consumed request are not read, let alone changed. Nothing a model, a manifest or a request body says can choose the reason, the status or the proposals: only the run's lifecycle code calls the settlement, with a fixed vocabulary, and it refuses a run that has not ended. - Races. Settlement and the claim take the same locks in the same order (run, proposal rows, request rows) and the claim re-reads the run's status under the run lock, so exactly one wins: either the claim commits first (the proposal is
dispatchedand the request consumed, and the settlement finds nothing) or the settlement commits first (the proposal isfailed, the requestwithdrawn, and the claim is refusedrun_endedwith nothing sent or consumed). Both orders are scenario tests on PostgreSQL.
Withdrawing an approved decision. POST /workflow-runs/{run_id}/approvals/{approval_id}/withdraw with an optional body {"reason": "..."} (the model forbids anything else; the request is named by the path) takes back an approved decision that dispatch has not consumed. It needs the same authority as deciding the request: the project approve action (checked before any lock) and the node's required_role scope (checked before any state code is revealed), so the requester alone cannot withdraw and a project member who may not decide the request learns nothing of its state. The separation-of-duties rule of an approval (not the initiator or the requester) is deliberately not applied: withdrawing only removes the authority to act, as a rejection does, so a requester who also holds the approval authority may withdraw their own request. Under the run lock and then the request lock the request becomes withdrawn only if it is bound to a proposal, approved, not consumed, not superseded and not expired. Refusals are 409 with a stable reason_code: already_consumed (never withdrawn, even after its expiry), superseded, expired, not_approved (a pending request is decided, a rejected one is final) and not_bound (a legacy request guards no effect); an unknown request or one of another run is 404. A repeat of a recorded withdrawal is 200 again with nothing written (idempotent, one audit row withdraw_workflow_run_runtime_approval, one workflow.run.approval.withdrawn run event that names who withdrew it and why). The run's status is not part of the rule (a run that has ended had its live requests withdrawn when it ended, which a late withdrawal answers 200), and the run is not failed: the proposal stays proposed, and a new request for it may be made and consumed. The route holds the same bounded lock waits as the decision routes (503 approval_busy). The dispatcher's claim and the route serialize on the run lock: a withdrawn request is refused by the claim with withdrawn (nothing consumed, nothing sent) and a consumed one is never withdrawn, so at most one of the two wins, in either arrival order. The approval view reports the state withdrawn.
Limits. A withdrawal does not wake or fail the run (POST .../resume remains separate), and the proposal stays proposed, so the effect needs a new approval request before it can be dispatched. The sweep scans caliber_effect_proposals by state, which no index serves (an index would need a migration), so it runs once a minute rather than every tick. A pending request is not withdrawable through the route (decide it, or reject it); the console does not yet offer a withdraw button (the state code withdrawn is understood by the panel, the action is API and SDK only: workflows.runs.withdraw_approval).
Trusted connector admission (B12.3a, #738)
A private transport is admitted by what CALIBER can check about the code that will send, never by a name. The pinned record is caliber.profile.REFERENCE_CONNECTORS (ADR 0001, "trusted connectors only"); caliber.effects.dispatcher.admit_backend(kind) compares the transport registered under kind with it, and caliber.effects.admission holds the pure rules.
| what is bound | how it is checked | refused with |
|---|---|---|
| the connector id and version | the registration must name the record's connector and connector_version | connector_not_admitted |
| the implementation | module:qualname of the registered transport's class (or function), read from the object: a subclass, a lookalike class or a bare function is a different implementation | connector_implementation_mismatch |
| the capability record | the registration carries a ConnectorCapability and its digest() equals the pinned one; every risk it carries (write_not_exactly_once, key_retention_unconfirmed) must be listed in the record's accepted_risks | connector_capability_unproven (none, not a record, or an unaccepted risk), connector_capability_mismatch (another digest: a changed promise is a new digest) |
| the wire configuration | the digest of what the transport sends with (for the document-request connector: the submit and lookup operations, the key header and the accepted resource shape) equals the pinned one | connector_configuration_mismatch |
the settings handed to dispatch | only the record's config_keys, every required_config_keys present, each value bounded: a base_url is http(s) with a host, a valid port, and no userinfo, whitespace, control characters, query or fragment; max_attempts is 1 to 5; timeout_seconds is finite, above 0 and at most 300 | connector_config_not_admitted |
The reference profile admits five connectors: document_request (connector document-request, version 1: the Beta reference connector, which has a stable key, a precondition and a lookup by key; its key retention is unconfirmed, and that risk is accepted by name), the generic http transport that governed webhook and API nodes use (it promises no exactly-once behaviour, so every effect through it needs the caller's own receipt verifier), the registered_tool transport of governed registered tools, and the openapi_http transport of governed OpenAPI tools (connector openapi-http; settings operation and receipt_verifier; it promises nothing about the downstream either), and the mcp transport of governed MCP tools (connector mcp-tool; settings call and receipt_verifier; no key, precondition or lookup, so a result is only a claim). The dispatcher refuses everything else: host-file exports, PostgreSQL MCP writes (EP-114) and any transport added to BACKENDS without a reviewed record. The mcp record admits the MCP transport for a classified call, not a server: the stdio command and remote-host allowlists still decide which servers can be reached. Each has no record in the table, so a proposal or dispatch that goes through the dispatcher is unsupported_backend (no registration) or connector_not_admitted (registered, not pinned), and the host-file and database-write tools are also unsupported_effect_path through the protected-effect inventory (EP-055, EP-114).
What the dispatcher gate does not cover. The dispatcher is gated. The paths that would reach host files or a database write do not go through it, so they are refused where they run instead: the reference profile raises unsupported_in_reference_profile for every inventory row marked refuse (B04.7, #774, Refused paths in the reference profile), which stops the host-file tools (EP-055) and the first-party database MCP write tools (EP-114) at run time, and the startup refusal of any MCP stdio command or remote host on the two allowlists (MCP allowlists, B12.3b, #746) leaves no MCP server reachable in a reference deployment.
Where it is enforced:
submit_proposalrequiresadmission=admit_backend(kind). A proposal that only names a connector (in an action, a manifest, a tool call or a model's output) is refused withconnector_not_admittedbefore a row is written, so no approval is requested for it. The admission is re-verified against the live registry on every submit, and the intent's connector and version must be the admitted ones. Calladmit_backendwith a kind your own code chose, never one that came from data.dispatchadmits the transport itself, before the claim. A transport nobody pinned, or settings it does not accept, is refused with the proposal stillproposed, its approval unconsumed and no connector called. The transport's identity digests (implementation, capability and configuration, never settings or payloads) are written into theeffect.proposal.dispatchedoutbox event asconnector_admission.- A user tool cannot pose as a connector. Tool registration (
POST /tools) and the assistant's tool publisher refuse the namesdocument_request,document-request,http,registered_tool,openapi_http,openapi-http,mcpandmcp-tool(and theirtool.<name>.vNand case variants) with409 reserved_tool_name, like a built-in's name. A tool already registered under such a name before this rule is not rewritten; it is untrusted, is never classified as a connector, and is flagged once by the reserved-name audit (flag_reserved_tool_name, plus oneERRORlog per process that names the connector, not a built-in). Upgrade impact: no new version can be registered under such a name (409 reserved_tool_name), so a deployment with a tool calledhttp(the most likely collision) registers it again under a different name, repoints the workflows that use it, then archives the old row.
Refusal and recovery (every code is stable and carries no payload, setting or URL):
| code | meaning | recovery |
|---|---|---|
unsupported_backend | no transport is registered under that kind | use a registered kind; an MCP, host-file or database-write path is not supported in the reference profile |
connector_not_admitted | no pinned record for the transport, or the proposal names a connector the admission does not cover | submit with admission=admit_backend(<the kind that carries this connector>); an unpinned transport needs a reviewed record in REFERENCE_CONNECTORS |
connector_implementation_mismatch | the registered transport is not the pinned implementation | restore the shipped transport; do not subclass or replace it |
connector_capability_unproven / connector_capability_mismatch | no capability record, an unaccepted risk, or a changed promise | restore the record; a changed promise is a code change that updates the pin in review |
connector_configuration_mismatch | the transport's wire configuration is not the pinned one | restore the shipped configuration |
connector_config_not_admitted | backend_config has an unknown or missing key or an out-of-bounds value | pass only base_url (and optionally max_attempts, timeout_seconds) for document_request; sender and receipt_verifier for http; invoker and receipt_verifier for registered_tool; operation (an OpenApiOperation built from the tool's registry row, never a name or a dict) and receipt_verifier for openapi_http; call (an McpToolCall the runtime built, never a name or a dict) and receipt_verifier for mcp |
from caliber.effects.dispatcher import UnsupportedEffectPath, admit_backend
try:
admission = admit_backend("document_request")
except UnsupportedEffectPath as refused:
logger.error("connector not admitted: %s", refused.code) # e.g. connector_implementation_mismatch
What admission is not:
- Identity, not integrity. The pins say which code and which declared shape were reviewed. A class that forges its
__module__and__qualname__, or a registry entry replaced by in-process code that also controlsprofile.py, is admitted: code running inside the server process is trusted and is outside this control's threat model. The "configuration digest" covers the declared wire constants (operations, key header, accepted resource shape), not what the transport's code does with them, and the capability digest covers the documented promise, not a measurement of it. Behaviour is covered by the connector tests, not by the pin. - Data cannot mint an admission, code can. A manifest, a tool name, a client request or a model's output cannot produce an
AdmittedConnector.submit_proposalre-verifies the value it is given against the live registry; an equal object built by hand from the public table passes that check (it carries no secret). That is harmless, because only trusted code reaches it and the object grants nothing a call toadmit_backendwould not, but it is not an unforgeable capability. - The address is not pinned. The pin binds the transport's code and shape, not the downstream's address. The address a dispatch uses is validated for shape only (http or https, a host, a valid port, no userinfo, whitespace or control characters, query or fragment: a pure check with no name resolution) and the executor still applies the egress policy at send time; binding it to the
CALIBER_EFFECT_CALLBACK_CONNECTORSentry the reconciler asks for belongs with the callers that wire the connector (B04.3 and later).
Configuration and rollback: no new setting and no migration. Reverting the change restores the unchecked registry lookup; proposals already recorded are unaffected.
Connectors: what they promise and what an answer proves
Before the dispatcher (B04.1) sends an effect it needs two things that are not guesses (B05.3, #711; caliber/src/caliber/effects/connectors/): a capability record saying what the connector has been shown to do, and a typed outcome for each request that is never more optimistic than the evidence.
- The capability record (
ConnectorCapability): the stable-key header and its scope (downstream,resourceorunknown) and retention (unbounded,boundedwith seconds, orunconfirmed), what the connector answers when a key is reused for a different request and when a precondition is stale, the 4xx statuses it documents as "refused, nothing committed" (definitive_rejection_statuses), whether it can be asked "did my key commit?" and how consistent that is, and whether a "not found" proves the effect can never happen (absence_proves_noncommit, which also needs a lookup that reads its own writes). A contradictory record is refused when it is built, anddigest()is thesha256:that connector admission binds (a changed promise is a new digest).carries_a_write_exactly_onceis true only for a connector with a key of known scope that refuses conflicts, a lookup by key of known consistency and a precondition; whether its retention is confirmed is separate (retention_confirmed), and admission must require it or record the accepted risk. The document-request record (effects/connectors/document_request.py::CAPABILITY) is what its fixture shows through the real executor:Idempotency-Key; the same key replays (201 then 200) and commits once, before the precondition is checked (a retry after the commit is a 200, not a 412); the same key for a different request is 422;If-Matchcarries the case's integer version and a stale one is 412; the lookup (GET /document-requests?idempotency_key=) reads its own writes. Two claims are argued from the fixture's code, not measured, and are the ones to confirm against the real system: the key is one namespace for the whole downstream (the fixture holds one case), and a 404 does not prove non-commit (a request in flight at the downstream may still commit; no tombstone, no cancel), soabsence_proves_noncommitis false. Key retention is unconfirmed (the fixture never expires a key). - The four outcomes (
TransportOutcome) fromclassify_status/classify_result(a tool result) with the capability:proven_not_sent(seeclassify_error: the request never reached the downstream: refused before it was built, blocked by the egress policy, or every attempt failed to connect; recorded as not happened),definitive_rejection(a 4xx that the capability documents as a refusal, on the first and only dispatch: it committed nothing; recorded asfailed),committed_receipt(200, 201 or 204: the downstream says it committed or replayed a commit; a claim that becomescommittedonly when its receipt is verified, B05.4) andambiguous(everything else: a 4xx the capability does not name such as a gateway's 401 or 413 or a 409 "in progress", a 408, a 202 "accepted for later processing", a redirect, a 5xx, a dropped connection or a timeout after the request may have left, an error nobody classified; the proposal becomesunknown). A documented 4xx is alsoambiguouswhen something earlier could have committed: an earlier attempt by the executor's own retry loop that may have reached the downstream (the result carriesearlier_attempts_may_have_been_sent), or an earlier dispatch of the same effect the call cannot see (earlier_dispatch_possible=True, for a recovery after a crash), because a stale precondition on the retry is then caused by that commit.interpret_lookup(capability, status)returnsanswered(a 2xx: the downstream answered; what it holds is verified against the intent by B05.4),not_committed(a 404, only for a connector that proves absence) orunknown. - What the OpenAPI executor now reports and refuses (
integrations/openapi/executor.py):OpenApiExecutionErrorcarriesnever_sent,attempts, andattempt_log; every exception raised before a request is built carriesnever_sent=True.never_sentis true only if the request is known never to have reached the downstream, and false if any attempt may have (a dropped read, a read or write timeout, a 5xx that was then retried into a connection failure). A POST is retried only if its request carries exactly one idempotency key (fromidempotency_keyorheader_params, header name matched case-insensitively): a bound header with no key behind it no longer enables retries; two different keys, or a blank key header, are refused rather than sent or dropped; a path parameter of.or..is refused. For imported operations, the derived schema exposesidempotency_keyandexpected_resource_versionas canonical fields and removes the boundIdempotency-Key/If-Matchparameters from free-formheader_params; conflicting canonical and header-map values are refused before dispatch. Results includeattempt_log,replay_disposition, andreceipt_disposition; the last isunverifieduntil the connector lookup/receipt layer proves the downstream record matches the proposal.submit_inputrefuses a key that is not 1 to 255 printable ASCII characters without surrounding whitespace and acase_idthat is not one safe path segment, before any request is built.
The dispatcher's private document_request backend does the following; it sends through the private raw transport (_send_raw), because the public execute_openapi_http_tool refuses a POST (unsupported_effect_path). Application code does not call it: a write is a proposal.
from caliber.effects.connectors import classify_error, classify_result
from caliber.effects.connectors.document_request import CAPABILITY, submit_config, submit_input
from caliber.integrations.openapi.executor import OpenApiExecutionError, _send_raw
try:
result = _send_raw(
execution_config=submit_config(server_url),
input_schema=None,
input_data=submit_input(
case_id=case_id, idempotency_key=proposal_key, expected_resource_version=7, body={"document_type": "pay_statement"}
),
)
outcome = classify_result(result, capability=CAPABILITY).outcome # committed_receipt, definitive_rejection or ambiguous
except OpenApiExecutionError as error:
outcome = classify_error(error).outcome # proven_not_sent, or ambiguous: the effect may have happened
- Remaining boundary. #990 completes the executor/import plumbing: the dedicated canonical fields, import-persisted binding and retry limits, conflict refusal, and per-attempt/replay metadata are now available. The connector's
submit_inputstill puts the key and version on the request itself, so the B04.1 dispatcher does not depend on the derived schema. Verified receipts and the reconciler remain B05.4 and B05.5; an executor2xxorreplay_candidateis not by itself proof of a committed receipt.
Receipts: committed only with proof (B05.4a, #717)
A 2xx answer from a downstream is a claim. caliber.effects.receipts (table caliber_effect_receipts, migration 0125) turns it into a receipt only after the platform has asked the downstream's own query and what came back is this proposal's effect.
- What a receipt is checked against.
ReceiptFacts(what the connector read back) must carry the proposal's logical key as the stored idempotency key, hash (as the intent rebuilt from the stored request) to the proposal'sintent_hash, name the proposal's connector, connector version and target resource, and answer the dispatch attempt the proposal recorded. A mismatch is refused with the names of the fields that differ (ReceiptMismatch, codereceipt_mismatch), never their values. The document-request connector'sfacts_from_lookupalso requires, when the proposal expected a case version, that the stored version is exactly one more; a lookup that answers 404, a 5xx, a body that is not a stored request, another case or another document type gives no facts (and is not a failure). - Immutable, one per attempt, not borrowable. A receipt is the canonical
receiptv1 record and its SHA-256, refused for update or delete by database triggers (and on PostgreSQL a CHECK ties the digest to the bytes);read_receiptrecomputes the record from the columns and checks it against its proposal (key, intent, attempt, connector, target), so a row edited in place isreceipt_corrupt(rewriting the columns and the bytes together would not be detected: there is no MAC, a limit of every immutable table here). The same facts delivered twice are one receipt (created=False; the response digest is not compared, because it hashes the whole lookup body, which can gain a field between deliveries, and the first one stays recorded); a different request id or resource version for the same attempt, or a downstream request id that already belongs to another proposal or attempt, arereceipt_conflictand never replace the first. A receipt can be recorded while the proposal isdispatched,unknownorreconciled, not before it was dispatched and not after it settled (receipt_state). committedneeds a receipt, andfailedcannot have one.transition(..., COMMITTED, receipt_id=...)verifies the receipt exists, was read back (query), and answers this proposal's attempt, key and intent (receipt_refusedotherwise); the id is recorded on the proposal, and the database refuses a move tocommittedwhosereceipt_idis empty, does not exist or is another proposal's or attempt's. Once a verified receipt exists the proposal cannot be moved tofailed(receipt_exists; the database refuses it too):failedis final, and the downstream's own query said it committed. The database also refuses a receipt for a proposal that is notdispatched,unknownorreconciled.- Settling a dispatch.
settle_dispatch(session, proposal_id, outcome=..., verify=..., lease=...)first checks the proposal is stilldispatchedatexpected_version, held by this owner and attempt, under this owner's lease (another owner or attempt is refused before a query is made and records nothing; whether the lease is still held is decided at the write, never before the query, so the lease row is not locked across the network call; a repeat of a settle that already happened isstale_version), then records what one attempt proved, the receipt and the commit as one unit (a refused commit keeps no receipt; ifverifyraises the proposal staysdispatched): acommitted_receiptclaim runsverify()(the authoritative query) and commits with the receipt if it confirms, and otherwise leaves the proposalunknown(receipt_unverified): a 404 or a mismatching stored request never certifies a failure, because a downstream that does not know a key yet may still process it; adefinitive_rejectionisfailed(rejected:<code>),proven_not_sentisfailed(not_sent) andambiguousisunknown(ambiguous:<code>).
from caliber.effects.connectors.document_request import facts_from_lookup
from caliber.effects.receipts import settle_dispatch
from caliber.effects.records import proposal_state, proposal_view
view = proposal_view(session, proposal_id)
def verify():
found = lookup_by_key(view.logical_key) # the connector's query: {"status_code": ..., "json": ...}
return facts_from_lookup(view, lookup_status=found["status_code"], lookup_body=found["json"])
settled = settle_dispatch(
session,
proposal_id,
expected_version=proposal_state(session, proposal_id).version,
owner_id=owner_id,
attempt=attempt,
lease=lease, # the lease the owner captured; fenced in this transaction (B05.4a/B05.5a)
outcome=outcome, # from classify_result / classify_error
verify=verify,
)
- What this does and does not prove.
record_receiptcan only compare the facts it is handed with the proposal, so a receipt is as sound as the connector verifier that built them from the downstream's answer. For document-request,facts_from_lookupconfirms the stored key, case, document type and (when the proposal expected a version) a stored version exactly one more, which holds only for a proposal built withdocument_request.build_intent: its arguments are exactly{"document_type": ...}, because that is all the downstream stores; a proposal with other arguments would commit downstream and then stayunknown. The proposal's effect class and expected version come from the proposal itself, so only the key, case, document type and version are checked against the downstream's data. Under REPEATABLE READ PostgreSQL refuses a competing insert as a serialization failure (store_failed): roll back and retry from a fresh read. - Not here. The reconciler for
unknownand abandoneddispatchedproposals is below. The dispatcher delegates to these capability and receipt contracts; it does not infer a commit from an HTTP status alone.
Reconciler: only the owner asks about unknown and abandoned effects (B05.5b, #742)
An effect with no recorded outcome is unknown, and an attempt whose dispatcher died or lost its lease while it was dispatched is abandoned: it may have been sent. Neither is ever dispatched again (there is no edge from unknown back to dispatched). caliber.effects.reconcile settles them the one way ADR 0003 allows: by asking the downstream by the original logical key, and believing only what it can prove.
- Owner-only.
reconcile_pass(factory, lease=..., targets=..., lookup=...)needs theLeasethe execution owner captured, and every write re-compares it in the transaction that writes (fence_owner: exact owner and fencing token, database clock). No question is asked on a lease that is gone. A pass whose lease is taken over stops withProposalErrorlease_lost; what it already settled stays settled and the new owner's pass takes the rest. The loop that runs the pass on an interval is below. - Abandoned means a prior lease. Migration 0126 records
dispatch_token(the fencing token the owner held) with every dispatch. Adispatchedproposal is abandoned exactly when its token is lower than the token of the lease the reconciler holds;abandon_dispatchthen recordsunknownwith reasonabandoned_dispatch(under the reconciler's lease;not_abandonedfor a dispatch under the current lease, which is in flight in this very process and is left alone unless the caller givesin_flight_seconds, see below, or one with no recorded token, which proves nothing). A dispatch under another token is also never a repeat of the dispatch before it. - Only authoritative terminal evidence moves it. The lookup runs outside any transaction, against the connector's own query, at the
base_urlof theCALIBER_EFFECT_CALLBACK_CONNECTORSbinding for that connector and project (so it goes through the egress policy), and is read by the connector's capability record (interpret_lookup):The downstream says Recorded Outcome a stored request that is this proposal's effect (key, intent, target, expected version) verified receipt, reconciled,committed; one audit entrycommitted404 from a connector that proves absence final (tombstone or honoured cancel, reads its own writes) reconciled,failed(absence_proven)failed404 from any other connector (document-request included): delayed visibility, or a request still in flight nothing unknown5xx, 401 or any other status nothing unknown(detailhttp_<code>)a 2xx whose body is not this proposal's effect (unreadable, or another request under the key) nothing unverifiedcannot be reached, or no binding for this connector and project nothing lookup_failed/not_boundA proposal that another actor moved while the downstream was asked is
movedand is not overwritten (the write is conditioned on the version that was read). - Unknown blocks what depends on it. The runtime asks
plan.effect_gatebefore every node, at the top of every attempt of its retries and before a guardrail re-runs the agents feeding it, with the node and everything it may depend on: every node upstream of it by edge, and the inline children of each of those (afor_each/loop/error_boundarytarget, a boundary'scompensate_with, an agent's handoff targets), which have no edges of their own. While an effect any of them asked for isdispatched,unknownorreconciled, the node does not run and the runtime returns a durablewaiting_effectcheckpoint (effect_reconciliation) containing the node inputs, proposal id, logical key and intent digest. The queued-run worker persists the run aswaiting_effectwitherror_code=effect_reconciliation; it does not turn the refusal into a terminal failure or run the gated node. The refusal is never absorbed: a fan-out item, a loop iteration, an error boundary or its compensation does not turn it into the item's own error. - A parked run resumes as the same occurrence. After the reconciler or an authoritative receipt callback settles every proposal named in the checkpoint as
committedorfailed, the platform atomically changes that same run fromwaiting_effecttoqueuedand recordsworkflow.run.effect_resumed. The worker resumes from the checkpointed gated node, preserving the original run id, logical key and intent digest; it never creates a new logical occurrence or dispatches the proposal again. A proposal that remainsdispatched,unknownorreconciledkeeps the run parked. ManualPOST /workflow-runs/{run_id}/resumeand retry are refused while it iswaiting_effect; only authoritative settlement wakes it. The proposal and run reason are visible in theparked_runscollection returned byGET /system/effects?source=proposal.
from caliber.effects.callbacks import parse_bindings
from caliber.effects.reconcile import reconcile_pass, targets_from_bindings
targets = targets_from_bindings(parse_bindings(config.effect_callback_connectors))
for result in reconcile_pass(session_factory, lease=lease, targets=targets):
print(result.proposal_id, result.outcome, result.state) # committed | failed | unknown | unverified | lookup_failed | not_bound | in_flight | moved
- Timeout example (V08). The connector's timeout fires after the request went out (
ambiguous, recordedunknownwith reasonambiguous:may_have_been_sent; notfailed, the downstream may have committed, and notcommitted, nobody read a receipt). The dependent run is parked at aneffect_reconciliationcheckpoint, nothing can dispatch the proposal again (illegal_transitionfromunknowntodispatched), and the next reconciler pass finds the stored request by the original key, commits it with a verified receipt and wakes the same run. Resuming the checkpoint produces one downstream mutation throughout (tests/egi_scenarios/test_v08_timeout_retry.py). - Refusals and recovery.
lease_lost: you are no longer the owner, stop and let the new owner reconcile.store_failed: roll back and retry.unknownafter a pass: nothing proves the outcome yet (delayed visibility looks like absence); the next pass asks again, the effect is never re-sent, and dependents stay blocked. There is no operator action that fails anunknowneffect without the downstream's evidence, by design (the operator view below lists them and offersreconcile, which only asks); a connector that can prove absence should setabsence_proves_noncommit. - Limits. A pass looks at every candidate (a backlog that stays
unknowncannot hide a newer one) and does not renew the lease: the caller bounds it withbudget_secondsand renews or stops inon_progress. Adispatchedrow under the current lease isin_flightand is the dispatcher's to settle (it recordsunknownitself on a settle error that is not a lost lease; the reconciler never abandons it, and expires it tounknownonly pastin_flight_seconds). Adispatchedrow with no recorded token (none exist in shipped code; a downgrade through 0125 drops the column) is never abandoned. One connector (document-request) can be reconciled; another needs a verifier and capability record inreconcile.CONNECTORS. The gate runs where the runtime does (the queued-run worker, not preview or evaluation, which refuse effect nodes). A worker subworkflow's child plan is built separately but inherits the worker's governed HTTP context and reconciliation gate; its legacy effect ledger is not installed there, and its registered/OpenAPI/MCP effects remain fail-closed.
The reconciler loop and the in-flight rule (B05.5d, #997)
caliber.orchestrator.effect_reconciler.EffectReconcilerTask is the owner-only loop that calls reconcile_pass. It is one of the loops in worker_inventory() (owner_only, with a recovery row in ADR 0002), started and stopped with the others by the lifespan. It is built in the reference profile only (the execution-owner lease exists nowhere else, and a pass cannot act without one), and is on there unless CALIBER_EFFECT_RECONCILER_ENABLED=false; leave it on wherever a dispatcher can run, because without it an effect whose settle failed stays blocked until an operator asks.
| Setting | Default | Bounds | Meaning |
|---|---|---|---|
CALIBER_EFFECT_RECONCILER_ENABLED | true | flag | Build the loop in the reference profile |
CALIBER_EFFECT_RECONCILER_INTERVAL_SECONDS | 15 | 1 to 3600, finite | Seconds between passes |
CALIBER_EFFECT_RECONCILER_BUDGET_SECONDS | 20 | 1 to 600, finite | A pass stops starting lookups after this long; a lookup in progress finishes (its own timeout applies, 30 s by default) and the next pass continues after the last proposal looked at |
CALIBER_EFFECT_IN_FLIGHT_MAX_SECONDS | 900 | 300 to 86400, finite | How long a dispatch may stay dispatched under the lease that is still current before the loop records it unknown. Must exceed the longest a dispatch can take: the executor's 30 s timeout times at most 5 attempts, its backoff (under 4 s) and the 30 s receipt lookup come to about 3 minutes, which the 300 s floor covers; a connector with a longer timeout needs a larger value |
- Under the lease, never as a secondary. The lifespan binds the loop to
role.lease, the lease theExecutionRoleControllerholds now. A tick with no lease (a secondary, or the controller dropped it) does nothing but write its own heartbeat. Each pass hands that exact lease toreconcile_pass, so every write compares it in its own transaction. The loop never renews the lease (the controller does, on its own thread); a loop that also renewed would be a second renewer. - Lease loss stops it between proposals. Before each proposal the pass checks that the controller still holds the same lease (owner and fencing token) and that no stop was requested; if not, it ends there (
lease_changedorstopped) and nothing further is read, asked or written, so nothing new starts after the lease is lost. If the database refuses the lease first (it was taken over before the controller noticed),reconcile_passraiseslease_lostand the pass ends with nothing recorded. The next tick takes whatever lease the controller holds then; a re-acquired lease has a higher token and starts a fresh pass. - Bounded. No lock is held across a lookup (each proposal is read, asked about and written in separate transactions), and on PostgreSQL every transaction of the pass carries
lock_timeoutandstatement_timeoutof a third ofCALIBER_EXECUTION_LEASE_SECONDS, like the controller's own lease calls. A budget-cut pass resumes after the last proposal it looked at, so a backlog of effects that stayunknowncan neither starve the rest nor be the only thing ever looked at. - Targets are the
CALIBER_EFFECT_CALLBACK_CONNECTORSbindings (thebase_urlof each(connector, project)that may report a receipt) and the generichttplookup endpoints ofCALIBER_EFFECT_HTTP_VERIFIERS(one per listed(project, resource), #1055). With none bound the loop still abandons the dispatches of lost leases and expires stuck in-flight ones, and every lookup reportsnot_bound. - Stop. A stop ends the pass at its next proposal and waits up to
CALIBER_SHUTDOWN_GRACE_SECONDSfor it. A lookup in progress is not interrupted; if it outlasts the grace the stop returns with a warning and that one proposal finishes alone (its writes stay fenced by the lease, so it cannot record anything once the lease is released). The reconciler holds no claims, so there is nothing to give back. - Liveness. A
caliber_worker_heartbeatsrow of kindeffect_reconcileris written every tick (idle ones too) and inside a long pass; a clean stop removes it. Nothing reads that kind yet: it is a row an operator can query.
The same-token stuck dispatch. abandon_dispatch only helps when the dispatching lease was taken over. When the dispatcher keeps its lease, sends the effect and then cannot record the outcome, the row would stay dispatched under the current token for good. Two rules close that, and neither sends anything (there is no edge from unknown back to dispatched):
- The dispatcher records
unknownitself. Ifsettle_dispatchfails for any reason other than "someone else owns the row now" (lease_lost,stale_owner,stale_version,illegal_transition),dispatchrecordsunknownin a fresh transaction under the same captured lease, with the reasonsettle_failed:<code or exception class>(never the message), and then raises the original failure. The move is fenced like the settle: a lost lease, another owner or a row someone else already moved records nothing. It is best effort: if the store is still down it fails too and rule 2 applies. - The loop expires it. A
dispatchedrow whosedispatch_tokenis the current lease's own and which has beendispatchedfor longer thanCALIBER_EFFECT_IN_FLIGHT_MAX_SECONDSbecomesunknown(in_flight_expired, with aneffect_in_flight_expiredaudit row in the same transaction) and is then asked about by key like any otherunknownone. A younger row isin_flightand left alone. A row with no recorded token proves nothing and is never expired.
The dispatcher and the loop racing for one row. Both write under the lease row's lock (taken first) and both are conditioned on the version they read, so exactly one wins and the loser records nothing: if the dispatcher settles first the loop finds the row moved; if the loop expires it first, the dispatcher's settle is refused as stale_version (its receipt is rolled back with it), the row stays unknown, and the effect was sent once either way. The outcome is not lost: unknown is settled by a lookup by key, which finds the request for a connector that has one. Set the bound above the longest a dispatch can legitimately take (the transport's timeout times its attempts, plus the receipt lookup), or a slow dispatcher that was about to commit finds its row unknown instead.
Known limits. A connector with no lookup by key (the generic http connector has none) can never be settled by the loop: its unknown rows report not_bound every pass and keep blocking their dependents until a connector with a lookup is bound. Each pass looks at every open row, so a very large backlog of such rows costs a few queries each per pass. The loop is a single sequential worker. Proposals are still created only where a run supplies a governed effect context; see "Governed webhook and API-request nodes".
Operator reconciliation view: legacy claims and proposals, labelled apart (B05.6, #751)
GET /caliber/system/effects (operator scope) lists two different records of an effect that may need a person, and never mixes them:
effects (source: legacy_ledger, source_version: ledger-v0) | proposals (source: effect_proposal, source_version: proposal-v1) | |
|---|---|---|
| What it is | the queued-run worker's claim ledger (caliber_effect_ledger) | the ADR 0003 proposal ledger (caliber_effect_proposals) |
| Listed by default | status=in_progress (status=any or another status widens it) | the open states dispatched, unknown, reconciled (proposal_state=any or one state) |
| Settled by | an operator: POST .../system/effects/{effect_key}/resolve (admin, audited: skip or retry) | the reconciler's lookup by key. The operator can only ask now: POST .../system/effects/proposals/{proposal_id}/reconcile |
safe_actions | resolve:skip, resolve:retry on an in_progress claim, none otherwise | reconcile on an unknown or reconciled row and on a dispatched row with abandoned: true, none otherwise (a dispatched row of the current lease is the dispatcher's until the in-flight bound) |
Every row carries source, source_version and its own safe_actions, so a client cannot apply the legacy resolve to a proposal (it is refused, 400, and changes nothing) or read a proposal as a ledger claim. Legacy rows keep exactly the fields they always had (plus the label); the migrations that created the proposal tables leave them untouched and invent no receipt for them. A proposal row has identifiers, state, version, attempt, owner_id, dispatch_token, reason, receipt_id, timestamps, blocks_dependents (true while it is dispatched, unknown or reconciled: nothing that depends on it will run) and abandoned (for a dispatched attempt: true when a newer lease has replaced its dispatching lease and the reconciler will pick it up; false when no newer lease has been acquired, which is the dispatcher's own lease or one that lapsed with nobody to replace it yet; null for any other state, a row with no recorded token, or no lease at all). The proposal response therefore also carries lease (the stored execution-owner lease: owner_id, fencing_token, expires_at, expired, or null), so an operator can tell those two false cases apart. No row carries a payload: no arguments, intent bytes or recorded result (the query selects only the listed columns). The view is operator-scoped and system-wide: it shows every project's rows (each with its project_id, connector, resource and owner_id), like the rest of /system/*; reason is a short code by convention and must never carry a payload (recorders pass fixed codes). Known limit: no index on proposal state/created_at yet, so a very large ledger lists by scan (a follow-up if it grows). Query parameters: source (all by default, legacy or proposal), status, proposal_state, workflow_run_id, limit (1 to 1000, applied to each list; the proposal list reports proposals_truncated when more matched, newest first); proposal_state is only checked when proposals are asked for, and an unknown source or proposal_state is 400. The response also carries sources, a description of each kind (settled_by, safe_actions). SDK: client.system.effects(source="proposal", proposal_state="unknown").
Operator action: reconcile (B05.5d, #997)
POST /caliber/system/effects/proposals/{proposal_id}/reconcile with {"reason": "<1 to 500 characters>"} (admin scope; SDK client.system.reconcile_effect_proposal(proposal_id, reason=...)). It asks the downstream about one proposal now, which is what the loop does every pass, and it is the only operator action on a proposal. It is deliberately not a way to say what happened:
- No say-so. The body accepts
reasonand nothing else (any other key is400). There is nocommittedorfailedan operator can write: a receipt exists only when the platform read the effect back from the downstream by its key, andfailedonly when the connector proves absence final (ADR 0003). A 404, a 5xx, an unreadable body, an unreachable downstream or no binding leave the proposalunknownand the answer says so (outcome:unknown,unverified,lookup_failed,not_bound,in_flight); only a stored request that is this proposal's effect settles it (committed,settled: true). - Owner-fenced. It runs under the execution-owner lease of the process that serves the request (
app.state.execution_role), throughreconcile_one, so the lease is compared in the transaction of every write. A process that is not the owner (or whose controller has dropped the lease) answers409 not_execution_ownerand asks nothing; a lease taken over mid-request is409 lease_lostwith nothing recorded. An operator request and the loop asking at once settle the proposal exactly once (the second sees itmoved). At most 4 operator lookups run at once per process; the rest get429 too_many_reconciliations_in_flightand nothing is asked. The route also accepts adispatchedrow of the current lease, whichsafe_actionsdoes not list because it does not always act: younger thanCALIBER_EFFECT_IN_FLIGHT_MAX_SECONDSit answersin_flightand changes nothing; older, it recordsunknown(in_flight_expired) exactly as the loop would and asks. - Audited. Every request that reaches the reconciler leaves one
effect_reconcile_requestedaudit row (actor, reason, state before, outcome, state after, owner and fencing token; no payload), whether or not the proposal moved; a lease lost mid-request, or any other failure of the request (recorded by error code or exception class name only), is recorded too. When the lookup settles the proposal, the reconciler's owneffect_reconciledrow is written in the same transaction as the move. A proposal that is notdispatched,unknownorreconciledis409 not_reconcilableand nothing is recorded; an unknown id is404. - Why nothing more. A proposal that stays
unknownfor good (a connector with no lookup by key, a downstream that never shows the request) keeps blocking its dependents. That is the safe state: the alternative, an operator marking itfailed, unblocks them on a belief while the effect may have happened. The operator procedure is in the recovery runbook.
Receipt callback: a connector tells the platform it is done (B05.4b, #725)
POST /ajax-api/2.0/mlflow/caliber/effects/callbacks/receipt (caliber/src/caliber/routes/system_effects.py) lets a connector say "the effect for this idempotency key is done". It is not a CALIBER session (no identity, no CSRF token, no rate-limit bucket: the connector is the caller) and its only admission control is a signature. The body is exactly {"idempotency_key": "<key>"} and nothing else: the callback is a notification, and the platform asks the downstream itself (the connector's lookup by key) before it records anything.
- Who may call.
CALIBER_EFFECT_CALLBACK_CONNECTORSis a JSON array of bindings, each{connector, project_id, secret_source, base_url}: the connector, the one project it may act in, where its signing secret is read from (never the secret itself) and the base URL of its downstream. Empty (the default) accepts no callback; a malformed list stops the service at startup; the settings page shows only a count. One connector in one project has one secret; a connector bound to two projects has two. A secret shorter than 16 characters is refused (fail closed). The lookup the platform runs is the connector's plain GET by key (the binding has no authentication field yet, so it suits a downstream that allows it), goes through the egress policy (an internal downstream's host must be inCALIBER_EGRESS_ALLOWED_HOSTS) and is bounded: at most 4 lookups per connector and project at a time (503 busy, retryable). - The signature. Headers
X-Caliber-Connector,X-Caliber-Project,X-Caliber-Timestamp(whole seconds, canonical: no leading zeros),X-Caliber-Delivery(an id unique per connector and project, 1 to 128 printable characters) andX-Caliber-Signature: v1=<hex>, the HMAC-SHA256 ofv1\n<connector>\n<project>\n<timestamp>\n<delivery>\n<hex sha256 of the body>under the binding's secret. The connector, project, timestamp, delivery id and body are all inside the signed string, so a signature made for one connector, project or message is useless for another. A timestamp more than 300 seconds from the server's clock is refused; a captured message replayed inside the window can only make the platform ask the downstream again, and a receipt is recorded once. - One refusal. An unknown connector or project, a secret that cannot be read, a bad or malformed signature and a stale timestamp are all the same
401 {"detail": "callback rejected"}: a probe cannot tell them apart. After that, a body that is not exactly the key is400, and a body over 4 KiB is413. - Scope without leaks. The key is resolved to a proposal of this connector in this project; anything else (a key in another project, another connector's key, a key nobody has) is the same
404 {"detail": "no such proposal"}. - What happens.
committedalready:200 already_committed.failed:409 proposal_failed. Not yet dispatched:409 not_dispatched.dispatched:202 in_flight(the dispatcher, or the reconciler once the dispatch is abandoned, still owns it).unknownorreconciled: the platform runs the lookup outside any transaction. If the downstream cannot be asked:502 lookup_failed. If it holds nothing under the key, or something that is not this proposal's effect:202 unknown, the proposal staysunknown(a missing record is not a failure) and nothing is consumed. If it confirms, one transaction deduplicates the delivery (the inbox of B13.5a), records the verified receipt (B05.4a), movesunknownthroughreconciledtocommittedand audits it:200 committedwith thereceipt_id. - Retryable, never half-consumed. The delivery id is consumed only together with the receipt and the commit; if any of it is refused (
409with the reason code, for examplereceipt_conflictorstale_version) the transaction rolls back and the same delivery can be sent again. The same delivery id with a different body is409 inbox_payload_mismatch; the same delivery repeated after success is200 duplicate(answered from the inbox before any query); a new delivery for an already committed proposal is200 already_committed. Delivery ids are scoped to the binding (a digest of connector and project), so two projects' connectors never collide or burn each other's ids. A callback that loses a race to the commit is toldalready_committed, not a failure. Success bodies use the platform's{"data": ...}envelope.
import json
import time
from caliber.effects.callbacks import sign
body = json.dumps({"idempotency_key": proposal_key}).encode()
timestamp = int(time.time())
headers = {
"X-Caliber-Connector": "document-request",
"X-Caliber-Project": project_id,
"X-Caliber-Timestamp": str(timestamp),
"X-Caliber-Delivery": delivery_id,
"X-Caliber-Signature": sign(secret, "document-request", project_id, timestamp, delivery_id, body),
}
- Not here. The lease fencing of a dispatcher's own settle (B05.5a, above) does not apply to this callback, which is not an owner-only path; the callback commits an
unknownorreconciledproposal only, never one a dispatcher still holds.
Approved context sources
A run's context may only come from sources its project has approved (B07, #692). The inventory is caliber_approved_context_sources (caliber/src/caliber/context/sources.py): one row per (project, knowledge base, version), unique. approve_source(session, project_id, knowledge_base_id, version_id, actor) records an approval, revoke_source(...) withdraws it (the row stays, with revoked_at and revoked_by, as evidence) and is_approved(session, project_id, knowledge_base_id, version_id) answers whether it is approved now (False once revoked, for anything never approved and for a source that no longer exists). Admission reads it (B07.1b, #696): under CALIBER_PROFILE=reference every knowledge-base version a run can read must be approved for the run's project (require_approved, called by prepare_admission, so create-run, trigger, retry and the assistant tool all pass through it). That is the versions in the sealed bundle's dependency lock, the versions named on a knowledge-query node that names only version_ids, and the versions read by every child workflow the run calls (each child's own sealed bundle, which must be the one the parent was compiled against). A query whose version_ids arrive on an input port cannot be pinned, so it is refused outright. Otherwise the run is refused with 403, reason_code: source_not_approved in the error body and every unapproved knowledge_base_id@version_id named in the message, and nothing is stored. The role check (resource.execute on the project) comes first, so only a caller who may run the workflow learns what the project has approved. Approval and revocation take effect at the next admission: an idempotent retry of a request that was already admitted still returns that run, and a run already admitted keeps running on what it was pinned to (the load-time check is B07.2, #699). A knowledge base that belongs to another project or to no project can never be approved for this one (only a project's own knowledge bases can), so a workflow pinned to one is refused until it uses one of the project's own. Development does not require approval. The refusal is not audited (it carries no policy decision); the response is the record.
- A version, not a knowledge base. Approving version 1 approves nothing else; a new build must be approved on its own.
- Only a project's own, real sources. The knowledge base must belong to the project and the version to that knowledge base. Every miss (unknown id, another project's knowledge base, a version of a different knowledge base) is one
source_not_foundrefusal whose message names no identifier, so a foreign id cannot be probed. - Idempotent and race-safe. Approving an approved source returns the existing row; concurrent approvals create one (the unique key decides). Approving a revoked source reactivates the row with the new approver and time. Revoking a source that is not approved is
not_approved. The row is read from the database and locked (FOR UPDATEon PostgreSQL) before it changes, so concurrent revocations or reactivations change and audit it once, and never overwrite who revoked it. - Completed builds of live knowledge bases only. The version must be
completed(the rule that gates activating a version) and the knowledge base not archived; otherwise it issource_not_found. An approval whose version or knowledge base has since been deleted no longer counts (is_approvedis false andapproved_sourcesomits it); the row stays as evidence. - Audited. Approval and revocation each write an audit row (
approve_context_source/revoke_context_source, entitycontext_source, ids only). The functions do not commit; they do not decide who may approve (the caller's project-role check does). - Not a foreign key to the knowledge base. The inventory outlives a deleted knowledge base on purpose; the loader must still check the version exists.
Authorizing a source before it is loaded (B07.2, #699)
In the reference profile the run's own grant lists the context sources it may read: admission adds the action context.read and one resource per source, knowledge_base:<knowledge_base_id>@<version_id>, for exactly the sources it approved (the bundle's, its query nodes' and its child workflows'). When the worker builds an admitted run's plan it hands the knowledge-query runner a guard (caliber.context.authorize.source_guard_for), and the runner calls it with each version it is about to query, before the retrieval service is touched. The guard runs authorize_source(session, identity, run_manifest, grant_id, knowledge_base_id, version_id):
- the run's subject (derived from its stored manifest by
identity_for_run) must equal the subject the manifest being checked recorded (identity_mismatch; a guard against mixing manifests, not a second authentication); - the source must still be approved for the project (
source_not_approved; a withdrawal after admission lands here and writes an audit rowcontext_read_deniedwith ids only; no policy question is asked for a withdrawn source); decide(...)is asked with the manifest's run id, the exact grant id the manifest names, the manifest's typed subject and workload,context.read, the exact source resource and the manifest's purpose: a grant that does not list the source isresource_not_allowed, another run's grantgrant_not_found, a member who leftnot_a_member, a revoked or expired grant is refused, and the decision (allow or deny) is recorded and audited like any other.
Every refusal is a ContextDenied with one fixed message that names no source (<code> (<reasons>): this run may not read that context source); the node fails and the run fails with the stable run error code context_denied (the code and the policy's reasons are in the summary), and nothing was loaded. An authority store that cannot answer is a refusal (authority_unavailable), and a database message is never put in the node's error text. context.read is a project action (owner, editor, reviewer) with policy risk 2. The guard is passed to child workflows the run calls.
| run error | meaning and recovery |
|---|---|
context_denied with source_not_approved | the source was approved at admission and withdrawn since: approve it again, or resubmit the run on an approved version |
context_denied with authority_denied (not_a_member) / grant_revoked / grant_expired | the run's subject left the project, or its grant was revoked or ran out: resubmit as someone who may |
context_denied with authority_denied (action_not_allowed) or (resource_not_allowed) | the run's grant does not list that source (a run admitted before sources were authorized, or a query that reads a version the run was not admitted for): resubmit the run |
context_denied with authority_unavailable | the authority store could not answer: nothing was loaded; resubmit when it is back |
What it does not do. The guard follows how the run was admitted: it is built when the run's grant carries context.read (or this deployment requires approved sources), so a run admitted with sources stays guarded under any worker configuration. A run admitted before sources were authorized has no context.read and fails where sources are required (resubmit it). A grant holds at most 256 resources, so a run with 256 or more sources is refused at admission (grant_refused). The check is point-in-time: a withdrawal landing between the guard and the query does not stop that one read. Outputs a run already produced (replayed on a resume from a checkpoint) are not re-authorized. Each version queried costs one decision and one audit row (a query naming several versions authorizes each before any is read).
Knowledge reads outside an admitted run (B07.6, #973)
The reference profile has one governed knowledge-read path. An admitted workflow run supplies the typed run principal, its immutable manifest and its exact grant; the worker passes a SourceGuard to every knowledge-query node, including child workflows. The guard records an explicit context.read decision for each exact knowledge-base version before the retrieval service is called. Foreign projects, revoked memberships or grants, withdrawn approvals, and versions not in the grant therefore fail closed without a retrieval call.
Other paths do not have a run-bound principal and cannot turn a manifest override or an ambient project-visible identity into authority. In CALIBER_PROFILE=reference they refuse before loading knowledge bytes:
| surface | reference-profile behavior | required principal/authorization |
|---|---|---|
| preview, including assistant draft preview | governed_run_required | an admitted workflow run; preview is not a run and has no context.read grant |
| evaluations and deploy gates | governed_run_required | an admitted workflow run; offline replay is not an authorization boundary |
| refinement and calibration | governed_run_required | an admitted workflow run; the stage/job identity alone is insufficient |
assistant query_knowledge_base | governed_run_required | an admitted workflow run, not the assistant's project visibility |
direct POST /knowledge/query | governed_run_required | an admitted workflow run, not the caller's project visibility |
| exported runtime query and child-workflow query | the default runtime uses the caller-supplied admitted-run SourceGuard; unwrapped custom callbacks return governed_run_required | the exact run principal, manifest, grant and context.read decision |
knowledge_build workflow nodes | governed_run_required | no current workflow-node contract authorizes the source bytes used to build a new version |
The refusal is raised before the retrieval or build service is reached. Development and legacy profiles retain their historical behavior; that compatibility is not a reference-profile authorization guarantee. Knowledge-base listing, metadata, build and version-management APIs remain resource-scoped operations; this matrix covers operations that load knowledge content for retrieval or workflow execution.
The context manifest
What an agent step is given is recorded before the provider sees it (B07.3a, #704): caliber.context.manifest builds a context_manifest v1 record (ADR 0003) and stores it once in caliber_context_manifests, as canonical JSON with its SHA-256 (the record has no digest field: the digest excludes itself), unique per (run, step request, revision). Re-assembling a step is a new revision, never an edit; a revision that skips ahead or repeats is refused. UPDATE and DELETE are refused by database triggers and by the ORM (and, as for run manifests, run the application as a role without those privileges).
A manifest lists the segments in the order the provider sees them (position equals the index), each with (a segment's kind must match its source: a knowledge base's text can only be retrieved_text, an instruction or structured-output suffix can only come from a prompt, and a tool specification/result can only come from a tool):
- a trust tier:
instructiononly for a system/workflow instruction or structured-output suffix (and every one is); everything else, the user's input, retrieved text, tool output, history and memory, isdata. Text a source contains can never be promoted to an instruction by being retrieved; - its source (prompt, input, knowledge-base version, tool, memory, history), the retrieval and transform that produced it, and the digest of its content (the content is not stored in the manifest);
- for payload loaded from a knowledge base or memory, the authorization decision id of the recorded
context.readallow that let it be loaded: a segment without one is refused (unauthorized_payload), and storing the manifest checks each id against the recorded decision (an allow, of that action, for this run, of that exact source:knowledge_base:<kb>@<version>ormemory:<reference>, decided no later than the manifest). A decision authorizes a read, not a step, so any step of its run may cite it; - the omitted and redacted items and the token allocation (
budget,used,instruction,data;usedis the sum of the segments and may not exceed the budget).
Storing also checks that the run exists and that the record's scope and project are the deployment's and the run's, and stores only canonical bytes. content_digest is a plain SHA-256 of the content, so a short, guessable value (a yes/no, an id) can be confirmed offline by anyone who can read the manifest: treat the record as evidence for the project's members and platform administrators, and do not expose it more widely without a keyed digest.
Reading a manifest back (read_context_manifest) re-checks the digest, the schema (an unknown schema_version is unknown_version, never read as the nearest) and every rule above, so a reordered or relabelled record is caught twice, by its digest and by its positions. Refusals carry a stable code: invalid_manifest, unknown_version, tier_violation, unauthorized_payload, ordering, tokens, authorization_rejected, duplicate_revision, revision_gap, rule_bundle_changed, rule_bundle_unavailable, rule_bundle_mismatch, rule_bundle_unpinned. Nothing here talks to a provider.
Recorded for every agent step (B07.3b, #710). For an admitted run in the reference profile the worker hands the runtime a recorder (caliber.context.assembly.context_recorder_for, built together with the source guard, or alone for a run whose manifest pins a rule bundle), and the runtime calls it with each agent step's initial context (the step's instructions as resolved when it is assembled, its skills, its history and the one input the provider is sent, with the node whose edge delivered it) before any of it reaches the provider, for every agent, every handoff target (a native Agents SDK handoff runs inside the provider call, so every agent the step may reach is recorded first) and in child workflows too. The recorder labels the assembly: the agent's own instructions are the only instruction tier; the history is one history data segment; text a knowledge query delivered straight to the agent is retrieved_text (one segment per version it read, citing the context.read decision the guard recorded when it authorized that version); the run's own input is user_input; any other text is tool_output of the node that delivered it, or of unknown origin (an item a for_each, loop or error_boundary hands an inline agent, text a knowledge query's output reached only through another node), which is still data and is never labelled the run's own input. It builds, validates and stores the manifest (its own short transaction, committed) as revision 1 of a fresh step request. If it cannot (an unknown or unauthorized source, a refused manifest, a database failure) the step does not run: the node fails (a for_each item or an error_boundary does not absorb the refusal), the run ends context_denied and the provider was never called. A document that says "ignore all previous instructions" is therefore recorded as data and reaches the agent as input, never as part of its instructions (scenario V03).
Non-agent model calls covered by B07.6. A knowledge-query node's answer-synthesis call uses the same recorder before the OpenAI or Anthropic provider is called. Its resolved system prompt, bounded history, exact user prompt (including the retrieved answer context), knowledge-base source and context.read decision are recorded against the knowledge node's occurrence and attempt. A missing source decision refuses before the provider is touched. The same boundary is used for each retrieval mode, so multiple synthesis calls become ordered revisions of the same node occurrence rather than an unlinked side channel.
LLM-backed guardrail judges use the same pre-call recorder when they run inside a governed workflow. The criterion and the response/evidence they judge are recorded as data against the guardrail node and attempt; deterministic guardrails do not create a model-call manifest.
Caps and redaction (B07.4, #719). caliber.context.manifest.pack_context(segments, caps=..., redactor=...) is the one pure function that decides what an agent step's context may contain, and build_context_manifest records its result (omitted, redacted and sections=). It redacts every data-tier segment with the PII redactor (the same one the audit log uses, CALIBER_PII_REDACTION_*; an instruction is the operator's own text and is never altered) before the digest is taken, so the manifest hashes what the provider is given and the matched text is never recorded: a changed segment gets one redacted entry (fields: ["content"], reason: "redactor:pattern-1,pattern-3", naming which rules fired); a segment that is nothing but the replacement marker is dropped and listed in omitted as redacted. It caps the retrieved and history sections at the caps the caller passes (parse_section_caps(config.context_section_caps), from CALIBER_CONTEXT_SECTION_CAPS: JSON, default {"retrieved": 4000, "history": 2000}; only those two names are accepted and each cap is a positive integer, else the service refuses to start; a section left out is uncapped): chunks are kept in order while they fit, and the first chunk that does not fit and every later one in that section (they rank below it) is dropped and listed in omitted with reason token_budget and its tokens. The manifest's token_allocation.sections records each capped section's cap_tokens and used_tokens, and the manifest refuses a record where they do not add up to its segments. Example: with a cap of 10 and three retrieved chunks of 8 tokens, the manifest keeps the first chunk and lists two as token_budget; a chunk containing alice@example.com has its digest taken over the text with [REDACTED] in its place (the text itself is never stored). Not yet applied to a live step: the agent-step adapters (B08) call pack_context to decide what the provider receives. The recorder above (B07.3b) records the context as the runtime passes it and does not pack it, so until B08 consumes it no provider input is capped or redacted and the manifests it writes carry no sections; a manifest never claims a cap or a redaction that was not applied. The issue's draft names (allocation, redactions, budget) map onto the shipped v1 record (token_allocation.sections, redacted, token_budget), which is kept so manifests already written stay valid.
The rule bundle at context use (B07.5b, #736). A run admitted with a rule bundle has its path and SHA-256 in the run manifest (see "Admitting a run"); the run manifest is immutable and nothing here writes it. For every agent step the recorder reads the pin from that manifest, never from the current configuration, re-reads the bytes at the recorded path, re-hashes them on every step (nothing is trusted from an earlier step) and compares the hash with the recorded digest; only then are the bytes parsed (caliber.context.rules.rule_bundle_reference). The parse and the manifest entry are cached by the verified digest (a bounded LRU of 8 bundles): a digest is the hash of exactly one byte string, so a hit can only be the bundle those bytes parse to, and the cache never replaces the read and the hash. The step's context manifest then carries a rule_bundle entry: the bundle's bundle_id, version and sha256, and for each selected rule its rule_id, its source_ref (provenance) and the SHA-256 of its text (the rule text itself is not stored). Every rule of the operator-pinned bundle is selected, in bundle order. rule_bundle_reference also hands back the verified in-memory bundle (VerifiedRuleBundle.bundle): the B08 adapters must take rule text from that object and never reopen the path, so the text a provider is given is the text whose digest the manifest cites.
Storing the manifest checks the cited digest against the run manifest read from the database: a run admitted with a bundle cites it in every step, a run admitted without one cites none (a bundle enabled later is never applied to it, and no pin is backfilled). That store check is only the digest comparison; the rest of the entry (id, version, per-rule fields) is not re-derived there, because the store cannot re-read the file. The recorder, which verified the bytes the entry was built from, is the trust boundary for it.
A run that has a rule bundle is recorded even when it has no source guard (no approved sources required, no context.read grant); in that case no knowledge-base text is labelled retrieved_text (no source was authorized) and a query's text is tool_output of its node. Read tool_output there as "the output of this node", not as proof that the text did not come from a knowledge base: with no guard the platform did not authorize or label the source. So a path or configuration change after admission cannot alter what the run uses: the run uses the admitted bytes or is refused.
Size cap. A context manifest is bounded to 1 MiB and every step cites the bundle, so admission refuses a bundle whose citation (the canonical JSON of the entry above) exceeds 256 KiB (262144 bytes): rule_bundle_refused, with the size and the cap in the message and none of the file's content. A citation takes about 116 bytes per rule plus the UTF-8 length of its rule_id and source_ref (a CJK character is 3 bytes). Measured: 1000 rules with 100-character ASCII source refs take 217 KB (admitted); 150 rules with 512-character CJK source refs take 248 KB (admitted); 200 such rules take 331 KB and 1000 rules with 512-character ASCII source refs take 629 KB (both refused at admission, though the loader accepts the files). Shorten the source_ref values or split the bundle. A bundle admitted before this cap that is over it but under the manifest's 1 MiB bound keeps working; one over the bound fails every step with manifest_invalid.
| run error | meaning and recovery |
|---|---|
context_denied with rule_bundle_changed | the bytes at the pinned path are no longer the admitted bytes (an edit, even a comment or whitespace; a replaced file; a file larger than 1 MiB): the step did not run and no context manifest was written. The run stays failed: restoring the file does not revive it. Resubmit: the new run is admitted against the current CALIBER_RULE_BUNDLE_PATH and CALIBER_RULE_BUNDLE_SHA256, so after an intentional edit update both together first (a path with a stale digest is refused at admission) |
context_denied with rule_bundle_unavailable | the pinned file is missing, not a regular file, unreadable, or the run manifest's pin is unusable. This includes a pinned path that existed when the run was admitted and is gone on the node that executes it (see "Which path is pinned"). The run stays failed; resubmit once the bundle is readable at the path a new admission will record |
rule_bundle_refused at admission (409 manifest_refused) | the configured bundle's bytes are missing, changed or invalid, or its citation is over the 256 KiB cap: fix the file or the pinned digest, or shorten the bundle; no run is created |
context_denied with rule_bundle_mismatch / rule_bundle_unpinned | a context manifest cited another bundle than the run's admitted one, or a bundle for a run admitted without one (the store refuses it; this indicates a defect, not an operator action) |
Example. A run is admitted with CALIBER_RULE_BUNDLE_PATH=/etc/caliber/rules.yaml; an operator then appends a comment to the file. The worker's next agent step ends the run failed with error code context_denied and the summary rule_bundle_changed: the run's pinned rule bundle cannot be used now (digest_mismatch); the provider was never called and the run's manifest is untouched. Deleting the comment does not revive that run: it stays failed. Submitting the same request again creates a new run, admitted against whatever CALIBER_RULE_BUNDLE_PATH / CALIBER_RULE_BUNDLE_SHA256 say at that moment (the restored file with the old digest works; an intentionally edited file needs its new digest set together with the path). Changing those settings affects only runs admitted afterwards. The entry records provenance and digests, not the rule text: delivering rule text to the provider is the agent-step adapters' job (B08), as for caps and redaction, so a manifest never claims text was given that was not.
Which path is pinned. Admission records the symlink-resolved absolute path, and the worker that executes the run reads exactly that path. It must therefore exist, with the same bytes, on every node that can execute the run, for as long as the run can still take a step. Mounts that rotate their real directory break this: a Kubernetes ConfigMap or Secret volume serves rules.yaml -> ..data/rules.yaml where ..data points at a ..data_<timestamp> directory that is replaced and deleted on every update (and a Docker secret or a per-node temporary path differs between nodes). A run admitted before such a rotation records the old directory, which is gone, and its next step is refused as rule_bundle_unavailable. The run manifest's pin shape is immutable (#680, #726) and is not changed to work around this. Mount the bundle so its resolved path is stable and identical on every node.
Rollout. An in-place edit or rotation of the bundle file fails every in-flight or waiting run admitted against the old bytes at its next agent step. Use versioned, content-addressed file names (for example rules-<first 12 hex of the sha256>.yaml), publish the new file next to the old one, switch CALIBER_RULE_BUNDLE_PATH and CALIBER_RULE_BUNDLE_SHA256 together, and keep the old file in place until the runs admitted against it have drained (finished or failed).
Deploying the rule_bundle field. Adding rule_bundle to the context manifest is a readers-first change: an API pod or worker still running the previous release rejects a stored manifest that carries it (invalid_manifest, the v1 schema is closed). Roll the new release to every pod that reads context manifests before any worker running it can record one for a bundle-pinned run (or drain bundle-pinned runs first); do not mix releases while bundle-pinned runs are in flight.
Model calls outside a live workflow run (for example, offline evaluation and deploy-gate scoring) remain outside this runtime manifest boundary. Token counts are an accounting estimate (four characters a token, and the recorded budget is the larger of the configured one and the total); enforcing a budget on a provider call is B08. Legacy runs and development have no recorder.
Refinement-job creator provenance (B06.1, #731)
caliber_refinement_jobs.triggered_by is the optional provenance field for the principal that caused a refinement job to be created. It is a VARCHAR(256) and records a declared creator when the creation path has one; it is not an authorization grant and it is not evidence that a candidate may be applied. The apply boundary must still recheck the current project permission, distinct approver and exact candidate digest. A NULL value is therefore unknown provenance, not permission to proceed.
The reference-profile rule for an unknown creator is explicit human review or quarantine before an apply decision. The schema slice itself adds no new runtime refusal code and does not silently rewrite an existing job. Since B06.3 the Apply route enforces it: with the two-person rule on (always, in the reference profile) a job with no recorded creator is refused (apply_creator_unknown) and cannot be applied in place; there is no reviewed-provenance override yet. Recovery is to create a new job through a path that can declare its creator and have a different account apply that; do not infer a principal from timestamps, owners or other mutable fields.
Migration 0131 adds the nullable column with no backfill, so every legacy row reads NULL and old readers remain compatible. Deploy the migration before enabling writers that populate the field. Downgrade removes only the optional provenance value, leaves the job row and all other pipeline state intact, and there is no API/SDK schema change in this slice because RefinementJobSchema does not expose ORM-only columns automatically.
B06.2: authenticated creator writes
The four producer-owned CaliberRefinementJob constructors now populate triggered_by from the resolved server identity: prompt optimization, skill calibration, workflow calibration, and assistant prompt-promotion proposals. When a request carries a CaliberIdentity, its user_id is authoritative; the route actor is retained only for direct internal callers that do not have a request identity. Prompt, skill, workflow, and assistant metadata are not creator authority, and client-supplied owner or creator values cannot replace the authenticated requester.
This is provenance, not permission: apply still rechecks the current project permission and, under the two-person rule below (B06.3), the distinct approver, and the claim now rechecks both, with the exact candidate digest, inside its own transaction (B06.4, below). Rows written before B06.2 remain explicitly unknown (triggered_by = NULL); with the two-person rule on they cannot be applied in place (apply_creator_unknown), so create a new job via a path that can declare its requester. No new migration or public API/SDK field is required because migration 0131 introduced the column and it remains an ORM-only field.
Apply: a distinct approver (B06.3, #747)
CALIBER_APPLY_REQUIRE_DISTINCT_APPROVER (apply_require_distinct_approver, default false) is the two-person rule for POST /ajax-api/2.0/mlflow/caliber/jobs/{job_id}/apply. With it on:
the job's triggered_by | the authenticated caller | result |
|---|---|---|
| a different account | holds caliber.operator and release.apply on the job's project | applied, as before |
the caller (compared trimmed and case-folded, so @Reza is not a second person to @reza) | any | 403, reason_code apply_self_approval |
NULL, empty or blank (a legacy job, or a creation path that declared no requester) | any | 403, reason_code apply_creator_unknown |
Where the identities come from: the requester is the job row's triggered_by, written from the authenticated request identity when the job was created (B06.2); the approver is the authenticated caller of the Apply request. Neither is read from the request body, query string or model output, and the setting is server configuration, so a client cannot turn the rule off or name a different requester.
The reference profile. The setting must be on: CALIBER_PROFILE=reference refuses to start without it (apply_distinct_approver_disabled, in the table above). The rule is also applied at request time whenever the profile is reference, whatever the flag says, so a process that somehow reached a request in that state still refuses, and an unreadable configuration is treated as the reference profile.
Development compatibility, separately. With the default profile and the flag off, Apply behaves exactly as it did in the alpha: the requester may apply their own candidate and a legacy job with no recorded requester is applied. That is a declared development-only compatibility, not a reference behaviour; a single-operator install that turns the flag on cannot apply its own jobs and needs a second operator.
Refusals are 403 with a static, payload-free message (no job id, account name, candidate text or digest) and a stable reason_code:
{"detail": "the account that requested this candidate cannot apply it; a different authorized person must apply it", "status_code": 403, "reason_code": "apply_self_approval"}
{"detail": "this candidate has no recorded requester, so a distinct approver cannot be verified; re-run the calibration so it records its requester, then have a different authorized person apply it", "status_code": 403, "reason_code": "apply_creator_unknown"}
Both refusals happen after the project-permission check (a non-member still gets 404, a member without release.apply still gets 403 without a reason code) and before the claim, the approval anchor and the promoter call, so a refused Apply changes no job, approval or release state: the job stays candidate_ready. Since B06.4 the refusal is recorded in the audit log (below). The claim repeats the check on the row-locked job with the same helper, and the database enforces the same separation inside the atomic claim (UPDATE ... WHERE status = 'candidate_ready' and the requester, trimmed of ASCII whitespace and lower-cased, is neither NULL, blank nor equal to the caller, trimmed and lower-cased the same way), so a requester that changed after the check, even to a case or whitespace variant of the caller, still cannot claim. The SQL lower-casing is ASCII-only on SQLite; the check before the claim applies the full case-fold. If the server has no configuration object at all, the rule is applied as in the reference profile rather than failing the request.
Recovery. apply_self_approval: ask a different account with release.apply on the project to apply it. apply_creator_unknown: the job has no verifiable requester and there is no reviewed-provenance override yet: the job is refused, never passed. Re-run the calibration through the prompt, skill or workflow path, which records the requester, and have a different account apply the new job. (An assistant promotion proposal also records its requester, but it is created awaiting_approval, not candidate_ready, so it is not a job this route applies.) Do not set triggered_by by hand from timestamps, owners or other mutable fields. The refusal catalogue, with the recovery for the requester and for the operator, is in Apply: refusal catalogue, audit and recovery.
Apply: the claim rechecks everything (B06.4, #753)
Apply authorises at the start of the request, but the decision that matters is the one at the claim, the write that moves the job from candidate_ready to applying and commits the approval anchor before the promoter runs. Inside that transaction the route now locks the rows the decision rests on and rechecks, on what it locked, in this order:
| order | recheck | refusal |
|---|---|---|
| 1 | the job still exists | 404 |
| 2 | the caller still holds release.apply on the job's project and can still see the job (membership, role, project owner and the agent's project are read after being locked) | 403, reason_code apply_permission_revoked |
| 3 | the two-person rule above, when in force, with the same apply_separation_refusal helper as the early check | 403, apply_self_approval or apply_creator_unknown |
| 4 | the job is still candidate_ready | 409, no reason_code (the existing status conflict) |
| 5 | the candidate about to be promoted is the one that cleared the eval gate | 409, apply_candidate_changed, or apply_candidate_unverified when no digest was recorded |
Lock contention anywhere in the claim transaction (a lock wait that runs out, a deadlock this transaction loses, or on SQLite a busy timeout) is 503 apply_busy (below). After the claim UPDATE, rows 2 and 5 are checked once more before anything is committed (see SQLite, below).
The exact candidate. When the eval gate passes, the stage that moves a job to candidate_ready stores the SHA-256 of the candidate's canonical JSON on the job (caliber_refinement_jobs.candidate_digest, sha256: plus 64 hex digits; migration 0132). The claim recomputes the digest of the candidate it is about to promote and refuses on any difference. The approval anchor's candidate_snapshot, which is what the promoter reads, is taken from that same locked row and checked against the recorded digest once more before anything is committed, so the digest names exactly the content that is promoted even on a database without row locks. The recorded digest also appears in the apply_candidate audit row, so a promoted version can be traced to the exact content that was evaluated. The check applies in every profile: it is an integrity check, not the two-person policy. A job with no recorded digest is refused (apply_candidate_unverified), never trusted.
No gap between check and write. On PostgreSQL the job is locked FOR UPDATE and its agent, project and the caller's membership row FOR SHARE before anything is read for the decision, in that order, and the conditional UPDATE of the claim still carries the status, the recorded digest and (when the rule is on) the requester predicate. A revocation or a candidate edit that is mid-transaction when the claim starts makes the claim wait and then refuse; one that arrives while the claim is in flight waits for the claim to commit, so the apply that passed its checks is the apply that was authorised. Two concurrent applies cannot both claim: the second waits and sees applying. The waits are bounded by a fixed 5 second lock_timeout (not a setting); a wait that runs out, a deadlock in which PostgreSQL aborts this transaction as the victim, or on SQLite a busy timeout is answered 503, reason_code apply_busy, retryable, with nothing decided or written and no audit row.
What SQLite does and does not cover. SQLite has no row locks and ignores the FOR UPDATE / FOR SHARE clauses, so the recheck's answer is not held between the recheck and the claim: a grant can be revoked on another connection in that gap. Two things close it. The claim UPDATE is conditional (status, recorded digest, requester), and once it has run, and so holds SQLite's single write lock, the route reads the caller's authority again and verifies the candidate snapshot against the recorded digest before anything is committed; a failure rolls the claim back (apply_permission_revoked / apply_candidate_changed). What remains is the interval after that check and before the commit, during which SQLite's write lock keeps other writers out. This is the development profile; the reference profile requires PostgreSQL, where the row locks above are what is relied on.
Refusals are static and payload-free (no job id, account, digest or candidate text):
{"detail": "the candidate is not the one that was evaluated; nothing was applied, re-run the evaluation and apply the new candidate", "status_code": 409, "reason_code": "apply_candidate_changed"}
{"detail": "your permission to apply candidates in this project is no longer in force; nothing was applied", "status_code": 403, "reason_code": "apply_permission_revoked"}
{"detail": "this candidate has no recorded evaluation digest, so it cannot be verified; nothing was applied, re-run the evaluation so it records one", "status_code": 409, "reason_code": "apply_candidate_unverified"}
{"detail": "this candidate is being changed or applied right now; nothing was applied, retry shortly", "status_code": 503, "reason_code": "apply_busy"}
Audit (#1050). Each of the five refusals listed here, all of which come after the project-permission check (apply_self_approval, apply_creator_unknown, apply_permission_revoked, apply_candidate_changed, apply_candidate_unverified) writes one apply_refused audit row, severity high, on the job, with the caller as actor and {"reason_code": ...} as its only detail. It is written in a transaction of its own after the attempt is rolled back, so the refusal still changes no job, approval or release state, and a failure to write it is logged without turning the refusal into a 500. The existing 404 and role 403 of the early project-permission check, and the status 409, write nothing. There is no rate limit on these rows beyond the platform's request limits: only an authenticated caller holding release.apply can produce one.
Recovery. apply_candidate_changed and apply_candidate_unverified: the content or its evidence is not what was evaluated. Re-run the evaluation (a new candidate, or a request for changes) so the gate records a fresh digest, then apply. Do not edit candidate_digest by hand: the digest is evidence of what was evaluated, and a hand-written one defeats it. apply_permission_revoked: ask a project owner to restore the grant, or have an authorised account apply it.
Upgrade and limits. Migration 0132 is additive, but not safe for a mixed-version rollout: a job that an old process moves to candidate_ready after the upgrade records no digest, and the new Apply refuses it (apply_candidate_unverified, with no override). Drain old writers (the workers that run the eval stages) before migrating, or re-run the evaluation of any job they finish in the window. The migration backfills candidate_digest for jobs that are candidate_ready or applying at upgrade time from their current candidate, since that is the only evaluated candidate such a row can name (a trust-on-upgrade step: an edit made before the upgrade is not detectable); every other row stays NULL, and a job without a candidate stays NULL and is refused at Apply. Rolling back drops only the column. The digest covers the candidate content, not the evaluation results stored beside it, and it is not a defence against someone who can write to the database and rewrite both the candidate and the digest: it catches an edit after the gate by any path that does not also re-record the gate's evidence. The permission recheck covers the project grant and visibility; the caller's platform scopes come from the request's credential as resolved at its start.
Apply: refusal catalogue, audit and recovery (B06.5, #762)
This is the operator and integrator view of the whole Apply chain: one place for what the two sections above specify piece by piece. It was written from routes/jobs.py (apply_job, _recheck_claim, _verified_claim_snapshot, _refuse_apply), apply.py (the reason codes and their static messages), routes/_job_access.py (the locks and the timeout) and candidate_digest.py. Every body below is the real response of the route under the test client (tests/test_apply_distinct_approver.py and tests/test_apply_claim_recheck.py set up each case), copied from a run, apart from the ids and timestamps that differ on every run.
The request. POST /ajax-api/2.0/mlflow/caliber/jobs/{job_id}/apply needs the caliber.operator scope and release.apply (owner or editor) in the job's project. It reads no field of the body: the requester is the job's stored triggered_by and the approver is the authenticated caller, so a body, query string or header that names someone else changes nothing. jobs.apply(job_id) in the SDK posts the same request.
curl -sS -X POST -H "Authorization: Bearer $CALIBER_TOKEN" \
"$CALIBER_BASE_URL/ajax-api/2.0/mlflow/caliber/jobs/$JOB_ID/apply"
The setting, by profile
| profile | CALIBER_APPLY_REQUIRE_DISTINCT_APPROVER | at startup | at request time |
|---|---|---|---|
| development (the default) | false (the default) | starts | rule off: the requester may apply their own candidate and a job with no recorded requester is applied (development compatibility only). The candidate digest check still applies |
| development | true | starts | rule on |
reference | true | starts | rule on |
reference | false or unset | refuses to start with the ConfigError shown below (violation code apply_distinct_approver_disabled) | rule on whatever the flag says, if a process ever reached a request in that state |
| no configuration object on the app | n/a | n/a | treated as the reference profile: rule on |
The startup refusal is multi-line, one line per violation. With this the only violation it reads:
reference profile refused (1 violation):
- apply_require_distinct_approver is false; set CALIBER_APPLY_REQUIRE_DISTINCT_APPROVER=true for the reference profile [apply_distinct_approver_disabled]
The rule is server configuration, not something a request can switch. A single-operator install that turns it on cannot apply its own jobs and needs a second account that is an operator and holds release.apply.
Order of the checks
- Project gate (
load_visible_job):404when the job does not exist or the caller cannot see it,403(noreason_code) when the caller is a member withoutrelease.apply. Nothing is written. - Early two-person check, rule on only:
403apply_self_approvalorapply_creator_unknown. Audited. - The claim transaction starts. On PostgreSQL it sets the 5 second
lock_timeoutand locks the rows (below).503apply_busyif a lock is not granted in time or this transaction is chosen as a deadlock victim (and, on SQLite, if the write lock is not granted within the busy timeout, which surfaces at the claimUPDATEor the commit rather than here). Nothing is decided or written. - On the locked rows (when the recheck passes but the claim
UPDATEstill matches no row, the answer is the uncoded409it changed while being claimed):404if the job is gone,403apply_permission_revokedif the caller no longer holdsrelease.applyor can no longer see the job, the two-person check again (rule on),409when the status is notcandidate_ready, then the digest check:409apply_candidate_unverifiedorapply_candidate_changed. - The conditional
UPDATE(statuscandidate_ready, the recorded digest and, rule on, the requester predicate) claims the job; then permission and digest are checked once more before the commit. - The claim and the born-approved approval anchor commit, then the promoter runs (intent first).
Permission is checked before separation on purpose: a caller whose grant is gone gets the permission refusal, never a separation code that would confirm who requested the job. The status 409 is checked before the digest 409, so a job that is already applied or applying is a plain status conflict whatever its candidate is.
Refusal catalogue
reason_code | HTTP | audited | what it means | requester | operator |
|---|---|---|---|---|---|
| (none) | 404 | no | the job does not exist, or the caller is not a member of its project (the response never says which) | check the job id and the X-CALIBER-Project header | add the caller to the project if they should act on it |
| (none) | 403 | no | the caller is a member without release.apply (a viewer or reviewer): project role 'viewer' cannot perform release.apply | ask a project owner for the editor or owner role | grant the role |
apply_self_approval | 403 | yes | the caller is the account that requested the job (compared trimmed and case-folded, so @Reza is not a second person to @reza) | ask a different account that is an operator with release.apply to apply it | nothing to repair; do not edit triggered_by, and do not turn the rule off under the reference profile |
apply_creator_unknown | 403 | yes | the job has no recorded requester (a legacy job: triggered_by is NULL or blank), so a distinct approver cannot be verified; there is no override | start a new calibration (it records its requester) and have a different account apply the new job | the old job cannot be applied in place; do not infer a requester from timestamps or owners |
apply_permission_revoked | 403 | yes | the early checks passed, then the caller's grant went away before the claim: membership removed or deactivated, role lowered, the agent moved to another project, or the project's ownership changed | wait for the grant to be restored, then apply again | restore the grant, or have another authorised account apply it |
| (none) | 409 | no | the job is not candidate_ready (already applied, applying, running, and so on): job 'RFN-A' cannot be applied: current status is 'applying' (expected 'candidate_ready'). Also, rarely, job 'RFN-A' cannot be applied: it changed while being claimed: the conditional claim UPDATE matched no row although the locked read passed (a race SQLite leaves open), and the recheck that follows found no more precise refusal | read the job; do not retry while it is applying; after it changed while being claimed, read the job and apply again if it is still candidate_ready | an applying job is in flight or is settled by the release reconciler; the janitor returns a stranded one to candidate_ready |
apply_candidate_unverified | 409 | yes | the gate recorded no digest for the job (written by a process that predates migration 0132, or not digestible), so the candidate cannot be verified | ask for another pass | send the job back for another pass (POST /jobs/{job_id}/request-changes) or start a new calibration, so the gate records a digest; see "Finding unverified jobs" below |
apply_candidate_changed | 409 | yes | the candidate about to be promoted is not the one that cleared the eval gate (edited since, emptied, or not digestible) | ask for another pass | find out who edited it, then send the job back (request-changes) or recalibrate so the new candidate is evaluated and its digest recorded |
apply_busy | 503 | no | another transaction held a lock this claim needed, so nothing was decided: on PostgreSQL a row lock was not granted within 5 seconds (SQLSTATE 55P03, another claim or a membership, project, agent or candidate edit holds it), or this claim was the victim of a lock-order deadlock (40P01); on SQLite another connection held the write lock for the whole busy timeout (30 s, database is locked) | retry shortly; the SDK does not retry a POST for you | if it persists, on PostgreSQL look for a long-open transaction on caliber_refinement_jobs or the agent, project or membership rows (pg_stat_activity) and for writers that take those rows in another order (pg_stat_database.deadlocks counts the deadlocks); on SQLite find the process holding the database file |
The 404 and the role 403 write nothing because they are the project gate that every job route shares and they are answered before the claim; the status 409 and the 503 are not a decision about the caller or the candidate. The five coded refusals that are a decision about this caller and this candidate are audited (#1050).
Real bodies
A different account applies a candidate that cleared the gate (200; this is the response of a simulated promoter, so simulated is true, and the approval id and the timestamp change on every apply):
{"data": {"job_id": "RFN-A", "status": "applied", "promotion": {"artifact_ref": "prompt://support-agent/v-fake", "rotated_at": "2026-10-31T19:39:30.111843+00:00", "details": {"alias": "prod", "approval_id": "AP-95e24f7c"}, "bundle_size": 1, "bundle_results": [{"agent_id": "support-agent", "artifact_type": "prompt", "artifact_ref": "prompt://support-agent/v-fake"}]}, "simulated": true}}
The same job applied a second time (409, no reason_code):
{"detail": "job 'RFN-A' cannot be applied: current status is 'applied' (expected 'candidate_ready')", "status_code": 409}
A member who is only a viewer (403, no reason_code), and a caller who is not a member (404):
{"detail": "project role 'viewer' cannot perform release.apply", "status_code": 403}
{"detail": "refinement job 'RFN-A' not found", "status_code": 404}
The requester applies their own job with the rule on (403); a different account can then apply the same job, because the refusal changed nothing:
{"detail": "the account that requested this candidate cannot apply it; a different authorized person must apply it", "status_code": 403, "reason_code": "apply_self_approval"}
The bodies of the other coded refusals (apply_creator_unknown, apply_candidate_changed, apply_candidate_unverified, apply_permission_revoked and apply_busy) are the ones shown in the two sections above. None of them holds a job id, an account, a digest or candidate text, and a test asserts that none of those strings is in a body.
From the SDK the status picks the exception and reason_code names the case; it is None for the uncoded 404, 403 and 409:
from caliber_sdk import CaliberConflictError, CaliberPermissionError, CaliberServerError
try:
caliber.jobs.apply(job_id)
except CaliberPermissionError as exc:
if exc.reason_code in {"apply_self_approval", "apply_creator_unknown"}:
... # a different authorised account must apply it
elif exc.reason_code == "apply_permission_revoked":
... # the grant is gone; ask a project owner
else:
raise # the role 403 (no reason_code)
except CaliberConflictError as exc:
if exc.reason_code in {"apply_candidate_changed", "apply_candidate_unverified"}:
... # send the job back for another pass; do not retry the same job
else:
raise # the status 409
except CaliberServerError as exc:
if exc.reason_code != "apply_busy":
raise
... # retry after a short wait: nothing was decided
What is audited
Each of the five refusals marked audited in the catalogue writes one apply_refused row, in a transaction of its own after the attempt is rolled back. A refused attempt changes no job, approval or release state (a test asserts that the job is still candidate_ready, the promoter was not called and no approval row exists). The row is:
| column | value |
|---|---|
action | apply_refused |
actor | the caller who was refused |
entity_type, entity_id | refinement_job, the job id |
severity | high |
details | {"reason_code": "apply_self_approval"}: the code only, never a digest, the requester or candidate text |
Read them with GET /ajax-api/2.0/mlflow/caliber/audit-log?action=apply_refused (admin scope; entity_id, actor and since also filter it). A refusal that cannot be recorded is logged and is still the typed refusal, never a 500. An applied job's apply_candidate row carries the evaluated candidate_digest, and a failed promotion writes apply_failed. Not audited: the project gate (404 and the role 403), the status 409 and apply_busy.
The candidate digest
The digest binds an Apply to the exact candidate the gate cleared. It is sha256: plus 64 lowercase hex digits (71 characters) of the candidate's canonical JSON (sorted keys, no insignificant whitespace, ASCII only; NaN and Infinity have no form), so key order and storage format do not matter. It is written by the three stages that move a job to candidate_ready (the prompt and skill eval stage, the workflow deploy gate and the workflow calibration gate), recomputed by the claim from the locked row, and compared once more against the snapshot the promoter reads.
| covered | not covered |
|---|---|
everything in the job's candidate object (content, rationale, diff summary, promotion type, and any other key) | eval_results and diagnosis beside it, and the job columns the promoter also reads: bundle_targets, skill_name, artifact_type, agent_id |
the content that reaches the promoter, because the approval anchor's candidate_snapshot is verified against the digest before the commit | the live registry at apply time (the promoter's own conflict check and the release operation handle that) |
| nothing in a refusal: the digest is never written to a refusal row or a response | someone with database write access who rewrites both candidate and candidate_digest |
It is an integrity check, not the two-person policy, so it applies in every profile and whether or not the flag is on. candidate_digest is an ORM-only column: it is not in the API or the SDK models.
Locks, order and the timeout
On PostgreSQL the claim transaction takes, in this fixed order: the job FOR UPDATE, then its agent, the agent's project and the caller's membership row in that project, each FOR SHARE. Concurrent applies do not serialise on the shared locks; any writer of those rows (a revocation, a role change, a candidate edit, an ownership transfer, an agent move) waits for an in-flight claim, and a claim waits for an uncommitted one. The wait is bounded by SET LOCAL lock_timeout = 5000 (5 seconds, fixed, not a setting). A wait that runs out (SQLSTATE 55P03) rolls the transaction back and answers 503 apply_busy with nothing written and no audit row, and so does a deadlock in which PostgreSQL picks this claim as the victim (SQLSTATE 40P01). The mapping wraps the whole claim transaction, from the locks to the commit of the claim and its approval anchor (_lock_contention_is_busy), not only the lock statements. Any other database error is not mapped and propagates as a server error. The claim commits before the promoter runs, so the locks are never held across the provider call and the waits are short; a database error after that point is the promotion's own failure path, not apply_busy.
For developers: a transaction that takes more than one of these rows must take them in the same order (job, agent, project, membership). The opposite order can deadlock against Apply: PostgreSQL aborts one of the two transactions with DeadlockDetected (SQLSTATE 40P01), and either side can be the victim. When Apply is the victim it answers 503 apply_busy like a lock timeout (is_lock_contention recognises both), with nothing written; the other transaction, if it is yours, continues, so a writer that must not be retried should expect the deadlock error itself. An Apply that answers 500 is not one of these lock cases (a serialization failure, SQLSTATE 40001, is deliberately not mapped and also answers 500): check the job's status before retrying, because an error after the claim committed can leave the job applying for the release reconciler. The busy 503s (apply_busy, approval_busy) carry Retry-After: 1.
SQLite and PostgreSQL
| guarantee | PostgreSQL (required by the reference profile) | SQLite (development) |
|---|---|---|
| two concurrent applies | the second waits on the job lock and sees applying | the conditional UPDATE matches no row for the second |
| a grant revoked while an Apply is in flight | the revoking write waits for the claim, or the claim waits and refuses: no gap | not closed by locks: the route reads the caller's authority again after the claim UPDATE, while SQLite's single write lock is held, and rolls back with apply_permission_revoked; between that check and the commit only the write lock protects it |
| a candidate edited after the gate | the job lock makes the edit wait, or the claim refuse | the snapshot the promoter reads is verified against the recorded digest after the claim UPDATE and before the commit (the UPDATE's predicate matches the candidate_digest column, not the candidate content, so an edit to the content is caught by the snapshot check) |
apply_busy | yes, on a lock timeout or a deadlock victim | yes, on a busy timeout: SQLite has no row locks to wait for, so database is locked (30 s) surfaces at the claim UPDATE or the commit and is mapped to apply_busy |
| a lock-order deadlock (a transaction that takes the rows in another order) | PostgreSQL raises DeadlockDetected (SQLSTATE 40P01) in one of the two transactions, either side can be the victim; a victim Apply answers 503 apply_busy | not applicable |
allowed under CALIBER_PROFILE=reference | yes | no (sqlite_database refuses startup) |
The permission recheck covers the project grant and the job's visibility. The caller's platform scopes (caliber.operator) come from the credential as resolved at the start of the request.
Deploying migration 0132
Migration 0132 adds the nullable candidate_digest column and backfills it for jobs that are candidate_ready or applying from their current candidate. It is additive for the schema and not safe for a mixed-version rollout of the writers.
- Stop every process that can move a job to
candidate_ready, as step 1 of Upgrading already asks (the server and the workers), so no old writer is running after the migration. - Run
caliber-migrate. The new release reads the column on every job query, so it must not start before this, and the old release must not write jobs after it. - Start the new release on every node.
A job an old process moves to candidate_ready after 0132 has no digest, and the new Apply refuses it with apply_candidate_unverified; there is no override, by design. The same holds for a job finished by an older release that is running again after a code rollback (the column stays and the old release does not fill it). The backfill is trust-on-upgrade: an edit made to a waiting candidate before the upgrade cannot be detected, because the current content is the only evaluated candidate the row can name. Rolling back the migration drops only the column.
Finding unverified jobs (read-only, on the CALIBER database):
SELECT job_id, agent_id, status FROM caliber_refinement_jobs
WHERE status = 'candidate_ready' AND candidate_digest IS NULL;
Each row needs another evaluation pass: POST /jobs/{job_id}/request-changes (a reviewer, editor or owner with the operator scope; it returns the job to running at the candidate stage, and the gate that follows records a fresh digest) or a new calibration. Never write candidate_digest by hand.
How this relates to the workflow approval chain
Apply is not the workflow approval chain, and the two rules are set separately:
| Apply | workflow protected-effect approval | |
|---|---|---|
| what is decided | promoting a refinement job's candidate (POST /jobs/{job_id}/apply) | a protected effect proposed by a workflow step (caliber_runtime_approval_requests) |
| record | a born-approved CaliberApprovalRequest (caliber_approval_requests) minted by Apply as the rollback and provenance anchor | a request bound to one proposal's intent_hash, with expiry, supersession and a policy digest (below) |
| second person | CALIBER_APPLY_REQUIRE_DISTINCT_APPROVER, apply_separation_refusal: trimmed and case-folded, an unknown requester is refused | CALIBER_APPROVAL_ALLOW_SELF_APPROVAL, assert_distinct_actor: exact comparison, an unknown initiator is not compared |
| rechecked at commit | the caller's current project permission and the exact candidate digest, inside the claim | the exact intent, evidence, policy, expiry, supersession and downstream version, at the dispatch boundary |
The reference profile requires both settings. An Apply never decides a workflow approval request, and a workflow approval never applies a job.
Approval requests: bound to the exact intent (B06.1, #706)
A protected effect is approved by a person, and the approval has to say what it approves. create_approval_request (caliber/src/caliber/workflows/approval_requests.py) records a pending row in caliber_runtime_approval_requests that is bound to one effect proposal and to what the approver is shown (ADR 0003 approval_request; migration 0127). It runs in the caller's transaction and never commits. The decision routes answer it by naming its runtime_approval_id (B06.4, #735, below); the dispatcher consumes the decision. A request has a lifetime and is replaced by a newer one for the same step (see "Expiry" and "Supersession", B06.2, #712).
- What is bound.
proposal_id, the proposal's fullintent_hash(sha256:and 64 hex digits, the digest every consumer reuses), itsexpected_resource_version(the downstream version the approval is valid for, orNULL), theevidence_hashof what the approver is shown, thepolicy_digest,requested_byandexpires_at(now + ttl_seconds, UTC). The record is validated againstapproval_request.v1.jsonbefore the row is stored (risk_classis the proposal's effect class; every response is allowed:approve,reject,request_changes). Values are read from the stored proposal, never from the object the caller holds. - The node's own policy. The caller passes the node's
ApprovalPolicy(required). It is stored as the request'spolicy_snapshotexactly as the decision route reads it back (ApprovalPolicy.from_snapshot), so a node that needscaliber.adminwith a quorum of two, or a deployment that allows self-approval, is enforced as configured.policy_digestis computed (policy_digest(policy):sha256:and the SHA-256 of the canonical JSON of the snapshot) and cannot be supplied. It pins the policy as requested, not the approvers a quorum accumulates in the same snapshot afterwards. A policy the runtime cannot honour (unknown role, a count below 1,escalateorauto_reject, a non-boolean flag) isbad_field. - Only a
proposedproposal. Any other state (already approved, dispatched, committed, failed, unknown or reconciled) raisesApprovalRequestError("proposal_not_proposed"), aValueErrorwhose message is that code; nothing is stored. A proposal that does not exist isproposal_not_found. A malformedevidence_hash(notsha256:and 64 lowercase hex digits), arequested_bythat is blank, has leading or trailing whitespace, is over 256 characters or holds a control, zero-width or bidirectional character, attl_secondsthat is not an integer from 1 to 31 536 000, or anowthe expiry cannot be computed from (a date at the end of year 9999, not a datetime) isbad_field, and the message names the field. The one-year ceiling is a policy choice (a request open longer is a caller's mistake), not a configuration value or a storage limit. - Expiry (B06.2, #712).
expires_at = requested_at + ttl_seconds. The ttl is the caller's argument; a deployment's default isCALIBER_APPROVAL_TTL_SECONDS(approval_ttl_seconds, default 86400, 1 to 31 536 000), which the caller reads withconfigured_ttl_seconds(config). A change affects only requests created afterwards. Expiry is computed, never stored: nothing sweeps a request into anexpiredstatus, so a request that expires stayspending(orapproved) in the list, and refusing it writes nothing. The rule isapproval_refusal(status=, superseded_by=, expires_at=, now=)(approval_policy.py, database-free). The clock is the application's (datetime.now(timezone.utc), the same clock that wroteexpires_at), not the database's: one request is never judged by two clocks, and a test can fix it. The window is half open,[requested_at, expires_at): atexpires_atitself the request is already expired, so it is never usable one tick longer than its ttl (one microsecond earlier it is not). Servers that share a database need synchronized clocks, as for every other deadline here; a clock that runs behind lets a request live that long past its expiry. A request with noexpires_at(a legacy, node-level one) never expires. - Supersession (B06.2, #712). In the transaction that inserts a request, every other live bound request for the same
(workflow_run_id, node_id)becomesstatus = "superseded"withsuperseded_byset to the new request's id: a request that ispending, orapprovedand not yet consumed (consumed_atunset), whether it names the same proposal or a later one of the node (a changed intent or version). It is atomic with the new request: if the caller rolls back, the older one is live again. Left alone: a request for another node or another run, a legacy request (it binds no intent a change could void), a rejected one, a consumed one, and one already superseded (itssuperseded_byis never rewritten, so superseded requests form a chain). Onlystatusandsuperseded_bymove; the binding the approver saw and any decision already recorded stay on the row, unusable. The requests a call replaced are those whosesuperseded_byis the returned request's id. The newer request is the one whose creator took the run lock later (commit order), not the one with the laterrequested_at. - Refusal codes (
reason_codeof the 409; the vocabulary ofdocs/architecture/approval-ux-contract.md, which replaces theapproval_expiredandapproval_supersededthe plan named).supersededwhen the request was replaced (statusissupersededorsuperseded_byis set),expiredwhen the clock is at or pastexpires_at. Superseded is reported first, so a replaced request that is also expired says it was replaced (the current request is the thing to decide). - Locking. Creators take the run row, then the proposal row, both
FOR UPDATE(a no-op on SQLite, whose write transaction is exclusive), in that order. The run lock is what makes supersession safe: creators for different proposals of one node lock different proposal rows, so without it each would read the other's request as absent and leave two live ones. Creators for one proposal and the proposal's own state transition serialize on the proposal row: a proposal moving toapprovedeither commits before the creator reads it (the creator refuses) or waits for the creator's transaction. The requests being superseded are readFOR UPDATE, predicate included, so a decider or a consumer that holds one finishes first and a request it consumed is not overwritten. Whatever decides or consumes a request must lock that request's rowFOR UPDATEand re-runapproval_refusalon what it read before writing (taking the run row first if it takes both). All locks last until the caller commits or rolls back, so a caller keeps its transaction short; the run lock also briefly holds up other writers of that run's row. - The binding is a database fact. A row is either legacy (every binding column
NULL) or fully bound, never half-bound in either direction (ck_runtime_approval_bound); the three hash and digest columns are exactly 71 characters (ck_runtime_approval_digest_length); and a BEFORE UPDATE trigger (SQLite and PostgreSQL) refuses any change toproposal_id,intent_hash,evidence_hash,policy_digest,expected_resource_version,expires_atandrequested_by: a request cannot be re-bound to another intent, nor a legacy row bound after the fact.status, the decision columns,policy_snapshot,superseded_byandconsumed_atstill move. PostgreSQL also enforces the proposal foreign key (SQLite does not enforce foreign keys in this repository). - Decision versus commit. The decision routes (
approveandreject) record an explicit decision for a request that has aproposal_id, but never consume it. For a bound request they answer409with areason_codeand a static message that carries no id, hash, requester or approver, and write nothing, foralready_consumed,superseded,expired,approval_not_currentandalready_decided(B06.2/B06.4, above and below). This is intentional: the HTTP decision is not effect consumption. At the dispatch boundary B06.3'sapproval_valid_at_commitrechecks the exact stored proposal, evidence and policy pins, expiry, supersession, consumption, and the current downstream version before any connector call. It then calls the B03.4 identity path, which invokesdecidewith the run manifest's original subject, workload, purpose, run id and grant id. The actual approver is checked separately against the current required platform scope, active project membership/approval role and separation-of-duties policy; the approver is never substituted into the run's grant. The dispatcher in B04.1 consumes the still-locked request only after this validator succeeds. The validator returns stableintent_mismatch,expired,superseded,role_revokedandstale_versioncodes (plusself_approval,not_approved,already_consumed,not_foundandauthority_unavailablefor their distinct failure states), and does not call a downstream connector. The default selection (noruntime_approval_id) ignores bound rows, so a legacy node-level request is never shadowed by a newer bound one. The list endpoint still shows bound rows (with theirstatus; it does not yet exposeexpires_atorsuperseded_by, which the approvals UI, #743, adds). A request that expires is not turned into a proposal state (the proposal staysproposed, so ask again). - Legacy rows stay valid. A node-level approval that guards no proposal keeps
NULLin every new column and is decided exactly as before. - Migration.
0127adds nine nullable columns, a foreign key, two checks, an index and the trigger (on PostgreSQL a function pinned to the schema); no backfill. Downgrade drops the trigger and function, the checks, the index and the columns; a legacy request is untouched and a bound one is lost. It needs0126(B05.5b) to be applied first. B06.2 adds no migration:expires_at,superseded_byandconsumed_atare already in0127(the trigger letsstatusandsuperseded_bymove), so there is no schema change, rollback or deployment step beyond the new optional settingCALIBER_APPROVAL_TTL_SECONDS.0134(B11.3c, #1061) adds one nullable column,commit_decision_id(the policy decision the dispatcher's commit check recorded in the claim that consumed the request), and two triggers that make it write-once and settable only by consumption (see the causal-links section); it adds the column in place, so the0127trigger is kept, and it does not backfill. Downgrade drops the triggers, their functions and the column. - Distinct actors. The separation-of-duties rule of
record_approvalis nowassert_distinct_actor(actor, initiated_by, *, allow_self)(approval_policy.py): it raisesApprovalPolicyError("the account that triggered this run cannot approve it; a second person must decide ...") when the actor is the initiator, unlessallow_self(CALIBER_APPROVAL_ALLOW_SELF_APPROVAL) is set; an unknown initiator is not compared.actor_provenance.require_distinct_actorsand the assistant service's author/reviewer checks are not delegated to it: they raise another error type, compare objects or other parties and have noallow_self, so sharing one function would change behaviour their callers pin.
from caliber.workflows.approval_policy import ApprovalPolicy
from caliber.workflows.approval_requests import ApprovalRequestError, create_approval_request
try:
request = create_approval_request(
session,
proposal=proposal,
policy=node_policy, # the node's ApprovalPolicy; stored as the snapshot, digested into policy_digest
evidence_hash=evidence_digest, # "sha256:" + 64 hex digits
requested_by="editor_a",
ttl_seconds=86400,
)
except ApprovalRequestError as refused:
# refused.code is "proposal_not_proposed", "proposal_not_found" or "bad_field". For proposal_not_proposed the proposal has already
# moved on: read its state, do not ask again for the same intent. Nothing was stored, so there is nothing to undo.
...
session.commit() # the caller owns the transaction; the proposal row stays locked until then
Deciding such a request through the API (the same answers for approve and reject). A live request that the caller may decide answers 200 and records the decision (approve answers status: pending with remaining_approvals until the node's quorum is met). The refusals write nothing:
POST /ajax-api/2.0/mlflow/caliber/workflow-runs/{run_id}/approval/approve {"runtime_approval_id": "<bound request>"}
# replaced by a newer request for the step (B06.2). Recovery: decide the current request of the step; list the run's approvals and take the
# newest one that is `pending`.
409 {"detail": "this approval request was replaced by a newer request and can no longer be decided; decide the current request for this step",
"status_code": 409, "reason_code": "superseded"}
# at or past expires_at (B06.2). Recovery: ask for a new approval of the step (create a new request, which also replaces this one); the
# proposal is unchanged and still `proposed`.
409 {"detail": "this approval request has expired and can no longer be decided; ask for a new approval of the step",
"status_code": 409, "reason_code": "expired"}
# already consumed by the dispatcher; the decision is terminal and cannot be changed (a late reject does not fail the run).
# Recovery: none needed; read the proposal's state (`dispatched`, `committed`, `unknown`) and let the reconciler settle it.
409 {"detail": "this approval decision was already consumed by dispatch",
"status_code": 409, "reason_code": "already_consumed"}
# approved or rejected already (an approval waits for the dispatcher to consume it). Recovery: none; resume the run (POST .../resume) if it is
# still parked behind an approval.
409 {"detail": "this approval request already holds a decision and cannot be decided again; an approval is consumed when its effect is dispatched",
"status_code": 409, "reason_code": "already_decided"}
# the request belongs to another node than the one the run waits at. Recovery: decide the request of the node the run is waiting at.
409 {"detail": "this approval request is not for the step the run is waiting at",
"status_code": 409, "reason_code": "approval_not_current"}
# a lock is held too long (PostgreSQL lock_timeout, 5 s), the decision lost a deadlock (40P01) or SQLite stayed busy (database is locked): nothing was decided or held. Recovery: retry shortly.
503 {"detail": "this approval is being decided or dispatched right now; nothing was decided, retry shortly",
"status_code": 503, "reason_code": "approval_busy"}
# the caller requested this approval (or started the run) and self-approval is not enabled: a second person must decide.
403 {"detail": "the account that triggered this run cannot approve it; a second person must decide (set CALIBER_APPROVAL_ALLOW_SELF_APPROVAL=true for a single-operator install)"}
What the dispatcher answers when it later claims the decision (EffectRefused.code; the approval stays unconsumed and no backend is called): not_approved (not decided yet, rejected, or fewer recorded approvers than the quorum), already_consumed, expired, superseded, role_revoked (an approver's scope, project role or membership changed since they decided, so the quorum is no longer met), self_approval (an approver is now the run's initiator or the requester), intent_mismatch, stale_version, lease_lost / stale_owner (the captured execution-owner lease is no longer the held one). Recovery for each is to ask again (a new request) or to let the current owner retry; a retry after the claim committed is already_dispatched and sends nothing.
Creating a replacement, with the deployment's window:
from caliber.workflows.approval_requests import configured_ttl_seconds, create_approval_request
request = create_approval_request(
session,
proposal=changed_proposal, # a later proposal of the same node; the older live request becomes superseded
policy=node_policy,
evidence_hash=evidence_digest,
requested_by="editor_a",
ttl_seconds=configured_ttl_seconds(config), # CALIBER_APPROVAL_TTL_SECONDS, default 86400
)
session.commit() # the older request's status and superseded_by are written in the same transaction
For a decision endpoint that only needs the lifecycle code, the pure rule remains:
from caliber.workflows.approval_policy import approval_refusal
code = approval_refusal(
status=row.status, superseded_by=row.superseded_by, expires_at=row.expires_at, now=datetime.now(timezone.utc)
) # "superseded", "expired" or None; call it on the row read FOR UPDATE, in the transaction that acts on it
The B06.3 commit validator is the producer-owned boundary used by the dispatcher:
from caliber.workflows.approval_policy import approval_valid_at_commit
checked = approval_valid_at_commit(
session,
approval_id=approval.runtime_approval_id,
proposal_id=proposal.proposal_id,
approver_scopes=current_approver_scopes,
current_resource_version=downstream_version, # required for versioned targets; omission fails closed
evidence_hash=current_evidence_hash,
)
# Keep the run, proposal and approval locks until the same transaction consumes
# approval and claims dispatch. No connector is called by this function.
The approval panel: what the approver sees and what the console obeys (B06.5, #743)
A person deciding a bound request has to see what they are approving. The console shows it in an inline approval panel under Recovery Diagnostics of a run (ApprovalDecisionPanel, opened by BoundApprovalReview) for every bound request that is pending, or approved and not yet consumed. A legacy node-level request (no proposal_id) keeps the plain Approve and Reject buttons it always had; for a bound one those header buttons are not shown, because they would approve it unseen. The panel reads one record, GET /workflow-runs/{run_id}/approvals/{approval_id} (caliber.workflows.approval_view), and decides nothing itself.
Who may read it. The access of reading the run (a run you cannot see is 404) plus the project read role, evaluated now. A caller who fails either, an approval of another run and an unknown id all get the same 404. A caller who also holds the project approve action (owner or reviewer) sees the effect and who requested it; anyone else with read access sees the pins, the state and the quorum, proposal is null and binding.requested_by is null (deliberate: the view is a project-read surface and shows any reader a request's state, as the list route already showed its status and who decided; the decision routes still tell a caller who may not decide nothing about the state, because they check authority before state). The SDK reads it as client.workflows.runs.approval(run_id, approval_id), untyped like approvals(). The list route (GET .../approvals) gains optional proposal_id, expires_at, superseded_by and consumed_at, so the console can tell a bound request from a legacy one; an older client ignores them. They follow the view's rule: filled only for a caller with the project read role, null for anyone else (the rest of the list is unchanged).
What it returns.
| Field | Content |
|---|---|
binding | proposal_id, intent_hash, evidence_hash, policy_digest, expected_resource_version, expires_at, requested_by, superseded_by, consumed_at; null for a legacy request |
proposal | connector, connector_version, effect_class (the risk class: read only, reversible write, irreversible write or data export), resource, state, and the shape of the arguments: each top-level name (only when it is a plain identifier, otherwise unnamed) and the kind of its value, at most 50 |
policy, quorum | the node's required_role, approval_count, timeout_behavior, allow_self_approval; who approved so far, how many are required and how many remain |
state | open, or why the request cannot be decided now, most final first: already_consumed, superseded (with superseded_by), expired, rejected, run_not_waiting (a rejection and a cancellation both clear the run's current node, so they are named before the node is compared), approval_not_current (another node's request of a waiting run), already_decided |
allowed_responses | the decisions the routes accept now: approve and reject. request_changes is in the contract but has no route, so it is not offered |
caller | the authenticated principal, and for approve and reject whether it is allowed now and, when not, the first reason: the request's state, a disabled deployment switch (queue_disabled, approvals_disabled, and for an approval checkpointing_disabled, which the routes check first and answer with a plain 409), project_role_required, insufficient_scope, self_approval or duplicate_approver |
No argument value ever leaves the server. The arguments are the one place a secret or a personal datum can sit, the platform's other operator views never load them, and the intent_hash binds every value, so the panel shows names, kinds and counts and says that the values are pinned by the digest. Showing values needs a connector-owned preview that redacts, which does not exist yet; the console does not guess at one. Nothing in a response is logged by the console, and a refusal message is chosen from the reason_code the server sent, with values from the view, never from response text.
The server decides, the console renders. caller is computed with the decision routes' own rules (the project approve action, the node's required_role scope, the requester and run-initiator rule, one approval per person) and the panel only disables a button from it (aria-disabled, with the reason attached through aria-describedby, so the button stays focusable and the reason is read). The route re-derives everything under its locks, so a stale panel cannot approve what the server would refuse. A decision sends {runtime_approval_id, reason} and nothing else; who decides is the authenticated principal.
Refusals, with the text the panel shows and the recovery (the decision route's 409 codes arrive as reason_code; the ability reasons arrive in the view):
| Code | Where it comes from | Panel text (abridged) | Recovery |
|---|---|---|---|
expired | view state, 409 on decide | "This request expired at 2026-11-01 14:30 UTC. Nothing was done. Ask the requester to send it again." | ask for a new request |
superseded | view state, 409 | "A newer request replaced this one (RAP-...). Open the newer request." | decide the newer request (linked when it is on the page) |
already_decided | view state, 409 | "This request already holds a decision ... waiting for the system to act on it." | nothing; dispatch consumes it |
already_consumed | view state, 409 | "This approval was already used to run the action." | ask for a new request if needed again |
approval_not_current | view state, 409 | "This request is not for the step the run is waiting at." | decide the run's current request |
run_not_waiting | view state | "This run is no longer waiting for approval ..." | none |
approval_busy | 503 on decide | "This request is being decided or dispatched right now. Nothing was decided. Wait a moment, then press the button again." | press again; the buttons stay live |
self_approval | view ability | "You started this run, so you cannot approve it. A second person must decide." | a second person decides; Reject stays available |
duplicate_approver | view ability | "You already approved this step. It needs 2 different approvers; 1 more is needed." | another approver decides |
queue_disabled, approvals_disabled, checkpointing_disabled | view ability | "Deciding approvals is switched off for this deployment ..." | an administrator enables the switch (checkpointing_disabled blocks only Approve) |
insufficient_scope, project_role_required | view ability | "This step needs the caliber.approver role and your account does not hold it ..." | ask for the role |
a network failure or any other 5xx | decide | "We could not confirm whether your decision was recorded ... check it before deciding again." | the panel refetches; it never retries by itself, because a retry would answer duplicate_approver |
Not built, stated plainly. The contract's stale_version, intent_mismatch, fenced_owner and role_revoked messages are in the panel and render when a reason_code of that name reaches it, but today the platform refuses those only at dispatch (effect.approval.commit_check span, EffectRefused), never as the answer to a decision, and the view cannot read them back: there is no persisted commit-time refusal to show (the causal-links route says as much). The view does not carry the target's current state, a before-and-after preview (both need a connector query operation), requested_by_type (the platform has no principal type yet; the requester's id is shown), evidence_url (there is no evidence package yet) or the policy decision's reason codes. request_changes and a intent_hash in the decision body are not implemented in the routes. Approving the last required approval does not resume the run: the run stays waiting_approval until someone with the operator role resumes it, and the panel says so.
What the browser checks cover. The Playwright spec asserts roles, accessible names and descriptions, keyboard order, focus and the announced text with role and name queries and an accessibility-tree snapshot. The repository has no axe integration, so there is no automated colour-contrast or rule-engine audit of the panel; contrast follows the console's existing slate, amber and red palette and has not been measured.
Configuration, migration and rollback. No new setting, no migration and no stored data change. The view is read-only and the list fields are optional additions. Rolling back is reverting the change; a console without it ignores the new list fields and keeps the plain buttons.
Agent steps: a request, a result, and no effects (B08.1a, #713)
An agent step is one bounded unit of model work in a workflow node. Two control records (ADR 0003) describe it, and caliber.contracts.agent_step is the gate in front of both: it validates a record and refuses it before anything is dispatched. This page is the contract; the adapters that produce results (B08.1b onwards), the limit enforcement (B08.3) and the token reservation (B08.4) build on it and are not part of it.
agent_step_requestv1 names the step (step_request_id,workflow_run_id,node_id, the durableoccurrence_idand theattempt), what it was given (run_manifest_digestandcontext_manifest_digest, each 64 lowercase hex digits), the onegrant_idit runs under and itslimits:max_turns,max_tool_calls,max_tokens(integers, zero allowed) and adeadline(RFC 3339 with an offset, ASCII digits, at most nine fractional digits, no leap second;StepLimits.deadline_atis the awaredatetime, and nothing reads the clock). The platform enforces the limits, not the adapter. Every identifier is not blank and has no control character or lone surrogate, the rule the effect proposal applies.- The step and its id. The platform allocates one
step_request_idfor one(run, node, occurrence, attempt)tuple; the context manifest of the step carries the same id. A result must repeat the id and the tuple: one whose tuple matches but whose id differs, or whose id matches but whose tuple differs, is refused. agent_step_resultv1 answers it: the same five identifying fields, astop_reason(completed,proposed_action,max_turns,max_tool_calls,max_tokens,deadline,refused,error), the provider'susageand at most oneproposed_actionselement, present exactly when thestop_reasonisproposed_action. Optional:usage_source(providerwhen absent,estimated,unknown) anderror_code(a short lowercase token, only witherrororrefused).- One proposed action per step, in v1. A logical effect is keyed by
(run, node, occurrence), so a second action would share the first's key. The array stays so a later version can carry more, but only after it adds a per-action identity. - A step proposes; it never says anything happened. The result has no
state,receiptorapprovalfield and every schema is closed, so a result that claims a commit (state: committed, areceipt_id,stop_reason: committed) is refused like any other unknown field or value. An action becomes a recorded proposal only throughcaliber.effects.records, andcommittedthere still needs a verified receipt. - What the model says is a claim, not a fact. Everything in a result is model output. In particular a proposed action's
effect_classandconnector_versionare untrusted: a model can call an irreversible writeread, and areadcan be approved by policy alone.ProposedAction.bound_to(inventory_effect_class)returns the action carrying the platform's class (from the protected-effect inventory) and raisesClaimMismatch(codeclaim_mismatch) when the claim differs; the platform calls it (caliber.effects.step_proposal, B08.2) beforerecord_proposal, and an action that is notplatform_boundis never recorded. - One action shape for the step and the proposal. A proposed action is
effect_class(read,reversible_write,irreversible_write,export),target(connectorandresource),connector_version,argsandexpected_resource_version: the names and meaning they have in theproposalrecord.ProposedAction.intentis the verycaliber.effects.records.Intentof that proposal andProposedAction.intent_hashitssha256:digest, so what a step proposed, what an approver is shown and what a receipt answers are one digest. An action is immutable (argsis a read-only deep view;intentandrecord()are fresh copies, so nothing handed out can make the stored arguments disagree with the digest) and equal to another exactly when their canonical intents are ({"a": True}is not{"a": 1}). Parsing builds each intent, soargsthat are too deep (more than 64 levels), too large (the intent is at most 256 KiB) or not plain JSON are refused here too, not later at the store. - Usage and the token reservation.
usage.total_tokensis what a budget settles against: it may not be less thanprompt_tokens + completion_tokens, andcached_prompt_tokensmay not exceedprompt_tokens. When a call failed or the provider gave no usage, reportusage_sourceestimatedorunknownrather than figures that look genuine. A refused or malformed result does not release the step's token reservation: the reservation ledger charges the whole reservation for it. - Integers are integers.
1.0is not an integer for these two kinds;attempt: 1.0is refused, not coerced.
from caliber.contracts import ContractValidationError, UnsupportedSchemaVersion
from caliber.contracts.agent_step import parse_step_request, parse_step_result
request = parse_step_request(request_record) # raises before any provider or tool is touched
try:
result = parse_step_result(result_record, request) # the request is required: a result is read as its answer
except UnsupportedSchemaVersion:
... # a newer writer: refuse the step and upgrade this reader first, never read it as v1
except ContractValidationError as refusal:
print(refusal.errors) # the violations, by path and rule; nothing was dispatched
else:
for action in result.proposed_actions:
bound = action.bound_to(inventory_effect_class) # the platform's class, or ClaimMismatch
print(bound.intent_hash) # submit as a proposal; the effect is still unperformed
Refusals are quiet. For these two kinds a refusal names the field and the rule, never the offending value, an unexpected property name or an unbounded amount of text: at most 20 violations are listed, an unsupported version is named only when it is a short plain token (else by its type), and a record of more than 1 MiB of JSON text (1048576 characters) is refused before it is validated. Other record kinds keep their messages. Refusals and what to do (ContractValidationError.errors, sorted by path):
| the record has | refused as | recover by |
|---|---|---|
schema_version: "v2" (or anything but v1) | UnsupportedSchemaVersion: agent_step_result schema_version v2 is not supported; supported: v1 | upgrading the reader before the writer (ADR 0003, readers before writers) |
a field it does not define (state, receipt_id, a typo) | <record>: additional properties are not allowed (proposed_actions/0: ... inside an action; the property is not named) | removing the field; a step reports no state |
stop_reason: "committed" | stop_reason: is not one of ['completed', 'proposed_action', ...] | reporting completed or proposed_action; a commit is the proposal's, with a receipt |
effect_class: "write" | proposed_actions/0/effect_class: is not one of ['read', 'reversible_write', 'irreversible_write', 'export'] | using one of the four classes of the connector inventory |
an action with no target | proposed_actions/0: 'target' is a required property | naming the connector and the resource |
| two or more actions | proposed_actions: violates maxItems 1 | proposing one effect per step; the next is the next occurrence |
proposals with stop_reason: "completed", or proposed_action with none | proposed_actions: must equal [] or proposed_actions: violates minItems 1 | stopping with proposed_action exactly when there is a proposal |
attempt: 1.0, a blank or control-character identifier | attempt: must be of type integer, node_id: does not match the required pattern | integers and printable identifiers |
| a total below the parts | usage/total_tokens: is less than prompt_tokens + completion_tokens | reporting the provider's total (or usage_source: "estimated") |
| a result for another step | step_request_id: names another step than the request's, although run, node, occurrence and attempt are the same (or <field>: differs from the request's, although step_request_id is the same) | applying only the result of the request that was asked |
| an action whose class the platform does not hold | ClaimMismatch: the step claimed effect_class 'read'; the platform's is 'irreversible_write' | proposing nothing: the step's claim is discarded, the platform's class governs |
A result that is refused is the end of that step's use of it: nothing was proposed, recorded or dispatched, and the retry is the same occurrence_id with the next attempt. A parse_* call is pure: it does not read the clock, so the deadline and the other limits are checked by the platform around the provider call (B08.3), not here.
Agent step adapters: the boundary every provider answers through (B08.1b, #720)
caliber.workflows.agent_step is the seam between the agent-step contracts above and a model provider. It adds no route, no table and no setting. It defines what an executor must do to take part in governed execution and how the platform treats the answer; the limits (B08.3), the token reservation (B08.4) and turning a model's tool call into a recorded proposal (B08.2) build on it.
AgentStepAdapter(caliber.workflows.runtime.AgentStepAdapteris the same protocol) isrun_step(request: AgentStepRequest, step_input: AgentStepInput) -> AgentStepResult, a plain function (anasync defis refused).AgentStepInputcarries theagent, itsinput_textandhistory, thehandoff_agentsit may hand off to andread_tools: the callables of the tools the platform classifiedreadin the protected-effect inventory (filter_read_tools(tool_callables, is_read)applies one classification, fails closed, and is what the platform uses for the step and for each handoff target). That is the only set of tools an adapter may run. Every name must be a tool bound to the agent, a tool the model calls that is not in the set is proposed (B08.2), never run, and an adapter cannot invoke a protected tool because it was never given one. Each handoff target is aStepHandoffTarget(agent, read_tools)holding only its read-class callables: the runtime's own handoff maps, which carry every callable of the target, are refused by type. Construction copiesread_tools,historyand the handoff targets into read-only containers, so neither side can change what the other holds. An adapter repeats the request'sstep_request_idand its run, node, occurrence and attempt; it never says an effect happened (the result has no field for that) and answers a provider failure with a typed result, not an exception.run_agent_step(adapter, request, step_input)is the one entry the platform calls, and it trusts nothing the adapter does:- the request is validated first (
parse_step_request(request.record())) andstep_input.agentmust be the request's node; either failure raisesContractValidationErrorand the adapter is not called; - an object without
run_step, or whoserun_stepreturns a coroutine (closed, never awaited), is refused (adapter_unsupported); - what the adapter returns must be exactly an
AgentStepResultholding exactly the contract's types (no subclass of the result,StepUsageorProposedAction, nostrorintsubclass in a field, a tuple of actions): a subclass can overriderecord()or answer differently each time it is read, so none is asked anything. The platform then takes one plain snapshot of the record (a JSON round trip, no hook, no NaN) and reads only that snapshot throughparse_step_result(snapshot, request): schema, every proposed action's intent, and that it answers this step. No method of an adapter-supplied object runs after the snapshot, the platform returns a result it rebuilt, andProposedAction.platform_boundis false on every action (an adapter cannot mark a claim as bound); - an exception, a timeout, a return that is not a result, or a result that fails step 3 becomes an
errorresult with a fixederror_code. No exception text and no provider payload is placed in a result or a log line; the exception's class name and the step id are logged, and a result dropped as malformed logs the usage numbers it reported.BaseException(KeyboardInterrupt,SystemExit,asyncio.CancelledError,GeneratorExit) propagates.
- the request is validated first (
- Refusals and failures keep the reservation. A
refusedorerrorresult the boundary creates carries zero usage withusage_source: "unknown": "the provider may have been called and nothing is known", never "nothing was used". The ledger charges the whole reservation for each of them, and for anyBaseExceptionthat escapes it leaves the reservation open at its whole ceiling, because the provider call may have happened.NOT_CALLED_CODES(adapter_unsupported,adapter_not_integrated) mark a body that never ran, but the ledger does not infer "not called" from a result an adapter could write itself: the platform decides before it reserves (an executor that is not an adapter, and a stepbefore_work_stopstops, reserve nothing), and every reservation it does take is kept. - Timeouts. The boundary maps
TimeoutError(asyncio.TimeoutErroris the same class from Python 3.11) toadapter_timeoutand nothing else; it does not know a provider's exception types. A provider adapter (#727-#730) catches its SDK's timeouts (openai, anthropic, httpx) and returnsfailure(request, ADAPTER_TIMEOUT)itself. FakeWorkflowExecutoris the scripted adapter (FakeWorkflowExecutor(step_script=[...])): deterministic, offline, no clock, no network, and it never runs a protected tool. An entry is aScriptedStep(answered with the request's identity;read_tool_callsrun named tools throughread_toolsonly, and a name outside it is refusedtool_not_read_classand not run), an exception (a staged provider failure the adapter returns aserror:adapter_timeoutfor aTimeoutError, elseprovider_error) or a callable returning a rawagent_step_resultrecord (read withparse_step_resultlike provider output, so a claimed commit or another step's result ismalformed_result, returned by the adapter itself). Entries are used in order, one per caller even under concurrency, and a script that runs out refuses withscript_exhausted; with no script every stepcompletedwith usage estimated from the input.fake.step_requestslists the requests it was asked.- The provider executors are integrated for governed execution (B08.openai-agents #728, B08.openai-chat #729, B08.openai-responses #730 and B08.anthropic #727). Each executor's
run_stepuses the shared typed step contract while itsrun_agentpath remains unchanged. The OpenAI Agents adapter loads the optional SDK lazily, runs only read tools, and returns protected calls as unbound proposals; its ordinary tests use a deterministic SDK stub and never call a live provider. - Conformance harness.
caliber.testing.agent_step_conformance(re-exported bycaliber/tests/agent_step_conformance.py) is what a provider adapter's tests plug into, and the conformance suite (B08.5 #769) runs every rule against each of the four provider adapters. An adapter supplies a driver that builds it with its provider transport stubbed to a scenario and whose stub callsctx.provider_called()each time the provider would be called.run_scenariochecks, throughrun_agent_step: the stub was reached; the asked step is answered; a protected-tool canary (behind the agent's tool binding andctx.tool_registry, never inread_tools) is never run; a proposal is built from the staged tool call and stays an unbound claim, and a model that lies about the effect class is aClaimMismatchatbound_to; a read tool runs throughread_tools;completesreports exactly the stubbed usage with sourceproviderand amax_*stop keeps it; and each of a provider error, a timeout, unreadable output, a claimed commit and another step's result is a boundederrorwhose code is the adapter's own (adapter_timeoutandmalformed_resultwhere they apply; the platform'sadapter_error,adapter_unsupported,adapter_not_integratedandscript_exhaustednever pass) and that the adapter itself, called directly, returned rather than raised. The planted payload is in neither the result nor any log record (loggers lowered to DEBUG). A driver may not declarecompletes,proposes_protected_toolorclaims_commitunsupported. An adapter that reads a clock against the request's deadline needs its driver to inject a fake one (the harness' default deadline,2026-10-26T09:10:00Z, is in the past), andbudget_exhaustedstages one turn that spent the budget (StepUsage(900, 100, 1000, 1, 0)). Each provider adapter's test file undertests/conformance/is its driver; each declaresanother_steps_resultunsupported (no provider's response carries the identity of the step it answers).
from caliber.workflows.agent_step import AgentStepInput, ScriptedStep, run_agent_step
from caliber.workflows.runtime import FakeWorkflowExecutor
fake = FakeWorkflowExecutor(step_script=[ScriptedStep("proposed_action", (action,)), TimeoutError()])
result = run_agent_step(fake, request, AgentStepInput(agent=agent, input_text=text, read_tools=read_only_tools))
if result.stop_reason == "proposed_action":
bound = result.proposed_actions[0].bound_to(inventory_effect_class) # the platform's class, or ClaimMismatch
Failures the boundary returns (all stop_reason error unless noted). Every result the boundary creates has usage_source: "unknown", no proposal and the asked step's identity; an adapter's own failure keeps the usage it reports. Recovery is always the same shape: the occurrence is retried as the next attempt, after the reservation of this one is settled (B08.4):
| the adapter | result | recover by |
|---|---|---|
| has no Agents SDK installed | refused, provider_unavailable | install the optional Agents SDK extra |
| has an Agents SDK below the adapter floor, or one missing a required capability | refused, sdk_incompatible | install openai-agents>=0.9.0; no ungoverned protected-tool fallback is attempted |
has no run_step, or an async def one | refused, adapter_unsupported | passing an AgentStepAdapter with a plain run_step |
| raises (a provider error, anything else) | adapter_error | reading the server log (the exception's class and the step id, never its text) and retrying as the next attempt |
times out (TimeoutError) | adapter_timeout | the call's outcome is unknown: retry as the next attempt; the reservation is kept |
returns a result for another step, a record with an unknown field (state, receipt_id), stop_reason: "committed", two actions, a bad effect class, usage that contradicts itself, a subclass or a non-plain value, or a non-result | malformed_result | none for this output: it was dropped (its usage numbers are in the log); check the adapter's transcription of the provider output |
| is a scripted fake that has no entry left | refused, script_exhausted | scripting one entry per step the test runs |
is a scripted step naming a tool outside read_tools | refused, tool_not_read_class | naming only read tools, or proposing the call |
An invalid request, or a step input for another node, is not a result: run_agent_step raises ContractValidationError (for example attempt: violates minimum 1) before anything runs. The request's limits are enforced by this boundary for every adapter (below). The interpreter reserves the step's tokens before calling it and settles them after (B08.4). Not covered here, so not claimed: a blocking adapter is not interrupted. The interpreter calls run_agent_step only for a plan that carries a governed-step context, and then records the proposal it returns (Governed agent steps: a protected action is a proposal).
OpenAI Responses governed step (B08.openai-responses, #730)
OpenAIResponsesWorkflowExecutor.run_step runs one bounded governed step through client.responses.create; the adapter is caliber.workflows.step_openai_responses and the existing ungoverned run_agent path is unchanged. It adds no route, table or setting; step_clock is an optional test clock, defaulting to UTC now.
- Tools. Read tools are offered with their normal Responses function schema and are executed only from
step_input.read_tools. Every other bound tool is offered with a strict proposal envelope (the tool's own arguments underargs, and optionalresourceandexpected_resource_version: no connector, version or class, B04.6) and is never executed. The first protected call becomes one unboundproposed_actionthat names the function the model called; unknown tools, extra fields (a volunteeredeffect_class,state,receipt_id) and malformed JSON aremalformed_result. A response mixing read and protected calls runs none of the reads. Follow-up read results use the Responsesprevious_response_id/function_call_outputprotocol. - Limits and usage. The adapter checks the request's turns, tool calls, token budget and deadline around each provider call, sends the remaining budget as
max_output_tokens, bounds the provider timeout and disables SDK retries. Provider input/output/ total usage and cached input tokens are summed over turns; missing usage is markedestimated, and a provider failure keeps usage from turns that returned with sourceunknown. - Failures. Provider timeouts are
adapter_timeout, other provider exceptions areprovider_error, malformed Responses output ismalformed_result, and a refusal message isrefusedwithmodel_refused. Provider text, tool names, arguments and exception messages are not copied to results or logs.
OpenAI Agents governed step (B08.openai-agents, #728)
OpenAIAgentsWorkflowExecutor.run_step runs one bounded governed step through the optional OpenAI Agents SDK; the adapter is caliber.workflows.step_openai_agents and the legacy run_agent path uses the same SDK capability guard. The SDK is loaded lazily through the executor and the ordinary conformance tests use a deterministic offline SDK stub.
- SDK floor. The
llmextra declaresopenai-agents>=0.9.0, the first release whoseFunctionToolsignature contains all capabilities this adapter passes:needs_approvalappeared in 0.8.0, whiletimeout_secondsandtimeout_behaviorfirst appear in 0.9.0. The callableAgent.tool_use_behaviorhook and itsToolsToFinalOutputResultreturn type are already present in 0.0.7 and remain in the current 0.24.0 release. A signature-based guard checks these capabilities before registering tools. If an older or vendor-modified SDK fails the check, the governed path returnsrefused/sdk_incompatiblebefore a provider call; the legacy path raises the typedOpenAIAgentsSDKCompatibilityError. CALIBER does not silently omit timeout or approval arguments and does not fall back to an ungoverned protected-tool call.
- Tools. Read tools are exposed with their normal function schema and are executed only from
step_input.read_tools. Protected tools are exposed with the strict proposal envelope (args, and optionalresourceandexpected_resource_version; no connector, version or class, B04.6). Their callback records the call and the name of the function called and returns a fixed acknowledgment; it never resolves or calls the protected binding. The first protected call becomes one unboundproposed_actionthat names the tool; malformed JSON, unknown envelope fields (effect_class,stateorreceipt_id) and invalid action values aremalformed_result. - Limits and usage. The request's deadline is checked before the provider call,
max_turnsis passed to the Agents Runner,max_tool_callsstops read callbacks before another read runs, and provider usage abovemax_tokensreturnsmax_tokenswith the usage retained. Provider input/output/total usage and cached input tokens are summed over raw SDK responses; when the SDK supplies no raw response usage, the adapter marks the bounded estimate asestimated. A read tool the platform refuses because the deadline has passed is not a tool failure: the step endsdeadline. The SDK takesmax_turnsfor the run andtool_use_behaviorfor everything else: the adapter passes a function that, after each turn's tools, ends the run for a recorded proposal, the tool-call limit, a spent token budget (>= max_tokens, as the other adapters) or the deadline, so the model is not asked again after any of them. The SDK is given no handoffs, and a read tool that raises ends the stepmalformed_resultwith the exception's text kept out of the result, the log and the model's context. The conformance suite checks all of it, andtest_agent_adapter_openai_agents_real_sdk.pyruns it on the installed SDK with a scripted model. - Failures. Provider timeouts are
adapter_timeout, other provider exceptions areprovider_error, unreadable SDK output or proposals aremalformed_result, a provider refusal isrefusedwithmodel_refused, an unavailable optional SDK isrefusedwithprovider_unavailable, and an SDK below the capability floor isrefusedwithsdk_incompatible. Provider text, tool arguments and exception messages are not copied to results or logs.
Results recover as for every governed step: a protected proposal proceeds to the approval/binding boundary, provider failures are retried as the next attempt with the reservation kept, and a missing or incompatible optional SDK is fixed by installing the Agents SDK extra at or above the declared floor rather than falling back to an ungoverned protected-tool call.
Anthropic governed step (B08.anthropic, #727)
AnthropicChatWorkflowExecutor.run_step runs one agent step through the Anthropic Messages API; the code is caliber.workflows.step_adapters.anthropic_chat and the executor's run_agent (the ungoverned loop every existing workflow uses) is unchanged. It adds no route, table or setting; the only new option is the executor's step_clock (a test's clock, default UTC now). It takes the step's request and AgentStepInput and answers with the typed result of the section above.
- Tools. Every tool of the agent is offered to the model, in two kinds. A read tool (a name in
step_input.read_toolswhose binding does not require approval) is offered with its own input schema, run only fromread_toolswhen called, and its result goes back to the model. Anything else is a proposal: it is offered with the proposal as its input (the tool's own arguments underargs, optionally theresourceit is asked to name and anexpected_resource_version; no connector, version or class, B04.6), is never run, and when the model calls it the step stops withproposed_actioncarrying that one action, which names the function called (ProposedAction.tool) and holds the placeholders for the connector, version and class. The model claims none of them: the platform binds them from that tool's trusted identity, and a model that volunteers one ismalformed_result. A call of a tool the agent does not have, or a proposal with a field the schema does not define (astateorreceipt_id, a model claiming that an effect happened), ismalformed_result. When one reply calls several protected tools, the first is proposed and the rest are dropped (v1 allows one action per step); parallel tool use is turned off in the request. A reply that mixes read and protected calls runs none of the reads. Handoff targets are not offered, and a structured-output schema is not applied (a step's result carries no output text). - Limits are those of the request, checked around every provider call (the platform checks them again, whatever the adapter reports: central step limits). Before a turn:
max_turns, then the deadline, then the tokens left, each a stop reason that keeps the usage so far; before each read tool:max_tool_calls(and the deadline); and no read tool is run when no turn is left to use its result. A call'smax_tokensis the smaller of the executor's cap and the tokens left, its timeout the smaller of the provider timeout and the time to the deadline, and the SDK's automatic retries are off (max_retries=0: a retry is the next attempt, which is reserved separately). Provider usage overmax_tokensis themax_tokensstop whatever the model said; a reply the provider cut off (stop_reason: "max_tokens") is one too, and a half-finished tool call in it is not acted on. A stop before any call reports zero usage withusage_source: "estimated"(nothing was called). - Usage is the provider's, summed over the step's turns, with
usage_source: "provider": prompt =input_tokens+cache_creation_input_tokens+cache_read_input_tokens,cached_prompt_tokens= the cache reads (absent when the provider reported none), completion =output_tokens,turns= provider calls,tool_calls= read tools run. - Nothing from the provider or the model reaches a result or a log line: no text, tool name, argument or exception message. The log carries the step id, the exception's class name, a fixed reason token and counts.
Results this adapter returns (recover as for any step: the occurrence is retried as the next attempt, after this one's reservation is settled, B08.4):
| the provider or model | result | recover by |
|---|---|---|
| calls a protected tool | proposed_action with one unbound action | binding it to the inventory's class (B08.2); nothing was run |
| calls a read tool | the tool runs from read_tools, the step goes on | nothing |
times out (TimeoutError, anthropic.APITimeoutError, an httpx/httpcore timeout) | error, adapter_timeout, usage of the turns that returned, source unknown | retrying as the next attempt; the outcome of the call is unknown and the reservation is kept |
| raises anything else (rate limit, 5xx, connection error) | error, provider_error, same usage rule | reading the log (class name and step id) and retrying as the next attempt |
| answers with an unknown stop reason, malformed blocks or usage, an unknown tool, a bad or state-claiming proposal | error, malformed_result, the usage that was readable | none for this output: it was dropped; check the model's tool schema and the agent's tool bindings |
refuses (stop_reason: "refusal") | refused, model_refused, usage provider | rephrasing the request, or another model |
| reaches a limit | max_turns, max_tool_calls, max_tokens or deadline, usage kept | raising the limit for the next attempt, or ending the node |
| has no client (the SDK is not installed) | refused, provider_unavailable, nothing was called | installing the anthropic extra (pip install caliber-suite[anthropic]) |
The OpenAI chat completions adapter (B08.openai-chat, #729)
OpenAIChatWorkflowExecutor.run_step runs one governed step through client.chat.completions.create (caliber/src/caliber/workflows/step_openai_chat.py). It uses the message building, reasoning-model handling (including the one retry of the 400 "function tools with reasoning_effort"), prompt-cache keys and tool-call execution helper run_agent uses, and run_agent itself is unchanged. It adds no route, table or setting; the one new constructor argument, step_clock (a callable returning an aware datetime, default the UTC clock), is what a step's deadline is read from.
- Read tools run only from
step_input.read_tools. Any other tool the model calls is never run: it is a proposal. A protected tool is offered to the model with a proposal envelope as its parameters:args(the tool's own arguments) and optionallyresourceandexpected_resource_version. The model is asked for no connector, connector version or effect class (B04.6, #768): the proposal carries the name of the function it called (ProposedAction.tool) and the platform binds the rest from that tool's trusted identity. The envelope is read strictly (an unknown key such aseffect_class,stateorreceipt_id, a missingargs, a mistyped field or an invalid action ismalformed_result), so a model that says an effect happened, or claims a class, is unreadable, never recorded. The result isproposed_actionwith oneProposedAction(platform_boundis false; its connector, version and class are the placeholdersunclaimed/read, which the platform ignores). If one response calls several protected tools the first is proposed and the rest of that response, read calls included, does not run. A call to a tool the agent does not have ismalformed_result.ProposedAction.toolis optional in the v1 result schema and is not part of the intent, its digest or the stored proposal; a proposal without it (a third-party or scripted adapter) is still bound from the connector and resource it claims, as before (see the B08.2 section below). - Limits come from the request.
max_turnscounts provider responses;max_tool_callscounts read tools run, all or none per response;max_tokensis compared with the provider's total before each call and after each response (more than the limit stops withmax_tokenswhatever the model wanted; exactly the limit is allowed but leaves nothing for another call); the deadline is read before each call. A step that may not start (max_*of 0, a deadline reached) returns the stop with zero usage, sourceestimated, and the provider is not touched. A response the provider cut off (finish_reason: length) ismax_tokensand its tool calls are not acted on. Each call is also bounded: the SDK's retries are off (with_options(max_retries=0)), its timeout is the time left to the deadline (at mostCALIBER_PROVIDER_REQUEST_TIMEOUT_SECONDS) and the remaining token budget is sent asmax_completion_tokens. The platform still enforces the limits against the returned usage (B08.3). - Usage is the provider's, summed over turns, with
usage_source: "provider"andcached_prompt_tokensonly when the provider reported them. A response with no usage object is estimated by word count and reportedestimated; a total belowprompt + completionis raised to it; a figure that is not a plain non-negative integer (or exceeds 2147483647) ismalformed_result. Usage is kept on every stop, and on a failure after at least one response (reportedunknown). - A refusal is a result.
message.refusalandfinish_reason: content_filterarerefusedwithmodel_refusedandcontent_filtered; the model's words are not returned.
| the provider | result | recover by |
|---|---|---|
times out (TimeoutError, httpx.TimeoutException, openai.APITimeoutError) | error, adapter_timeout | the call's outcome is unknown: retry as the next attempt; the reservation is kept |
| raises anything else (a 4xx/5xx, a network error) | error, provider_error | reading the server log (the exception's class and the step id, never its text) and retrying as the next attempt |
| returns something that is not a chat completion, a bad tool call, unreadable usage, a malformed or over-claiming proposal envelope | error, malformed_result | none for this output; check the model and the tool's schema |
runs past max_turns, max_tool_calls, max_tokens or the deadline | the matching stop reason | raising the limit on the next attempt, or a smaller task |
No exception text, provider payload, tool name or tool argument is placed in a result or a log line (the log line carries the exception's class name and the step id). Not covered: handoffs (run_agent ignores them too), structured output (a step result has no output field, so the final text is not returned) and the token reservation (B08.4). Recording the proposal is the platform's job and is described in Governed agent steps.
Governed agent steps: a protected action is a proposal (B08.2, #744)
caliber.effects.step_proposal is what the platform (the interpreter, never an adapter) does with a step that stops with proposed_action. It is switched on per plan: RuntimePlan.governed_agent_steps is a GovernedStepContext. Since #1051 the worker builds one in the reference profile for an admitted run, only for the agent nodes bound to a tool the operator mapped (CALIBER_AGENT_STEP_TOOL_BACKENDS, GovernedStepContext.governed_nodes; see The worker binds the governed path); every other plan, and every other agent node, runs exactly as before. With one, an agent node no longer calls run_agent: it runs through run_agent_step.
- The platform classifies the agent's tools; the model's claim decides nothing.
registry_tool_classifieranswers, for each tool bound to the agent, the protected-effect inventory's class for the tool's registry identity: the binding names its row (resolved_name,resolved_version), the row's module and callable must be the binding's, andis_builtin_toolmust accept it (owner, version, module and callable as the seed wrote them). A tool that is not provably CALIBER's own, every MCP tool, an unresolved binding, a missing row and an unreadable registry are the inventory's fail-closed class (irreversible_write). Only tools classifiedreadare handed to the adapter (AgentStepInput.read_tools); every other tool is proposed and never run. A classifier that raises, or answers with anything but aToolTrust, is the fail-closed class. - The connector comes from a trusted map, never from the proposal. A v1 proposal names no tool, and the connector it names is the model's word, so the platform ties a proposal to the agent through
GovernedStepContext.tool_backends: which backend kind (caliber.effects.dispatcher.BACKENDS) each tool sends through, built by the producer from trusted configuration (nothing a model, a manifest author or a tool call writes). It is keyed by the tool's registry identity,(name, version)of the row the binding resolved to (ToolTrust.registry), never by the local name in the manifest: a manifest author can give any tool any local name, so a built-in bound under a mapped name gets no route (the review probe, a regression test). Only the agent's non-read tools whose registry identity is in the map count, and the connector the model named is used for one thing: choosing among them. It must be the connector of a mapped tool's registered backend (connector_not_mappedotherwise;connector_ambiguousif two kinds share it), so a model cannot reachhttp, or any other registered connector, through a tool that does not send there. The backend kind is then admitted (admit_backend, B12.3a: implementation, capability and configuration pinned inREFERENCE_CONNECTORS; a refusal keeps its own code) and that admission is whatsubmit_proposalrequires. Which backends an agent step may reach, and the resource contract. Only backends instep_proposal.AGENT_STEP_BACKENDS(todaydocument_request) are reachable by the destination pattern; a tool mapped to any other (http, whose destination is an arbitrary URL and whose egress check runs at dispatch, after an approval would be spent) is refused,backend_not_for_agent_steps. Theregistered_tool,openapi_httpandmcpbackends are reached a different way since B04.6 (#768): their destination is not a pattern the model chooses within, it is derived from the tool's trusted identity and the model's claim must equal it (see Model-selected tool calls); without the runtime's binder they are stillbackend_not_for_agent_steps. A reachable backend must declare a resource pattern: its trusted configuration'sresourceis a regular expression the destination must fully match (resource_not_admitted, also when there is none). The proposal is bound, never trusted. The class is the strictest among the tools that map to that backend (a tool the profile refuses outranks one it dispatches), and the version is the admitted one.ProposedAction.bound_torefuses a claim that differs (claim_mismatch). A mapped tool's destination is still the model's to choose within the connector's pattern. The approval request stores the intent hash and an evidence digest, not the destination: the approver reads the intent from the recorded proposal. Nothing is repaired: a refused proposal records nothing, and the node's retry policy applies. - One effect, one question.
submit_proposalrecords the bound action as aproposedeffect for the node's durable occurrence ((run, node, occurrence), the interpreter's occurrence id, so a retry and a restarted run find the same row) and, in the same transaction,create_approval_requestrecords the approval request bound to that exact intent (intent_hash), with an evidence digest over the step, its run and context manifest digests and the intent (step_evidence_hash). The two are written together or not at all. Concurrent proposers of one step serialize on the run row, so exactly one request is live: the second finds the first's instead of superseding it. - The node parks. The step returns
blocked(waiting_approval:<node>) with aruntime_approvalcheckpoint that names the proposal and the request (identifiers and the intent hash, never the action's arguments). The worker parks the runwaiting_approvalon that very request and creates no node-level duplicate; it refuses to park a run behind a request that is not live and bound to this run, node and proposal. The routes accept the checkpoint kind (runtime_approval), and the parked run is decided by naming the request'sruntime_approval_idwhile the run iswaiting_approvalat that node (B06.4, #735; the default selection with no id never picks a bound request). The decision does not resume the run: an operator'sPOST .../resumedoes, and the dispatcher consumes the approval when the step's effect is claimed (since #1051, by the context'sdispatch_approved). - A resumed or retried step does not ask the model again. Before the provider is called the node looks for its occurrence's proposal:
committedcompletes the node,failedfails it,proposedparks it again behind its live request (re-asked when the last one expired, was superseded or was consumed; a rejected request is final,approval_rejected), and any state in between (approved,dispatched,unknown,reconciled: the dispatcher has it) is the existing effect-reconciliation park.
Refusals are EffectRefused with a fixed code and no value from the model; the run error carries only that code.
| the step | result | recover by |
|---|---|---|
proposes a tool class the model made up (read for a write) | run error governed agent step proposal refused: claim_mismatch, nothing recorded | none for this output; the node's retry asks again as the next attempt |
names a connector none of the agent's mapped tools sends through (a hostile http proposal, say) | connector_not_mapped, nothing recorded | mapping a tool to the backend in the context, if the agent should reach it |
| names a registered connector but the wrong version or class | claim_mismatch, nothing recorded | the model proposing the admitted version and the tool's class |
| names a destination the admitted connector does not accept | resource_not_admitted, nothing recorded | a destination of the connector's shape |
| its backend is not admitted (drifted implementation, capability or configuration) | the admission's code (connector_configuration_mismatch, ...), nothing recorded | re-admitting the connector (B12.3a) |
| proposes while the agent has no protected tool | no_protected_tool | none: the call was invented |
| proposes while the agent holds a tool the profile refuses | unsupported_effect_path | removing the refused tool from the agent |
| proposes a different action for an occurrence that already has one | intent_conflict, the stored proposal stands | none: the occurrence's effect is fixed |
| completes without proposing | run error governed agent step completed without an output channel; nothing is published | adding an output field to the step contract before governed steps carry text |
the agent has a handoff, sits as the inline target of a fan-out, loop or error boundary, or is a branch of a parallel node | the run is refused before any node runs (do not follow handoffs / cannot run inline / cannot run in parallel branches), no proposal or request exists | giving the governed agent its own sequential node in the graph |
| the store fails while recording (a deadlock, a lock timeout) | run error governed agent step proposal failed: store_failed; the statement's parameters, which are the model's arguments, reach no error or log | retrying the node |
a tool is mapped to http or to a literal-template backend | backend_not_for_agent_steps, nothing recorded | mapping only document_request-style backends |
| stops on a limit, refuses or fails | run error governed agent step stopped: <stop reason> (<fixed code>); a limit stop carries its usage as numbers: governed agent step stopped: max_tokens (turns=3 tool_calls=1 tokens=4100) | as for the step; the limits are central, reservations are B08.4 |
| its approval request was rejected, then the run is resumed | approval_rejected | a new run |
from caliber.effects.step_proposal import GovernedStepContext, registry_tool_classifier, stored_context_manifest_digest
from caliber.workflows.agent_step import StepCeilings
plan.governed_agent_steps = GovernedStepContext(
session_factory=session_factory,
workflow_run_id=run_id,
run_manifest_digest=run_manifest_digest, # the stored run manifest's SHA-256
grant_id=run_manifest["grant_id"], # the one grant the step runs under
classify_tool=registry_tool_classifier(session_factory),
context_manifest_digest=stored_context_manifest_digest(session_factory, run_id),
limits=lambda agent: step_limits, # the producer's; capped at the ceilings, enforced by the platform (B08.3)
requested_by=run_initiator,
approval_ttl_seconds=configured_ttl_seconds(config),
tool_backends={("request_missing_document", "1.0"): "document_request"}, # registry identity -> backend, the producer's
ceilings=StepCeilings.from_config(config), # optional: the CALIBER_AGENT_STEP_MAX_* ceilings (defaults when absent)
)
Dispatching an approved proposal is the context's dispatch_approved (#1051): a context without one leaves an approved proposal proposed and the run waiting_approval, as before; the worker's sends it once, under the lease, through the document_request backend (B04.6 records proposals of registered, OpenAPI and MCP tools in the node's own intent shape so the existing backends can send them, see Model-selected tool calls; the worker dispatches only document_request, the other backends having no verifier yet, #1055). Not covered, so not claimed: the token reservation (B08.4), handoffs, inline targets and parallel branches (refused), and the output text of a governed step (a step that completes is refused). A proposal that does not name its tool (a scripted or third-party adapter that still claims its target) is bound within a connector at the strictest class of the tools that map to it; the shipped adapters name the tool (B04.6), which makes the class exact.
Model-selected tool calls (B04.6, #768)
In an agent loop the model chooses the tool and its arguments. Both are untrusted, so a protected call (anything the platform does not classify read) never runs because a model asked for it. There are two paths and nothing else: a proposal (a governed agent step) or a refusal (every other governed loop). No new setting, route or migration.
The classification is the node's. A model-chosen call is classified by the same helpers a workflow tool node uses: the registry row for a registered tool (route_registered_tool), the row and the method its own configuration selects for an OpenAPI tool (route_openapi_tool; a pack's operation is chosen by the call), the MCP server record and the administrator's tool policy for an MCP tool (mcp_tool.prepare). Never the binding's names or level, the model's claim, or what a server reports.
| the model's call | reference profile, build_plan plan (a registry reader, no governed context) | a governed effect context is bound | development profile, no governed context | a plan wired to neither (export, caller-built plan) |
|---|---|---|---|---|
a read-class tool, a GET OpenAPI call, a read MCP tool | runs inline | runs inline | runs inline | runs inline |
| a protected registered tool | refused before the tool is entered: _refused marker, protected_tool_requires_governed_step | refused, never authorized | runs inline, as before the dispatcher (not governed) | runs inline (not governed) |
a protected OpenAPI call (a POST, or a row declared write) | refused, same code | refused | refused by the public executor entry (unsupported_effect_path, since B04.4b): it cannot send a write | refused by the public entry |
| a protected MCP call | refused, same code | refused | runs inline through the gateway entry point, as before B04.5 (not governed) | the gateway entry point refuses it under the reference profile |
| a host-file built-in (EP-055) | refused: unsupported_effect_path | refused | runs | a process with the reference profile refuses it when it is bound (Refused paths); otherwise runs |
| an unclassified, blocked or undiscovered MCP tool | refused with the gate's code (mcp_tool_unclassified, ...) | refused | the gateway refuses it | the gateway refuses it |
| a binding that is not its registry row, an unreadable registry | refused: registry_row_mismatch, registry_row_unreadable | refused | runs inline (the development path classifies nothing) | runs inline |
Where the gate sits. _gate_model_callables wraps the final callable map of an agent (after extra_tools replaced a bound tool, for a node's agent, a handoff target and a governed node alike), and _model_call_check classifies each call when it is made. Every provider loop, the Agents SDK callback and the fake executor's helper run a tool through _execute_model_tool_call or _invoke_agent_tools over those callables, so none of them can answer differently. The refusal is a _refused marker holding the tool's name and a fixed code and nothing else (no argument, no exception text); a call the route cannot classify, or whose route raises for any reason, is refused too (model_tool_route_refused). The development-profile rule is the one decision _legacy_effects_allowed(plan) makes for every route: the flag and no bound context.
{"_refused": true, "tool": "open_ticket", "code": "protected_tool_requires_governed_step"}
A behavior change in the development profile, for replays. Calibration and refinement replays build their RuntimePlan directly with the registry reader bound and legacy_guarded_effects left False (see Profiles and a missing governed context): a protected tool node was already refused there, and a protected tool a model chooses inside such a replay is now refused too (it used to run inline in every profile). The ordinary development run (build_plan) is unchanged.
The call sites are pinned by tests/test_model_tool_call_sites.py (every module that executes a model-chosen call, with its status: gated, governed-step, legacy or out-of-scope; and a structural check that every function that resolves an agent's callables also gates them), as RAW_OPENAPI_CALLERS and RAW_MCP_CALLERS pin the transports. Aria's own tool loops remain a separate assistant executor: EP-034 explicitly refuses protected published OpenAPI rows in the reference profile and preserves declared read-method calls; they do not share a workflow run or acquire run-less dispatcher authority.
A governed agent step proposes. With RuntimePlan.governed_agent_steps bound, the adapter is handed only the callables the platform classified read and a protected call is one proposed action (see Governed agent steps). B04.6 makes that proposal exact for the three tool kinds. The model supplies the tool's arguments and nothing it could claim: the shipped adapters offer a protected tool with args (and optionally the resource it is asked to name and an expected_resource_version), and the proposal they return carries the name of the function the model called (ProposedAction.tool, an optional field of the v1 result that is not part of the intent or its digest). The runtime's binder (_RuntimeToolBinder) then:
- finds the agent's tool by that name among the agent's bindings (
unknown_toolfor a name the agent does not have;tool_not_protectedfor a tool the platform classifiesread: a read runs inline, it is never proposed). A proposal that does not name its tool (a scripted or third-party adapter) is found the older way: a candidate is a tool the platform did not classifyreadwhose kind's connector is the one it claims, and the proposal is the candidate's only if the resource it derives from its trusted identity is the one claimed (resource_not_admittedotherwise; two tools that derive different proposals areconnector_ambiguous); - takes the connector, resource and intent arguments from the trusted identity: the registry row (
registered-tool/<name>/<version>and the node's{tool, version, arguments, input}), the row's operation and its checked input for OpenAPI (method, server and path template; the precondition lifted intoexpected_resource_version), the server record and a digest of the classification for MCP. The recorded intent is the one a tool node records for the same call, so the connector's backend can send it once it is approved; - validates the model's arguments against the trusted input schema before anything is recorded: the registry row's own schema for a registered or OpenAPI tool (
tool_input_invalid,openapi_input_invalid; the binding's schema is not trusted). An MCP tool has no trusted schema (a server's discovered schema is the server's claim), so its arguments are only the bounded plain JSON every intent is (size, depth, control characters and surrogates are refused when the proposal is built, before any of this); - holds every claim field to the platform's value: a connector, version or class that is neither the placeholder (
unclaimed, andreadfor the class, never a valid class for a protected action) nor exactly the platform's, or a precondition that differs, isclaim_mismatch. The shipped adapters never produce one (a model that volunteers a connector, version or class ismalformed_resultbefore the platform sees anything); a third-party adapter that does is refused here. It also refuses a tool the producer did not allow:GovernedStepContext.tool_backends(registry identity(name, version)to backend kind, as before, now alsoregistered_toolandopenapi_http) and the newGovernedStepContext.mcp_tools((server_id, tool_name)pairs; an MCP tool has no registry row) are the producer's allow-lists, empty by default (connector_not_mapped). The registry row the binder read must be the one the classifier did (registry_row_mismatchif it changed in between).
| the step | result | recover by |
|---|---|---|
proposes a tool the platform classifies read | tool_not_protected, nothing recorded | none: a read runs inline |
| proposes arguments the row's schema refuses | tool_input_invalid / openapi_input_invalid / openapi_key_override_refused / openapi_egress_blocked, nothing recorded | none for this output; the node's retry asks again |
| proposes a tool no allow-list names | connector_not_mapped | mapping the tool in the context, if the agent should reach it |
| proposes an MCP tool nobody classified | the gate's code (mcp_tool_unclassified) | classifying it (the administrator's tool policy) |
| proposes a host-file built-in | unsupported_effect_path | none: refused in the reference profile |
Each is a run error governed agent step proposal refused: <code>, with no value from the model.
What is deliberately not done here, so not claimed.
- Dispatching an approved proposal. B04.6 records the proposal and its approval request and parks the run; sending it after the approval needs the execution-owner lease and an exact-intent authorization, which the producer binds (#1051). The recorded intent is dispatchable by the existing backends (a test sends one through the
registered_toolbackend), but nothing inbuild_planresumes and dispatches yet. - A destination the model names. A tool whose destination is the model's to choose within a connector's pattern (the document request) still needs the model to name it in
resource; a tool whose resource the platform derives (registered, OpenAPI, MCP) does not. A model that names a different resource than the tool's is refused (resource_not_admitted), never repaired. - Inline reads inside a governed step are CALIBER's own
readbuilt-ins. The step classifier keeps the fail-closed class for an administrator-registered tool, an OpenAPI tool and an MCP tool (stricter than a node, which runs a row declaredreadinline), so those are neither run nor proposable in a step when they are read-class (tool_not_protected). It now takes the stricter of the inventory's class and the row's declared level for a built-in, as a node does. - Handoffs, inline targets and parallel branches stay refused in a governed plan (B08.2); in an ungoverned loop a handoff target's tools are gated like the root's.
- Aria remains a separate assistant executor: EP-034 (#1063) refuses protected published OpenAPI rows in the reference profile, while declared read methods remain available; it does not acquire run-less dispatcher authority. The development profile's legacy calls, an export and a caller-built plan are also not governed (table above).
A latent defect fixed on the way. submit_proposal rebuilt an intent from a ProposedAction's read-only view of its arguments, which _plain_json refuses when they contain a nested object; B08.2 only ever proposed flat arguments. It now reads the plain copy (action.intent.plain_args), covered by every nested-argument test here.
Configuration, migration and rollback. No setting, route or migration. GovernedStepContext.mcp_tools is a new optional field (default empty: no MCP tool is proposable). Rolling back is reverting the change; a proposal already recorded remains readable. A deployment that relied on a protected registered tool running from a model loop in the reference profile now gets the _refused marker: register the call as a workflow tool node, or run the agent as a governed step.
Central step limits: turns, tool calls, tokens and the deadline (B08.3, #752)
The limits of an agent step (max_turns, max_tool_calls, max_tokens and the deadline of the request) are enforced by the platform in caliber.workflows.agent_step.run_agent_step, the one boundary every adapter goes through, and not by each adapter. The adapters keep their own in-loop checks (they are the only code that can stop a provider call that is under way), but the platform does not rely on them and does not take an adapter's or a model's word for what a step used. It adds no table, route or migration.
Where the limits come from. GovernedStepContext.limits(agent) is the producer's (trusted run or step configuration, never anything the adapter, the manifest author or the model supplies). The interpreter then brings them down to the platform's ceilings (GovernedStepContext.ceilings, default StepCeilings(), built from settings with StepCeilings.from_config(config)) with cap_limits: a count above its ceiling becomes the ceiling, a deadline later than now + CALIBER_AGENT_STEP_MAX_SECONDS is brought forward to it (an earlier deadline is kept exactly as given), and a limit is never raised. A producer whose limits raises, returns anything but a StepLimits, or names a deadline that is not an RFC 3339 instant stops the step with governed agent step limits unavailable: limits_invalid before the adapter is touched (no text from the producer's failure); a context clock that is not an aware instant stops it with governed agent step clock unavailable: clock_invalid. The request schema's own bound is 2147483647; the ceilings are what make a step finite in practice.
| Setting | Default | Accepted | Meaning |
|---|---|---|---|
CALIBER_AGENT_STEP_MAX_TURNS | 25 | 1 to 1000 | The most provider turns one step may be given. |
CALIBER_AGENT_STEP_MAX_TOOL_CALLS | 50 | 0 to 1000 | The most read-tool calls one step may make (0 allows none). |
CALIBER_AGENT_STEP_MAX_TOKENS | 200000 | 1 to 10000000 | The most tokens (prompt plus completion) one step may use. |
CALIBER_AGENT_STEP_MAX_SECONDS | 600 | 1 to 86400, finite | The longest window, from the moment the step is asked, a deadline may reach. |
A value outside its bounds stops the service at startup, naming the setting. Like the context caps, the ceilings reach a live step once the producer of the governed context passes StepCeilings.from_config(config); a context that names none is capped at these defaults, never uncapped.
What the boundary does, for every adapter alike:
- Before work (
before_work_stop): a step withmax_turnsof 0, withmax_tokensof 0, or whose deadline is now or past (on the platform's clock) stops with that reason and the adapter is not called: zero usage,usage_source: "estimated"(nothing was called; the interpreter checks this before it reserves, so a step stopped here reserves nothing, B08.4).max_tool_callsof 0 does not stop a step: it may still answer without a tool. - During work: every read tool the adapter is handed (its own and its handoff targets') goes through a platform counter. The call past
max_tool_callsis refused withStepToolBudgetExceeded(the tool does not run, the text is fixed), and two calls racing for the last slot cannot both run. A read tool called at or after the deadline (on the platform's monotonic-based clock) is refused the same way withStepDeadlineReached(the tool does not run, the call is not counted), and the step endsdeadlineeven if the adapter ignores the refusal; a tool call already running is not interrupted. An adapter receives its own copy of the request, so rewriting the limits of the request it holds changes nothing the platform checks. - After work: a
completedorproposed_actionresult is replaced by the stop of the limit it passed, its proposal dropped (a step that overran never gets to propose, so no proposal row and no approval request exist), when its reportedturns,tool_callsortotal_tokensis over the limit, when the platform counted a tool call past the limit (even if the adapter swallowed the refusal and reported fewer), or when the platform's own clock says the step finished after its deadline. Several limits passed are named in the ordermax_turns,max_tool_calls,max_tokens,deadline. The usage kept is the reported one (what was spent is recorded), withtool_callsraised to the platform's own count when that is higher. Arefused,erroror limit stop the adapter reports itself is returned as it is.
Exactly the limit is within it. max_tokens: 100 with total_tokens: 100 completes; 101 stops with max_tokens. The same holds for turns and tool calls. A deadline stops a step that is at or past it before work, and one that finished after it after work (finishing exactly at the deadline is within it). The deadline is read from StepClock: the absolute deadline against wall time at the start, and how long the step took against a monotonic clock, so a wall clock stepped mid-step (an NTP correction) can neither extend nor spuriously cut a step. Tests inject a fake clock; a clock that is not an aware instant, or whose monotonic reading is not a finite number, is refused with ValueError before the adapter runs.
| the step | result | recover by |
|---|---|---|
| has no turn or no token to spend, or its deadline has passed | max_turns, max_tokens or deadline, usage 0, estimated; the adapter was not called; the run error is governed agent step stopped: max_tokens (turns=0 tool_calls=0 tokens=0) | a larger limit from the producer (within the ceilings) on a new run |
| reports usage over a limit, or the platform counted a call past it | the limit's stop, proposal dropped, the reported usage kept; governed agent step stopped: max_tokens (turns=1 tool_calls=0 tokens=15); no proposal and no approval request | the node's retry is the next attempt with a fresh budget |
| finishes after its deadline | deadline, proposal dropped, usage kept | as above |
| reports usage that contradicts itself (a total below the parts, a boolean or negative count, more than 2147483647) | error, malformed_result, zero usage, usage_source: "unknown" (the whole reservation is charged, B08.4) | the adapter reporting the provider's own figures |
asks for a tool past max_tool_calls | the tool is not run; the adapter sees StepToolBudgetExceeded; the step ends max_tool_calls if it went on | raising the limit within the ceiling |
| asks for a tool at or after the deadline | the tool is not run and not counted; the adapter sees StepDeadlineReached; the step ends deadline if it went on | a later deadline within the ceiling on a new run |
No double counting. The boundary keeps no state between calls: each call has its own counter and reads only its own result. A retry is the next attempt of the same occurrence with the full limits, and a resumed step that finds its recorded proposal asks nobody and reports no usage. Adding the usage of several attempts to one budget is the reservation ledger, not this check.
For the conformance suite. before_work_stop(request, clock=...) is the pre-work check the reservation calls first (a step it stops needs no reservation); the stop reasons are caliber.workflows.agent_step.LIMIT_STOPS. The conformance harness (caliber.testing.agent_step_conformance) gains FakeStepClock, fixed_clock, limits_changes and stop_before_work, and every run_scenario runs on a fixed clock (StepContext.clock); caliber/tests/test_agent_step_bounds.py runs the five executors over tripwire clients through stop_before_work, and the conformance suite (turn_limit, tool_call_limit, token_limit, deadline_limit, limits_before_work, adapter_cannot_raise_limits) runs the four provider adapters against every limit.
Not covered, so not claimed: the platform cannot observe a provider's turns or tokens, only what the adapter reports, so for those two the check bounds what is recorded and stops the proposal, while an adapter's own in-loop checks bound what is spent (a lying adapter can under-report tokens; the reservation charges a conservative figure unless a trusted result says less). A blocking provider call is not interrupted. The usage of a stopped step is in its result and in the run error text, and its charge is persisted by the reservation ledger.
Token reservations: reserved before the call, charged conservatively, settled once (B08.4, #761)
The platform cannot observe a provider's tokens, only what the adapter reports, and a crash, a timeout or a refused result leaves nobody knowing what was charged. So a governed step's ceiling is reserved first, a charge is lowered only on a figure the platform believes, and nothing is ever released on a guess. caliber.budget.step_reservation holds the ledger (table caliber_step_token_reservations, migration 0133); the interpreter reserves in _run_governed_step, immediately before run_agent_step, and settles right after it returns. It is not a second budget authority for later milestones: the per-run figure below is the Beta per-step ledger, and the persistent budgets of M08 extend this table rather than add another.
The reservation. One row per (workflow_run_id, node_id, occurrence_id, attempt) (unique, and the step's step_request_id is stored with it). Its reserved_tokens is the step's limits.max_tokens after the B08.3 ceilings, and it is taken before the adapter is called, in one transaction under the run's row lock (FOR UPDATE, the first lock of the run, proposal, request order every writer of a run uses; on SQLite, which has no row lock and whose driver reads outside a transaction, the same section starts with BEGIN IMMEDIATE): two workers asking together are serialized, so the sum of what a run has reserved or been charged plus the new ceiling can never pass the run's budget. Past it the step is refused with a typed, payload-free run error and the adapter is never called:
governed agent step token reservation refused: token_budget_exhausted (budget=39999 committed=0 requested=40000)
| Setting | Default | Accepted | Meaning |
|---|---|---|---|
CALIBER_AGENT_RUN_MAX_TOKENS | 2000000 | 1 to 1000000000 | The most tokens one run's governed steps may reserve and be charged in total. Reaches a live step through GovernedStepContext.run_token_budget (the producer passes config.agent_run_max_tokens); a context that names none is bounded at this default, never unbounded. A ceiling larger than the whole budget refuses every step. |
CALIBER_AGENT_RESERVATION_GRACE_SECONDS | 300 | 1 to 86400, finite | How long past its step's deadline an open reservation is left before the execution owner finalizes it as abandoned. |
A value outside its bounds stops the service at startup, naming the setting; the context and the reservation functions refuse a budget that is not an integer in those bounds (a boolean is not a count).
Idempotent, and a replay is not a second call. A duplicate request for the same step returns the same reservation (created false) and never reserves twice, whatever the budget is by then. A step that is handed a reservation it did not create (two resumers of one step both derive the same attempt and race for it) is refused with governed agent step token reservation refused: reservation_replayed and its adapter is not called: the earlier call may have spent, and the platform will not call the provider again on that strength. A retry of the node, and a resume after a crash, are the next attempt (see below) and take their own reservation, so the attempts of one occurrence add up against the run. A step the platform stops before work (before_work_stop: no turn or token, a deadline already past) and an executor that is not an adapter reach no provider and reserve nothing, so nothing is ever released for them. There is no release.
What is charged. charge_for decides, from the stored ceiling and the result, never from a caller's copy:
| the result | charge | basis |
|---|---|---|
| a figure above the reservation (an overrun), from any source | the figure, in full (the overage included) | reported |
a step that ran to an answer, usage_source provider (or absent: the contract reads that as the provider), a non-zero total at or below the reservation | the reported total; the unused part goes back to the run | reported |
refused, error, an estimated or unknown source, a zero total, a malformed or inconsistent usage, no result | the whole reservation | conservative |
Believing a figure can only lower a charge when the result is one the platform trusts; believing a figure above the reservation can only raise it, so that is always done. What this does not do: it cannot verify a provider's number. The adapters are the platform's own code and report the provider's usage; this ledger refuses to let a result that carries no usable figure shrink a charge, and stores what the adapter said (reported_tokens, usage_source, stop_reason and a fixed-token error_code, never free text) for audit.
Settled once. settle_step_tokens is a compare-and-set from reserved to settled on the stored row: a retry, a duplicate, a settlement racing the janitor finds a final row, changes nothing and gets that row back, so a charge is never written twice and never lowered after the fact. A store that fails to settle leaves the reservation open, which counts at its whole ceiling (it can only overcharge); the step still goes on with the result in hand, the failure is logged by exception class only.
Open counts in full; nothing is released. A reservation is reserved from the moment it is taken. An exception out of the adapter that is not a result, a cancellation, a KeyboardInterrupt or a worker that is killed leaves it open at its whole ceiling, because the provider may have been called. There is no operator action that lowers a charge: nothing the platform can check would back it (the same rule as for effect proposals). A run that needs more budget gets a larger CALIBER_AGENT_RUN_MAX_TOKENS.
Abandoned, owner only. After each pass the execution owner's effect reconciler loop (the same lease, compared in the transaction that writes) runs abandon_stale: a reservation still open past its step's deadline plus CALIBER_AGENT_RESERVATION_GRACE_SECONDS moves to abandoned at its whole reservation, oldest first and bounded per pass. The run's total does not move; the row only stops being open. A worker that returns after that finds a final row and its settlement changes nothing, including an overrun: a step that returns usage above its reservation after the sweep abandoned it (more than the step's deadline plus the grace) keeps the abandoned charge, the reservation, and the overage is not recorded (very unlikely: a provider timeout is capped at the remaining step deadline). The sweep runs only where the reconciler loop does (the reference profile, with CALIBER_EFFECT_RECONCILER_ENABLED on, its default); elsewhere, or with it off, open rows stay open and keep counting in full, which is safe. A process that does not hold the lease changes nothing.
Final means final. The ORM refuses every edit and delete of a reservation. The database refuses the same: CHECK constraints keep every figure non-negative, a conservative charge equal to the reservation, a reported charge equal to the reported figure, an abandoned row conservative, and a final row complete; a trigger refuses any UPDATE of a settled or abandoned row and any change to the identity and the reserved figures of an open one, and refuses DELETE (PostgreSQL also TRUNCATE, and revokes both from PUBLIC).
Migration and rollout. 0133 only adds the table and its guards (nothing else references it and nothing reads it before the code that writes it). Run it before the new code serves: a process on the new code with no table refuses a governed step with governed agent step token reservation refused: store_failed and never calls its adapter. Rolling back the code leaves the table unread; downgrading the migration drops the table and loses the charges counted against runs, so never do it where they matter.
| the step | result | recover by |
|---|---|---|
| would take the run past its budget | token_budget_exhausted, nothing reserved, adapter not called | a larger CALIBER_AGENT_RUN_MAX_TOKENS (a new run: a finished run's budget is its own) |
| reaches an attempt that already holds a reservation (two resumers of one step racing for the same derived attempt) | reservation_replayed, adapter not called | nothing: the other resumer holds the reservation and calls the provider. A node retry, and a resume after a crash, are the next attempt and reserve afresh |
| the store cannot reserve | store_failed, adapter not called | the database; nothing was reserved |
| the worker died or was cancelled mid-call | the reservation stays reserved, counted in full, then abandoned after the grace | nothing: it is already charged; see the recovery runbook |
Resuming a governed step after a crash. The runtime's attempt counter (_STEP_ATTEMPT) restarts at 1 whenever a process re-executes a run, so the attempt a governed node takes is derived from what is stored before its context manifest and request are built: next_attempt returns the larger of the counter and one past the highest attempt the (run, node, occurrence) has reserved, in any state. The step_request_id, the context manifest and the reservation therefore carry one attempt. A node resumed after a crash between the reservation and the settlement, or between the settlement and the recording of the proposal, is the next attempt and takes its own reservation; the earlier attempt's reservation is never touched (open, settled or abandoned, it keeps counting in full), so the run's budget adds up both attempts and the resume can be refused for budget (token_budget_exhausted) like any other step. The resumed call is a second provider call: the first call's outcome is unknown, and the platform charges it conservatively rather than reuse its reservation. A proposal already recorded for the occurrence still short-circuits the step before any attempt is derived, so a step resumed after its proposal was recorded asks nothing and reserves nothing, and the effect is one per occurrence however many attempts ran. Two resumers of one step that derive the same attempt meet at the unique key: one reserves and calls the provider, the other is handed that row and is refused with reservation_replayed before it reaches the provider. A resume cannot tell a live earlier worker from a dead one. A worker B that starts the same step after worker A has reserved attempt 1 but before A has settled it derives attempt 2 and makes a second, concurrent provider call under its own reservation (before this change B was refused with reservation_replayed). Both calls are charged in full and the run budget bounds the spend; the occurrence still has one proposal and one approval request, and dispatching the approved effect still needs the execution-owner lease. reserve_step_tokens and next_attempt do not check the lease themselves, so what keeps two workers off one run is the worker's own run claim, not the reservation. Crash loops burn budget. Each crash leaves its whole ceiling counted and nothing releases it, so repeated crashes of one step accumulate full ceilings against the run until a resume is refused with token_budget_exhausted; the remedy is a larger CALIBER_AGENT_RUN_MAX_TOKENS or a new run. Nothing is persisted for this (no migration): the attempt is read from the reservations, and a store that cannot be read refuses the step with store_failed. Only a governed step with an adapter executor derives an attempt; the development profile and every ungoverned node keep the plain counter.
Deleting a workflow whose runs hold reservations is refused with 409 (cannot delete workflow: its runs have step token reservations), like run manifests and effect proposals.
Reading it back: caliber.budget.step_reservation.run_token_usage(session_factory, run_id) returns what a run has counted and how many reservations are open and final. No route lists reservations yet.
For the conformance suite (#769). reserve_step_tokens(session_factory, request, run_budget_tokens=...) returns a StepReservation (created, state, reserved_tokens, charged_tokens, charge_basis) or raises ReservationRefused whose code is one of token_budget_exhausted, reservation_replayed, request_invalid, budget_invalid, run_not_found, reservation_mismatch; next_attempt(session_factory, run, node, occurrence, floor=...) is the attempt a resumed step takes (one past the highest reserved, never below floor); settle_step_tokens(session_factory, reservation, result) returns the final row; charge_for(reserved, result) is the pure rule; abandon_stale(session_factory, lease, grace_seconds=...) is the owner janitor. The scenario tests/egi_scenarios/test_v08_timeout_retry.py::test_budget_refuses_before_call and the PostgreSQL races in tests/egi_scenarios/test_b08_token_reservation.py are the oracle; tests/conformance/test_agent_adapter_governed_plan.py runs each provider adapter through the reservation (charged as reported for honest usage, the whole reservation for every other result, no second provider call under one reservation).
Adapter conformance suite: the rules every provider adapter passes (B08.5, #769)
The governed agent step has one boundary (run_agent_step) and four provider adapters behind it. The conformance suite is the evidence that an adapter holds its side of that boundary, and it is the same suite for every adapter: the four that ship (OpenAI chat completions, OpenAI Responses, the OpenAI Agents SDK and Anthropic Messages) and any adapter written elsewhere. It adds no route, table, setting or migration; it calls no provider, reads no real clock and needs no provider SDK.
Two modules ship with the package (caliber.testing, test support like the fault barriers) so that an adapter outside this repository can run what the repository runs:
caliber.testing.agent_step_conformance: the per-scenario harness that B08.1b introduced (moved here fromtests/, which re-exports it), with its protected-tool canaries, fixed clock andStepContext;caliber.testing.adapter_conformance: the rules, the provider script language,AdapterUnderTest, and the report.
Run it for the shipped adapters. The real executor classes over canned transports, every rule, offline:
cd caliber && pytest tests/conformance/test_agent_adapter_conformance.py # 4 adapters x 41 rules
pytest tests/conformance/test_suite_fails_against_broken_adapters.py # the suite fails when an adapter is broken
pytest tests/conformance/test_agent_adapter_governed_plan.py # the same adapters under the interpreter
pytest tests/conformance/test_agent_adapter_openai_agents_real_sdk.py # the Agents adapter on the installed SDK
Run it for your adapter. An adapter is any object with run_step(request, step_input) -> AgentStepResult (AgentStepAdapter). The suite needs one function from you, build(script, probe): it returns a fresh adapter whose provider transport plays script, an ordered list of what your provider does on its first, second, ... call (Reply, Fault, Garbage). The transport calls probe.provider_called(tools=[...], sent="...") each time the provider would be called (tools, the names the request offers the model, and sent, the request's text, are optional; the rules offered_tools_are_the_agents_own and read_tool_failure_is_class_only are reported unsupported without them), and the adapter reads time from probe.clock (the fake the rules move; an adapter that reads the real clock cannot be tested for a deadline). Something your transport cannot express raises Unsupported(reason): that passes for a rule marked optional (invalid_argument_text, read_tool_failure_is_class_only, offered_tools_are_the_agents_own) and fails for every other.
The complete example below is a correct adapter for a made-up provider and the build that stages the suite's scripts on it. It is the file tests/conformance/toy_adapter.py, which tests/conformance/test_example_third_party_adapter.py runs exactly as the last lines of the example say, and checks that the code quoted here is the file's. Every rule passes against it.
from __future__ import annotations
import asyncio
import json
import logging
from collections.abc import Callable, Mapping
from dataclasses import dataclass
from datetime import datetime
from typing import Any
from caliber.contracts.agent_step import (
AgentStepRequest,
AgentStepResult,
StepUsage,
)
from caliber.contracts.registry import ContractValidationError
from caliber.effects.records import ProposalError
from caliber.testing.adapter_conformance import (
MALFORMED_USAGE,
AdapterUnderTest,
Call,
Fault,
Garbage,
ProviderProbe,
ProviderUsage,
Reply,
Script,
fault_exception,
)
from caliber.workflows.agent_step import (
ADAPTER_TIMEOUT,
MALFORMED_RESULT,
PROVIDER_ERROR,
AgentStepInput,
StepDeadlineReached,
StepToolBudgetExceeded,
answer,
failure,
proposal_from_call,
)
logger = logging.getLogger("acme_adapter")
class _Unreadable(Exception): # noqa: N818 - what the provider sent cannot be read; never carries its text
pass
@dataclass
class _Tally:
prompt: int = 0
completion: int = 0
turns: int = 0
tool_calls: int = 0
estimated: bool = False
def usage(self) -> StepUsage:
total = self.prompt + self.completion
return StepUsage(self.prompt, self.completion, total, self.turns, self.tool_calls)
@property
def source(self) -> str:
return "estimated" if self.estimated else "provider"
def _count(value: object) -> int:
if type(value) is not int or not 0 <= value <= 2_147_483_647:
raise _Unreadable
return value
class ToyAdapter:
"""One governed step against a provider callable; the example every rule of the conformance suite is run on."""
def __init__(
self,
provider: Callable[[list[dict[str, Any]], list[str]], Any],
*,
now: Callable[[], datetime],
):
self._provider = provider
self._now = now
def run_step( # noqa: PLR0911, PLR0912 - one loop, one exit per way a step can end
self, request: AgentStepRequest, step_input: AgentStepInput
) -> AgentStepResult:
tally = _Tally()
read_tools = dict(step_input.read_tools)
messages = [*step_input.history, {"role": "user", "content": step_input.input_text}]
while True:
if (limit := self._limit_reached(request, tally)) is not None:
return self._stop(request, limit, tally)
try:
reply = self._call_provider(messages, sorted(read_tools))
except (TimeoutError, asyncio.TimeoutError):
return failure(request, ADAPTER_TIMEOUT)
except Exception as exc:
return self._provider_failed(request, exc)
try:
calls = self._read_reply(reply, tally, step_input)
if reply.get("finish") == "length" or self._over_budget(request, tally):
return self._stop(request, "max_tokens", tally)
protected = [call for call in calls if call["name"] not in read_tools]
if protected:
return self._propose(request, protected[0], tally, step_input)
if not calls:
return answer(
request, "completed", usage=tally.usage(), usage_source=tally.source
)
for call in calls:
if self._tool_limit_reached(request, tally):
return self._stop(request, "max_tool_calls", tally)
tally.tool_calls += 1
try:
result = self._run_read_tool(read_tools[call["name"]], call["arguments"])
except StepToolBudgetExceeded:
return self._stop(request, "max_tool_calls", tally)
except StepDeadlineReached:
return self._stop(request, "deadline", tally)
except Exception as exc:
# The model is told which kind of failure it was; the message is the tool's, not the model's.
result = json.dumps({"_error": type(exc).__name__})
messages.append({"role": "tool", "content": str(result)})
except _Unreadable:
return failure(request, MALFORMED_RESULT)
@staticmethod
def _stop(request: AgentStepRequest, reason: str, tally: _Tally) -> AgentStepResult:
return answer(request, reason, usage=tally.usage(), usage_source=tally.source)
def _limit_reached(self, request: AgentStepRequest, tally: _Tally) -> str | None:
"""A limit that forbids another provider call: turns, tokens, then the deadline."""
limits = request.limits
if tally.turns >= limits.max_turns:
return "max_turns"
if tally.prompt + tally.completion >= limits.max_tokens:
return "max_tokens"
if self._now() >= limits.deadline_at:
return "deadline"
return None
@staticmethod
def _over_budget(request: AgentStepRequest, tally: _Tally) -> bool:
"""The response just read took the step past ``max_tokens``: whatever it asked for is not acted on."""
return tally.prompt + tally.completion > request.limits.max_tokens
@staticmethod
def _tool_limit_reached(request: AgentStepRequest, tally: _Tally) -> bool:
return tally.tool_calls >= request.limits.max_tool_calls
def _call_provider(self, messages: list[dict[str, Any]], tools: list[str]) -> Any:
return self._provider(messages, tools)
@staticmethod
def _provider_failed(request: AgentStepRequest, exc: Exception) -> AgentStepResult:
# Only the exception's class is logged: its text is the provider's, and may quote the prompt.
logger.warning("provider call failed (%s)", type(exc).__name__)
return failure(request, PROVIDER_ERROR)
@staticmethod
def _run_read_tool(tool: Callable[..., Any], arguments: dict[str, Any]) -> Any:
return tool(**arguments)
def _read_reply(
self, reply: Any, tally: _Tally, step_input: AgentStepInput
) -> list[dict[str, Any]]:
"""The reply's tool calls (name and decoded arguments); its usage is added to ``tally``."""
if not isinstance(reply, Mapping):
raise _Unreadable
usage = reply.get("usage")
if usage is None:
tally.estimated = True
tally.prompt += len(step_input.input_text.split())
tally.completion += len(str(reply.get("text") or "").split())
elif isinstance(usage, Mapping):
tally.prompt += _count(usage.get("prompt"))
tally.completion += _count(usage.get("completion"))
else:
raise _Unreadable
tally.turns += 1
names = {binding.local_name for binding in step_input.agent.tools}
calls = []
try:
for raw in reply.get("tool_calls") or []:
text = raw["arguments"]
arguments = json.loads(text) if isinstance(text, str) else text
if not isinstance(arguments, dict) or raw["name"] not in names:
raise _Unreadable
calls.append({"name": raw["name"], "arguments": arguments})
except (KeyError, TypeError, ValueError):
raise _Unreadable from None
return calls
def _propose(
self,
request: AgentStepRequest,
call: dict[str, Any],
tally: _Tally,
step_input: AgentStepInput,
) -> AgentStepResult:
"""The model's protected call as one unbound proposal that names the function it called, and claims nothing."""
del step_input
try:
action = proposal_from_call(call["name"], call["arguments"])
except (ProposalError, ContractValidationError, TypeError, ValueError):
raise _Unreadable from None
return answer(
request,
"proposed_action",
usage=tally.usage(),
proposed_actions=(action,),
usage_source=tally.source,
)
def toy_provider(
script: Script, probe: ProviderProbe
) -> Callable[[list[dict[str, Any]], list[str]], Any]:
"""The made-up provider the suite's scripts are played on."""
remaining = list(script)
def provider(messages: list[dict[str, Any]], tools: list[str]) -> Any:
probe.provider_called(tools=tools, sent=json.dumps(messages, default=str))
if not remaining:
raise RuntimeError("the script has no reply left")
item = remaining.pop(0)
if isinstance(item, Fault):
raise TimeoutError(item.text) if item.kind == "timeout" else fault_exception(item)
if isinstance(item, Garbage):
return ["not", "a", "reply", item.text]
return _wire(item)
return provider
def _wire(reply: Reply) -> dict[str, Any]:
wire: dict[str, Any] = {
"text": reply.text,
"tool_calls": [_wire_call(call) for call in reply.calls],
"finish": "length" if reply.cut_off else "stop",
}
if reply.usage is MALFORMED_USAGE:
wire["usage"] = {"prompt": "many", "completion": "some"}
elif isinstance(reply.usage, ProviderUsage):
wire["usage"] = {"prompt": reply.usage.prompt, "completion": reply.usage.completion}
return wire
def _wire_call(call: Call) -> dict[str, Any]:
text = call.arguments if isinstance(call.arguments, str) else json.dumps(call.arguments)
return {"name": call.name, "arguments": text}
def toy_subject() -> AdapterUnderTest:
"""The conformance subject for :class:`ToyAdapter`: ``build`` returns a fresh adapter over a provider playing the script."""
return AdapterUnderTest(
name="toy",
build=lambda script, probe: ToyAdapter(toy_provider(script, probe), now=probe.clock.now),
)
import pytest
from caliber.testing.adapter_conformance import RULES, check_rule, conformance_report
SUBJECT = toy_subject() # for your adapter: AdapterUnderTest(name="acme", build=your_build)
@pytest.mark.parametrize("rule", RULES, ids=lambda rule: rule.id)
def test_acme_conforms(rule):
check_rule(SUBJECT, rule.id) # raises ConformanceFailure naming the adapter, the rule and what was seen
print(conformance_report(SUBJECT).render()) # one table: PASS / FAIL / UNSUPPORTED per rule, then a verdict
What every run checks, whatever the rule. A rule plays its script twice: through the platform's entry (run_agent_step) and by calling the adapter alone on a fresh copy, because an adapter may not rely on the boundary to catch its mistakes. Both runs must satisfy: the result is a schema-valid agent_step_result that answers the asked step; no protected tool ran (a canary sits behind the protected tool's binding and in the unfiltered tool registry); the provider payload planted in the script (SECRET_MARKER) is in no result, log record (every logger, every level, extra= fields included), warning, stdout or stderr; and the adapter returned a typed result instead of raising. (The nine rules that come from the per-scenario harness, from completes to claims_commit, check the result, the canaries and the log records, which is what that harness has always checked.) Log capture cannot see a logger created during the run that turns propagation off, or output that bypasses logging, warnings and the standard streams.
| Rule | What it demands |
|---|---|
completes | A final answer completes the step and reports exactly the provider's usage |
read_tool_call | A read tool the model calls runs through read_tools, and usage sums over turns |
proposes_protected_tool | A protected tool call is one unbound proposal that names the called function, never executed |
model_lies_about_effect_class | An effect class the model volunteers is refused (malformed_result), never proposed |
budget_exhausted | A response the provider cut off is a limit stop that keeps the provider's usage |
provider_error | A provider error is a typed error result carrying no provider text |
provider_timeout | A provider timeout is adapter_timeout |
unreadable_output | Output the adapter cannot read is malformed_result |
claims_commit | Output that claims an effect happened is malformed_result, never a proposal |
hostile_model_text | Hostile model text is inert: nothing is carried into the result, a log or a tool |
extra_fields_rejected | A proposal that carries a field the contract does not have is malformed, never a proposal |
oversized_arguments_refused | Proposal arguments larger than the intent's limit are malformed, never recorded |
deep_arguments_refused | Proposal arguments nested deeper than the intent's limit are malformed |
lone_surrogate_refused | A lone surrogate in a proposal is malformed: it cannot be canonicalised or stored |
invalid_argument_text | Tool arguments that are not a JSON object are malformed for a proposal, and never crash the adapter |
unknown_tool_not_run | A tool the agent does not have is never run, and the step is not completed |
connector_version_claim | A connector, version or class the model volunteers is refused (malformed_result), never carried into a proposal |
proposal_names_the_called_tool | A protected tool's call (its arguments only) is a proposal that carries the called function's name and no claim |
read_tools_authoritative | Only the callables the platform classified read are run, whatever the binding says |
one_proposed_action | Two protected calls in one response are at most one proposal, and the second never runs |
proposal_ends_step | A proposal ends the step: the provider is not asked again after it |
handoff_not_followed | A governed step never follows a handoff: the target's tools are not run |
read_tool_failure_is_class_only | A read tool that raises never crashes the adapter, and its message is not handed to the provider |
offered_tools_are_the_agents_own | The model is offered only tools the agent has: no handoff, no target's tool |
invalid_request_refused | A request that is not a valid step, or not for this agent, never reaches the adapter |
limits_before_work | A step with no turn, no token or no time left never reaches the adapter or its provider |
turn_limit | The adapter asks the provider for no more turns than the limit, and a stopped step proposes nothing |
tool_call_limit | No read tool runs past max_tool_calls, and the step stops instead of going on |
token_limit | A step over max_tokens stops with the provider's usage kept and proposes nothing |
deadline_limit | A step past its deadline asks for nothing more, runs no tool and proposes nothing |
adapter_cannot_raise_limits | The platform holds a step to the limits it set, whatever the adapter was told |
honest_usage_is_charged_as_reported | Usage the provider reported is reported as the provider's, so it is charged as spent |
missing_usage_not_fabricated | A response without usage is reported estimated or unknown, never as genuine figures |
malformed_usage_charged_whole | Unreadable usage never lowers the charge, and no proposal rides on it |
asyncio_timeout_is_adapter_timeout | A timeout raised by asyncio itself is adapter_timeout, on every supported Python |
no_hidden_retry | A failed provider call is not retried: the provider is called once, and the retry is the platform's |
cancellation_propagates | Cancellation and interruption reach the caller, so the reservation stays open (the call may have spent) |
errors_are_payload_free | A failure is a fixed code: no provider text, argument or tool name reaches a result or any output |
deterministic | The same step against the same provider answers identically, proposals included |
fresh_state_per_step | An adapter carries nothing from one step to the next: each answers its own request |
input_isolation | The adapter gets its own copy of the request and its tools, and changes none of what it was handed |
The platform enforces some of this whatever an adapter does, and the suite says so rather than pretend otherwise. The limits are held by the boundary (before_work_stop, the tool meter, _enforce_limits): an adapter that overruns still has its proposal dropped and the typed stop returned. What an adapter alone decides is what it spends: whether it stops asking the provider once a limit is reached. A rule therefore asserts both: the result through the platform and the adapter's own answer when called alone, and the provider calls it made. adapter_cannot_raise_limits is the one limit rule with no "alone" half: its point is that the boundary holds an adapter to the limits it set although the adapter was told otherwise.
A subject may declare the stops it cannot make. AdapterUnderTest(unbounded_in_loop=...), from proposal, tool_calls, tokens and deadline, is for an adapter whose SDK offers no hook between provider calls for that stop: the rules then do not demand the adapter's own stop (the spend past the limit is bounded by the token reservation only). The declaration is the subject's own, so it is public: the report prints it on its second line (cannot stop asking the provider at: ...), and it is read in the pull request or the CI log like any other line of the report. It relaxes only those spend checks, never a rule. No shipped adapter declares any. The OpenAI Agents SDK takes max_turns for the run and tool_use_behavior (a function; present since openai-agents 0.0.7 and run here on 0.20 and 0.24, where the SDK requires the function to return its own ToolsToFinalOutputResult, which the adapter uses) for everything else: after each turn's tools the adapter's function ends the run for a proposal, the tool-call limit, the token budget or the deadline, before the model is asked again. test_agent_adapter_openai_agents_real_sdk.py runs that on the installed SDK with a scripted model, so the emulation the conformance suite uses cannot drift from what the SDK does. The compatibility guard and its deterministic tests keep the declared floor aligned with the signatures the adapter actually uses.
The suite has been shown to fail. tests/conformance/broken_adapters.py holds 39 deliberately broken adapters, each the reference adapter with exactly one defect (it runs a protected tool, strips a claimed receipt_id and proposes anyway, forgets usage on a cut-off, fabricates figures for a response without usage, retries a provider call, swallows a cancellation, misses an asyncio timeout, logs the model's text or the provider's exception, hands a tool's exception message to the provider, offers a handoff target, ignores a limit, carries the first step's result into the second, rewrites the limits of the request it was handed), and test_suite_fails_against_broken_adapters.py requires that each fails the rule written for it for a reason the rule states, and that the intact adapter passes all 41. The rules the boundary decides (limits_before_work, adapter_cannot_raise_limits, invalid_request_refused and the copy half of input_isolation) are shown to fail against a boundary with that enforcement removed.
Inside a governed plan (test_agent_adapter_governed_plan.py, SQLite, the real interpreter and reservation ledger): for each shipped adapter, a protected call is one recorded proposal charged as reported with the protected tool's mutation counter at zero; a lying effect class records nothing; a provider error, a timeout, unreadable, missing or malformed usage, and a claimed commit are each charged the whole reservation (conservative) and carry no provider text into the run error or the log; a re-executed step is the next attempt, reserved and charged on its own (the earlier call stays charged, and the provider is reached once for each reservation); a step past the run's budget never reaches the provider; a timed-out attempt keeps its reservation, and its retry is reserved again and calls the provider once; a cancelled step leaves its reservation open and counted in full; and a governed agent with a handoff is refused before any adapter runs.
A failure reads like this (a reference adapter that retries a failed provider call; 3 of its 41 rules failed). The output is what the suite prints, and test_example_third_party_adapter.py runs it again and requires these lines:
adapter conformance: RetriesTheProviderOnce
FAIL provider_timeout scenario provider_timeout: expected adapter_timeout, got provider_error
FAIL asyncio_timeout_is_adapter_timeout an asyncio timeout (through the platform): expected an error with no proposal, got completed with 0 proposed
FAIL no_hidden_retry an error (through the platform): expected an error with no proposal, got completed with 0 proposed
DOES NOT CONFORM (3 failed)
Findings the suite produced, and what was done.
- The OpenAI Agents adapter read a read tool the platform refused for the deadline (
StepDeadlineReached) as a tool failure, so a step that ran past its deadline endederror/malformed_resultinstead ofdeadline. It no longer does. - The OpenAI Agents adapter let the SDK ask the model again after a proposal, a refused tool, a spent budget or a passed deadline, because it chose
tool_use_behavior="run_llm_again"; the extra model calls were bounded only by the reservation. It now passes a function that ends the run at those points (an earlier version of this section called the SDK unable to do that: wrong, the SDK has the hook). - The chat and Responses adapters handed a failing read tool's exception message (
Type: message) to the provider as the tool result; the Agents and Anthropic adapters sent the class name only. The governed paths of the chat and Responses adapters now send the class name only (_execute_model_tool_call(..., error_detail=False)); the ungoverned loops are unchanged. - The Anthropic adapter recognised only the builtin
TimeoutError; on Python 3.10, whereasyncio.TimeoutErroris a different class, an asyncio timeout becameprovider_errorinstead ofadapter_timeout. It now recognises both, and a rule (asyncio_timeout_is_adapter_timeout) raises a realasyncio.wait_fortimeout at every adapter. - The harness' direct call of the adapter was not checked for logs; it is now.
Not covered, so not claimed. The suite proves an adapter's behaviour over its stub of the provider, not the provider's: it cannot show that a real client is configured as its stub is, that a provider's tokens are what it reported, or that a model cannot be talked into a harmful proposal (a proposal is only ever the model's claim, which the platform binds and an approver reads). another_steps_result (a provider that answers another step's identity) cannot be staged through a provider script and stays in the per-scenario harness. The Agents and Anthropic adapters and the boundary emit no spans; the chat and Responses adapters run a read tool through a shared helper. Governed calls omit payload attributes at emission and the conformance suite captures both paths with a fake tracer; the ungoverned loops retain their existing input/output attributes. The checked outputs also include the result, log records, warnings, stdout and stderr. A read tool that raises ends an Agents step malformed_result but lets the other adapters' model recover: both are allowed (the rule requires only that the message is not handed to the provider and that nothing crashes), and the Agents policy is pinned by its own test. FakeWorkflowExecutor is the platform's scripted adapter (its entries are structured, so a hostile model cannot be staged through it) and has its own tests (tests/test_agent_step_adapter.py); the suite covers the four provider adapters, not five. Run it without python -O: the harness uses assert and the suite refuses to run without them.
Policy decisions
caliber.policy.decisions.decide(...) (B03.3, #671; migration 0117, table caliber_policy_decisions) answers "may this run do this action on this resource, for this purpose, right now?" with a typed PolicyDecision and records it, allow or deny, immutably (ADR 0003 policy_decision v1 plus the run, subject and workload it was asked about; there are no foreign keys, so a decision about a grant that does not exist is still evidence).
- Exact identity, no fallback. The caller supplies
run_id,grant_id, theSubjectand theWorkload. A different run, an unknown grant, another subject (user, authentication method or project) and another workload each deny, and nothing is looked up by recency. - One reason, a fixed order:
grant_not_found,subject_mismatch,workload_mismatch,grant_revoked,grant_expired,not_a_member,action_not_allowed,role_not_allowed,resource_not_allowed(the run grant checks, including the current membership and role), then the policy's own:policy_version_mismatch(the grant was issued under another policy version),purpose_not_allowed,explicit_deny,unknown_action_riskandrisk_above_ceiling. An unavailable store isauthority_unavailable. An allow carries no reason codes. - Explicit maps, never ordering. Each action has an explicit risk number in the policy (every action in
resource_access.PROJECT_ACTIONSmust have one; a test fails otherwise), compared with the policy's ceiling.policy-v1has a ceiling of 4 (risk equal to the ceiling is allowed). Risk 5 means "a person, never a run": project administration (archive, restore, members, ownership transfer) and every approval or acceptance (resource.approve,release.approve,release.quality_signoff,change_request.accept), so no grant can make a run approve its own work (Beta keeps a human accountable owner and human protected-action approval, ADR 0004). Explicit denies are exact(action, resource)pairs. APolicyis read-only and type-checked. - Replayable.
input_hashis the SHA-256 of the canonical JSON of every input (run, grant, subject, workload, action, resource, purpose and the live scopes) plus the policy's own digest; the clock is not an input. The same inputs under the same policy hash identically. - Transactions. A decision is flushed, never committed. For initial admission the run, its grant and the decision share one uncommitted transaction and the caller commits only after an allow; a denial rolls all of it back. If an decision cannot be recorded, the answer is a deny with
persisted = False(an allow becomesauthority_unavailable; a deny keeps its reason and gainsauthority_unavailable), andPolicyDecision.allowedis true only for a recorded allow. A decision never touches the run manifest. The record is written in a savepoint, so a failed record never poisons the caller's transaction. Consumers must know: a denied initial admission rolls its decision row back with the transaction, so evidence of a denial must be written separately (the audit record of B03.5, or a decision made in its own transaction), and on SQLite (development only) a savepoint that is the first write of a transaction commits it, so calldecideafter the run and grant writes. - Callers must not leak identity mismatches.
deciderecords the specific reason (subject_mismatchandworkload_mismatchreveal that a grant exists). It is server-internal: any layer that answers a client (HTTP, the admission API) must collapse identity and grant-lookup failures into one uniform refusal.purposeis stored verbatim: it names why, never context or payload. - Malformed input is a bug, not a decision. A blank, oversized or control-character id, action, resource or purpose, a naive
now, or a non-SubjectraisesDecisionInputErrorand records nothing. - Immutable. Triggers refuse
UPDATEandDELETE(TRUNCATEtoo on PostgreSQL) and the ORM raisesImmutableRecordError; as with run manifests, run the application as a role without those privileges. - Audited (B03.5, #688). Every recorded decision also writes one audit-log row through
audit.record, in the decision's own savepoint, so the two exist together:actionispolicy_allow(severitystandard) orpolicy_deny(severityhigh, orstandardwhen every reason is ordinary lifecycle:grant_expired,grant_revoked,not_a_member),actorthe subject,entity_typepolicy_decision,entity_idthe decision id, anddetailsthe run, grant and workload ids, the action, resource and purpose, the result, the reason codes, the policy version and the input hash. The run's input, context and any secret are never in it (and the audit log's redactor runs over it anyway). If the decision and its audit row cannot be written (the store is down) the answer is an unrecorded deny (authority_unavailable) and one structured error log line carries the decision, run, grant, action and result; nothing is allowed that is not on record. At initial admission the decision's own rows are rolled back with the refused run (nothing about a refused run is stored), so the denial's audit row is written afterwards in its own short transaction from the decision's ids and reasons (admission.record_denial; a failure there is logged and never changes the refusal).
Recovery: grant_*, not_a_member, role_not_allowed, action_not_allowed and resource_not_allowed are as in the grant table above; policy_version_mismatch means the run must be admitted again under the current policy; purpose_not_allowed and explicit_deny are policy decisions to change deliberately, not retry; risk_above_ceiling means the action cannot be done by a run (use the human-approval path or a person); unknown_action_risk means the policy lacks a risk for the action and must be extended; subject_mismatch and workload_mismatch are always a bug or an attack: fix the caller.
Release evaluation: the evaluator executes queued attempts (B10.2, #707)
POST /projects/{project_id}/releases/{release_id}/evaluate queues one caliber_workspace_release_evaluations row (queued) per attempt. WorkspaceReleaseEvaluator (caliber/src/caliber/orchestrator/workspace_release_evaluator.py) is the owner-only loop that picks them up. It reuses the service's own queue and lease (claim_workspace_release_evaluation); there is no second queue.
It is still opt-in. With the feature and worker flags enabled, the evaluator claims a row, resolves the release's own immutable revision pins, runs the configured EvalProvider, and completes the attempt. If the lease expires, the next owner records the abandoned attempt and claims a new fenced attempt; provider run identifiers observed before a crash remain attached to the evaluation and are deduplicated.
- One claim per tick, oldest first. Every
CALIBER_WORKSPACE_RELEASE_EVALUATOR_INTERVAL_SECONDS(default 5, from 0.5 to 3600) it claims thequeuedrow with the oldestrequested_at(ties by id). The row becomesrunningwithstarted_by,started_at,heartbeat_atand a lease ofCALIBER_WORKSPACE_RELEASE_EVALUATOR_LEASE_SECONDS(default 300, from 1 to 86400; inf and nan are refused when the settings load). A row that is notqueued(running under another claimer,succeeded,failed) is never touched.GET .../evaluations/{evaluation_id}shows it. - The claim identity.
claimed_by(andstarted_by) holdworkspace-release-evaluator-<pid>-<id>, followed by:t<token>when the claim was fenced (the fencing token of the execution-owner lease it was made under; no suffix outside the reference profile). That is how the token is kept without a migration: an attempt claimed by owner 1 reads...:t1, one claimed after a takeover...:t2. The evaluator passes this identity and the attempt number to the service's heartbeat and complete calls (it is theworker_idofClaimedEvaluation), and may read the token back from the row. - Pinned execution. Before the provider call the worker loads only the release's
revision_idand itsCaliberWorkspaceRevisionResourcerows. It requires onecandidate, oneevaluationdataset, and oneevaluationjudge pin; optionalbaselinepins are also revision-local. Each registered adapter resolves and snapshots its exact resource again, and a changed resource digest, missing adapter, missing pin, provider mismatch, or digest mismatch blocks the release without calling the provider. The request carries the exact dataset version and judge configuration; it never follows an unrelated workflow/run manifest or a mutable alias. - Result provenance and settlement. The provider result records a SHA-256 evidence digest containing the plan and input digests, candidate/baseline scores, example count, thresholds, and
provider/simulatedprovenance. A score below the pinned aggregate threshold becomesno_go; an unavailable plan/provider or invalid result becomes a retryableblockedoutcome. Completion uses the same release lock version captured before provider work, so a concurrent transition cannot be overwritten. - Evidence-bound gate digest (B10.3, #714). A provider must return one per-example result row for every pinned dataset example. The worker persists the canonical
gate_evidenceblock on the evaluation attempt before settling the release. It contains the complete rows, a dataset digest derived fromexample_id/input/expected/weight/tags, the scored-result digest, per-scorer valid-row/weight denominators, candidate/baseline aggregates, thresholds and provider provenance.evaluation_evidence_sha256is the digest of that exact block and can be recomputed without a provider call. A missing row set or row-count mismatch blocks settlement and writes no gate evidence. - Durable attempt history and recovery (B10.4, #721). The parent evaluation row remains the idempotent public queue/status record. Each claim also creates one row in
caliber_workspace_release_evaluation_attempts, keyed by(evaluation_id, attempt_number), with its worker identity, lease, status and provider run identifiers. When a lease expires, the old attempt becomesorphanedand the next claim increments the attempt number; the old row and any run identifiers are never overwritten. A provider run observed before settlement is recorded immediately, so a crash after an external call remains auditable. Completion, heartbeat and run-recording operations are fenced to the current attempt; a stale worker cannot settle the recovered release. Only the current attempt can become the authoritative completion, and all parent/provider run identifiers are merged without duplicates. - Matching successful gate evidence (B10.5, #732). Manual quality/final decisions and automatic/break-glass release paths accept only a release-local evaluation row with
status=succeededwhose canonical evidence recomputes to the release-bound digest and matches the evaluation's plan and input digests. The evidence must preserve provider and simulated/real provenance, satisfy the recorded aggregate criteria, and contain no critical-failure or waiver bypass. Missing, stale, tampered, non-passing, or out-of-scope evidence fails closed; break-glass does not waive a failed critical gate. - Adapter refusal (B10.6, #740). A release operation that names a resource type with no registered adapter returns HTTP
409with the stable payload{"reason":"adapter_unavailable","adapter":"<resource type>","disabled_by":"profile"}. Deployments that construct the registry from an environment-controlled feature may setdisabled_byto that exactCALIBER_*variable instead. The refusal is emitted before an operation lock or durable operation is created, so the recovery is to enable/register the named adapter and retry the same intent; it is not evidence that an external effect was attempted. When the release-candidate feature itself is off, the existing route gate still returns HTTP404reason_code=feature_disabledand namesCALIBER_FEATURE_RELEASE_CANDIDATES. - Owner-only and fenced. It runs only in the process holding the execution-owner lease (see above), and in the reference profile each claim is made in a transaction that first runs
assert_fencedwith the exact lease the owner captured. A process whose lease was taken over, expired or cannot be checked claims nothing and records nothing; the log saysworkspace release evaluator is no longer the execution owner (<reason>); nothing claimed. On PostgreSQL the fenced claim setslock_timeoutandstatement_timeoutto a third ofCALIBER_EXECUTION_LEASE_SECONDS(at least 100 ms), the same bound the lease calls use. Two claimers racing for one row cannot both win (FOR UPDATE SKIP LOCKEDon PostgreSQL and a conditionalUPDATE ... WHERE status = 'queued'); the loser claims nothing that tick and the next tick takes the next row. - Opt-in, and dormant while the feature is off. The evaluator is built only when
CALIBER_FEATURE_RELEASE_CANDIDATES=trueandCALIBER_WORKSPACE_RELEASE_EVALUATOR_ENABLED=true(default false). Setting the second without the first logs a warning at startup and does nothing; with the feature off the release routes keep answering404 feature_disabled. When it does start it logs a WARNING that the worker is enabled and an INFO for each completed evaluation.CALIBER_BACKGROUND_TASKS_ENABLED=falsestops it like every loop. A manually constructed worker without its provider and adapter registry is claim-only test/dry-run mode; the server always supplies both dependencies. - A clean stop gives the claims back. On shutdown or when the lease is lost the controller stops the loops;
stop()then marks this process's own still-runningattempt history asrequeuedand sets the parent claim back toqueued, clearingclaimed_by,started_by,started_at,heartbeat_atandlease_expires_atin one compare-and-set statement on its own claim identity. It never touches a row another worker owns, and it works after the lease is gone. A crash, a kill or a stop that outlivesCALIBER_SHUTDOWN_GRACE_SECONDSleaves the attemptrunninguntil the next owner observes the expired lease and records it asorphaned. - Liveness is write-only for now. Every tick, idle ones included, writes a
caliber_worker_heartbeatsrow of kindworkspace_release_evaluator; a clean stop removes it and a replaced evaluator's stale row is reaped after a few poll intervals. Nothing reads that kind yet (/readinessqueue health reads theworkflow_runkind only), so it is a row an operator can query, not a probe. - No row content in logs or errors. The log carries evaluation and release ids, the attempt number, the claim identity and the lease refusal reason, never the plan or input digests.
Known limits. An idle tick still writes a heartbeat row and runs one indexed SELECT. A tick still running when the stop grace ends is abandoned (a thread cannot be cancelled) and can claim a row after the requeue. A queued row whose claim keeps failing with an unexpected error is retried first on every tick, so it holds up the rows behind it.
Inspecting recovered attempts (a crashed or killed process, or an expired stop grace, left an attempt running). The next owner recovers these automatically after lease_expires_at is in the past. Inspect both the parent queue row and its immutable attempt history:
SELECT evaluation_id, workspace_release_id, claimed_by, lease_expires_at
FROM caliber_workspace_release_evaluations
WHERE status = 'running' AND claimed_by LIKE 'workspace-release-evaluator-%';
SELECT evaluation_id, attempt_number, worker_id, status, provider_run_ids, authoritative,
completed_at, error_code
FROM caliber_workspace_release_evaluation_attempts
WHERE status IN ('running', 'orphaned', 'requeued')
ORDER BY evaluation_id, attempt_number;
Rollback. Unset CALIBER_WORKSPACE_RELEASE_EVALUATOR_ENABLED (or set it false) and restart: a clean stop of the old process requeues its claims, and a new process claims nothing. If the old process did not stop cleanly, recover only expired rows with the SQL above. There is no migration and nothing else to undo.
Reserved tool names and refused paths (#641)
The protected-effect inventory (docs/architecture/protected-effect-paths.md) classifies a built-in tool by its name, and the tool registry is unique only on (name, version). So a tool someone registers as grep_files could be taken for the built-in. Registration therefore refuses every name a built-in owns, and the inventory trusts a tool's name only when the tool really is CALIBER's own.
Reserved names. The sixteen tools CALIBER seeds: read_text_file, list_folder_files, grep_files, regex_search, grok_parse, sandbox_python, list_workdir_files, read_workdir_file, get_file_metadata, write_workdir_file, create_artifact, extract_document, memory_search, memory_list, list_entities and memory_add. The comparison is stricter than the resolver's exact match: case and surrounding spaces are ignored, and so are a tool. prefix and a .vN suffix, so Grep_Files, grep_files and tool.grep_files.v2 are all reserved. A name that merely contains one (grep_files_v2, my_grep_files) is free. The rule applies in every profile, to every owner, module and version. The names of the trusted connectors (document_request, document-request, http, registered_tool, openapi_http, openapi-http, mcp, mcp-tool; see Trusted connector admission) are reserved the same way, with a message that names the connector instead of a built-in tool.
Where it is enforced. POST /tools, POST /openapi-integrations/{id}/tool-drafts/{draft_id}/publish and the Aria publisher (AssistantPublisher, for a tool draft). Nothing is written when a name is refused. CALIBER's own seeding is unaffected.
POST /ajax-api/2.0/mlflow/caliber/tools {"name": "grep_files", "version": "1.0", ...}
409 {"detail": "reserved_tool_name: tool name 'grep_files' is reserved for the built-in CALIBER tool
'grep_files', which the protected-effect inventory classifies by name; register your tool under a
different name", "status_code": 409}
The OpenAPI publish route answers the same 409; recover by publishing the draft again with another name in the request body. A tool draft Aria publishes under a reserved name is not registered: the draft ends as publish_failed and the publish report carries "success": false, "code": "reserved_tool_name" and the same message. Recover by asking Aria for a new tool draft under a different name and publishing that one.
A tool registered under a built-in's name before this rule is not migrated or rewritten. It is neutralised by two things only: the identity check and an audit. A registry row counts as CALIBER's own only when every field the seed writes matches (workflows.builtin_tools.is_builtin_tool): the name, the owner @caliber, the version 1.0, a callable named like the tool, and that tool's own module (BUILTIN_TOOL_MODULE_BY_NAME, which the seed also reads, so the two cannot drift). effects.inventory.effect_class_for_registry_tool classifies every other row as irreversible_write, the fail-closed class, and tool_disposition_for_registry_tool routes it through the dispatcher instead of trusting it. The audit: every time the tool list seeds the built-ins, each row that holds a reserved name without being the seed's own row is logged once per process at ERROR and gets one audit record (action flag_reserved_tool_name, entity type tool, severity high, with blocks_seed). blocks_seed: true means the row is at version 1.0 under the exact built-in name, so the registry (unique on name and version) cannot hold the real built-in: it was never seeded and is missing from the list until the squatter is archived and renamed, or deleted by an operator. To rename such a tool, register it again under a new name, point the workflows that use it at the new name, then archive the old one (a registered tool cannot be renamed in place).
The owner is part of that identity, so PATCH /tools/{id} refuses (409 reserved_tool_owner) to give a registered tool the owner @caliber, unless the row already matches the seed in every other field. That exception exists to repair a built-in whose owner was edited away: until it is set back the row is untrusted (fail-closed) and the audit flags it; a row that differs from the seed in name, version, module or callable can never be made trusted by editing its owner.
Where trust comes from at run time. The dispatch call sites (B07 #524, B08 #526, the B04 tasks) must pass the registry row's own name, owner, module, callable and version, read from the database for the tool being run. They must never pass a manifest binding's local_name or resolved_name, and IRToolBinding and ToolRegistryEntry carry no owner on purpose: the IR is written into generated exports field by field, so an owner there would be data an export author controls. A test fails when production code passes a constant or a **kwargs expansion to these lookups.
Refused until explicitly supported (#641). The inventory marked two paths refuse for the reference profile in #641; B04.7 (#774) refuses them, and every other refuse row, with unsupported_in_reference_profile (Refused paths in the reference profile):
| inventory row | path | why |
|---|---|---|
| EP-055 | the host-file tools read_text_file, list_folder_files, grep_files, regex_search | they read any host path, with no confine_to_file_root, and return what they read to the model provider (an export) |
| EP-114 | the write tools of the first-party PostgreSQL MCP server (create_table, insert_rows, update_rows, delete_rows, execute_sql, create_vector_table, upsert_vectors, create_graph, drop_graph, create_vertex, create_edge, cypher_query) | they create tables and write rows with no guard of their own; its read tools (list_tables, describe_table, run_query, similarity_search) run in a read-only transaction and are not refused |
effects.inventory.tool_disposition(name, caliber_defined=...) answers refuse or dispatch for a tool, on the same trust rule as effect_class. The DB MCP write tools are not registry rows, so tool_disposition_for_registry_tool answers dispatch for those names (a registry row is never the first-party server); their refusal rests on the MCP server's identity, which the MCP route now establishes from the server record (tool_disposition_for_mcp_tool, Governed MCP tools): a workflow tool node or MCP node reaching one of these tools on the first-party server is refused with unsupported_effect_path under the reference profile (the development profile classifies it by the administrator's policy; the first-party server is recognised from its stdio launch or an operator-attested managed sidecar host). The switch that raises unsupported_in_reference_profile for every refused row is B04.7 (#774) (Refused paths in the reference profile). The four host-file tools were already refused by a workflow tool node in a manifest-backed plan (see "Governed registered tools") and, in a plan wired to the registry (build_plan), by the loop gate of Model-selected tool calls (unsupported_effect_path); the switch adds the refusal where the tool would run: a process on the reference profile no longer binds them in any plan, whoever built it. The first-party database server's write tools are refused through a workflow under the reference profile (B04.5) and by the server itself when its own environment says CALIBER_PROFILE=reference.
Configuration, migration and rollback. No new setting, no migration and no stored data change. Rolling back is reverting the change; rows already refused were never written.
Refused paths in the reference profile (B04.7, #774)
The protected-effect inventory (docs/architecture/protected-effect-paths.md) marks a path refuse when it runs arbitrary source, imports an arbitrary module, exports runnable code, serves an unauthenticated service, or writes to the host or a database with no dispatcher, proposal or approval in front of it. Under CALIBER_PROFILE=reference every such path fails with UnsupportedEffectPath (the subclass UnsupportedInReferenceProfile) and the stable code unsupported_in_reference_profile, before anything runs: no process is started, no module imported, no file or directory created, no database connection opened. The message names the inventory row and entry point and the setting that allows the path elsewhere, and never a request, a draft, a path or an argument:
unsupported_in_reference_profile: EP-011 (caliber/src/caliber/workflows/runtime.py::_run_node) is not supported in the reference profile; set CALIBER_PROFILE=development to use it outside the reference profile
The refusal is a reference-profile control. The default development profile is unchanged: the same entry point does what it did, and a test per row (caliber/tests/test_effect_path_matrix.py::test_refused_paths_are_unchanged_in_the_development_profile) holds that. A caller that is handed no configuration is not in the reference profile either; every production caller passes the configuration it has (the plan's operator configuration, the request's application configuration, or, for the two separate processes, the loaded configuration or the process environment).
| inventory row | entry point | what the reference profile does |
|---|---|---|
| EP-011 | the python_code node | the node fails the run before a sandbox is built, whatever sandbox backend is configured |
| EP-012 | the external_app node | refused before the allowlist is read or anything is imported (an allowlisted entrypoint is refused too) |
| EP-014 | the output_folder node | refused before the path is confined or any directory is created |
| EP-015, EP-016, EP-019 | binding a registered Python tool (the runtime, a generated export, bind_registered_tool) | an administrator's module is refused when the tool is bound, before a proposal is recorded or an approval spent, and at author time: validation, compile and promotion refuse it with the same code (Executable code is refused); CALIBER's own shipped tools still bind |
| EP-020 to EP-023, EP-025, EP-026 | the local subprocess sandbox | a sandbox built for the profile runs only CALIBER's own shipped tools; authored source, an administrator's module and every test suite are refused, and so is any other payload at the single spawn point |
| EP-027, EP-028, EP-029 | the standalone tool-sandbox service | the CLI refuses before it binds a port, create_app refuses to build the app, and a handler of an app whose configuration says reference answers 409 |
| EP-041, EP-042 | execute_exported_workflow, the export's knowledge-build runner | refused before anything is read, bound or run, whatever runners or resolvers the caller supplies |
| EP-044, EP-045 | GET .../export/python, GET .../export/deployment-bundle | 409 with reason_code unsupported_in_reference_profile, before the version is looked up |
| EP-047, EP-048 | file_tools.write_workdir_file, file_tools.create_artifact | refused when handed the configuration; nothing binds them to a run, so there is no dispatcher path to send them down |
| EP-054, EP-055 | the built-ins sandbox_python and the four host-file tools | refused where they would run (the sandbox and the binder treat a built-in the inventory refuses as not shipped), besides the refusals of a tool node and of a model-chosen call |
| EP-078, EP-079, EP-080 | Aria's tool-draft tests, run_tool_sandbox, evaluate_tool_draft | the draft test gate reports a failed report whose error is the refusal; the two tools answer their error before they read the draft or build a sandbox |
| EP-114 | the first-party PostgreSQL MCP server | its one writable door (connection.connect) refuses when the server's own environment says CALIBER_PROFILE=reference; the read tools are unaffected |
CALIBER's own shipped tools are the one exemption, and only for the tool-execution rows. The seeded write-class built-ins (create_artifact, write_workdir_file, memory_add) are shipped too: what they run is CALIBER's own code, and the dispatcher governs them by their class. A tool is shipped when its module and callable are the pair the registry seed writes (workflows.builtin_tools.BUILTIN_TOOL_MODULE_BY_NAME) and the inventory does not refuse its name: grok_parse and the other shipped built-ins that are bound to a module run in the reference sandbox as before. A name, an owner or what a registry row or a manifest says decides nothing: a tool called grok_parse in an administrator's module, or a callable of CALIBER's module that the seed does not list, is not shipped.
What refusing the export routes does not stop. EP-044 and EP-045 refuse the two routes that serve the runnable export. The generated Python text (EP-043, exempt) remains sealed in the compiled bundle for the platform, but reference-profile responses from POST /workflow-versions/{id}/compile, GET /workflow-versions/{id} and POST /workflow-versions/{id}/publish recursively remove the generated_python field and its source bytes. The PostgreSQL public-path acceptance and source-retention boundary are tracked in #1088.
What an operator sees. Each of these is the refusal for the row named:
# a workflow run with a python_code node (the run's error)
UnsupportedInReferenceProfile: unsupported_in_reference_profile: EP-011 (caliber/src/caliber/workflows/runtime.py::_run_node) is not supported in the reference profile; set CALIBER_PROFILE=development to use it outside the reference profile
# GET /workflow-versions/{id}/export/python -> 409
{"detail": "unsupported_in_reference_profile: EP-044 (caliber/src/caliber/routes/workflow_versions.py::export_python_route) is not supported in the reference profile; set CALIBER_PROFILE=development to use it outside the reference profile", "status_code": 409, "reason_code": "unsupported_in_reference_profile"}
# python -m caliber.tool_sandbox (exit status 1, nothing listening)
caliber.effects.dispatcher.UnsupportedInReferenceProfile: unsupported_in_reference_profile: EP-029 (caliber/src/caliber/tool_sandbox/__main__.py::main) is not supported in the reference profile; set CALIBER_PROFILE=development to use it outside the reference profile
# Aria's run_tool_sandbox tool (the tool's error)
{"error": "unsupported_in_reference_profile: EP-079 (caliber/src/caliber/assistant/agent_tools.py::AssistantAgentToolset._t_run_tool_sandbox) is not supported in the reference profile; set CALIBER_PROFILE=development to use it outside the reference profile"}
A tool node, or an agent, that binds an administrator's Python module is refused when it is bound. An agent is not failed by it: the tool stays listed, every call of it is the refusal (reported to the model as the tool's error, with no argument in it, and never retried), and a preview mocks it. Inside a for_each or an error_boundary the refusal fails the node; it is not absorbed as one item's error.
Recovery. Nothing was run, written or recorded, so there is nothing to undo. Pick the supported path:
- an administrator's Python tool: publish it as an OpenAPI tool (a read
GETruns inline, any other method is proposed, approved and dispatched, Governed OpenAPI tools) or run it behind an MCP server whose call is classified by an administrator (Governed MCP tools); a workflow that only needs CALIBER's own built-ins is unaffected; - a
python_code,external_apporoutput_foldernode: replace it with a supported node, or run that workflow in aCALIBER_PROFILE=developmentdeployment; - a runnable export: run the version through the platform's own run routes instead of exporting it;
- the standalone sandbox service: do not run it in a reference deployment;
- a host-file read or a database write through MCP: keep them out of reference workflows (they are refused here until reads are confined to a configured root and writes are routed through the dispatcher with an exact-intent approval).
The final dispositions this change made in the inventory. EP-043 (compiler.generate_python) is now exempt: it only emits text at compile time, and that text is sealed into every deployment bundle, so refusing it would refuse publishing every workflow in the reference profile. What the profile refuses is serving the text (EP-044, EP-045) and running an export (EP-041, EP-016, EP-019, EP-042). EP-047 and EP-048 are now refuse (they were dispatch) and no longer list the tool names write_workdir_file and create_artifact: the registry name resolves to a demo stub, not to the module function, and routing the name stays with EP-049.
The effect-path matrix. caliber/tests/fixtures/effect_path_matrix.json holds one case per inventory row, and tests/test_effect_path_matrix.py::test_inventory_rows_have_matrix_cases fails on a row without a case, a case for no row, an outcome that is not the row's disposition, and a claim with nothing behind it (a routed or refused case must name a test that exists). test_refused_paths_raise_in_reference_profile runs one probe per refuse row through its real entry point. Not every dispatch row is routed through the dispatcher yet: 14 of them (EP-009, EP-010, EP-013, EP-017, EP-051, EP-059, EP-070 to EP-072, EP-075 to EP-077, EP-081 and EP-090) have no connector, no B04 child routes them, and the matrix records them as unrouted (pinned in UNROUTED_DISPATCH_ROWS, with an owner note) instead of claiming dispatched. EP-034 is no longer in that set: its reference-profile refusal and development read-path counterpart are covered by tests/refusal_probes.py::probe_ep_034 and ::development_ep_034. Routing it would require a separate run-less authority decision and is outside the Beta scope.
Configuration, migration and rollback. No new setting, no route and no migration, and the packaged inventory is the same file as docs/architecture/protected-effect-paths.md. A reference deployment that ran any of the paths above stops being able to: that is the change. Reverting the change restores the paths; nothing is stored. The development profile is unaffected.
Oracle. caliber/tests/test_effect_path_matrix.py (the matrix, one probe per row, the call-site scan), caliber/tests/test_effect_refusals.py (the switch, the shipped-tool boundary, how an agent, a preview, a route and a node surface a refusal) and the public-path scenario caliber/tests/egi_scenarios/test_b04_refusals.py (the export routes and the real sandbox service process).
Executable code is refused (B12.4a, #754)
A workflow can run code in two ways, and the reference profile refuses both, except for CALIBER's own shipped tools (B04.7, #774; see Refused paths in the reference profile). The kinds are read from the compiler's own IR kind registry (caliber.workflows.ir.NodeType), not from a list kept by hand: each kind is classified once in caliber.workflows.code_policy (code, tool carrier or inert), and tests/test_profile_code_refusal.py fails when a kind is added to the registry without being classified. Until it is, the kind is refused: the profile admits a kind only when it is classified as inert or as a tool carrier (fail closed).
| form | in the reference profile | why |
|---|---|---|
python_code node | refused | runs the author's Python source. The tool sandbox it runs in is a process boundary (separate interpreter, empty environment, rlimits) with ambient filesystem and network authority, not a container, VM or seccomp boundary. A sandbox label does not establish isolation. |
external_app node | refused | imports and calls installed Python inside the control-plane process (EP-012) |
registered python_callable tool that is one of CALIBER's own shipped built-ins (the exact module and callable the registry seed writes, not refused by the inventory), sandbox on (the default) | admitted | CALIBER's own code, run in the sandbox child |
registered python_callable tool that is anything else (an administrator's module) | refused | administrator-registered Python is a refused path in the reference profile (EP-015, EP-016, EP-019, B04.7, #774): it is refused at validation, compile and promotion with this code, and again when it is bound, so an author never gets a clean publish followed by a refused run |
registered python_callable tool, CALIBER_REGISTERED_TOOL_SANDBOX_ENABLED=false | refused | the tool would be imported into the control plane (EP-015, EP-016, EP-019) |
| tool with any other execution backend | refused | the profile cannot establish that it runs no code (fail closed) |
openapi_http tool, MCP tool binding | not code | an HTTP call the effect dispatcher governs, and an MCP call (no MCP server is allowlisted in the profile, #746) |
One code, four boundaries. Every refusal carries unsupported_in_reference_profile, the code ADR 0001 names for a refused path:
| boundary | what happens | where you see it |
|---|---|---|
validation (POST /workflow-versions/{id}/validate, and the validation inside compile and publish) | an error issue per node or tool, path nodes.<id> or nodes.<id>.tools.<tool> | data.errors[].code |
compile (POST /workflow-versions/{id}/compile, publish, a run's plan) | CompileError; the same issues in report.errors | 400 with report.errors[].code; publish answers 400 with the code in detail; a run fails with error_code |
| promotion (promote, approve, rollback and every other alias move) | the alias does not move | 400 (promote) or 409 (approve) with the code in detail |
runtime entry (runtime.execute, and the in-process tool binders) | the run ends error before any node runs, whatever built the plan | WorkflowRunResult.error_code, error starts with the code |
The runtime entry walks the whole IR, not only the nodes reachable from the start, so a dormant code node is refused too, and a plan built by hand in a reference process (without build_plan) is refused by the process-wide policy that create_app binds from the configuration. The in-process binders (runtime._bind_in_process, bind_exported_tool) refuse as a last backstop. Nothing is written when a boundary refuses, and the node, the tool and the sandbox never run.
POST /ajax-api/2.0/mlflow/caliber/workflow-versions/WFV-6219b6e5/validate
200 {"data": {"valid": false, "errors": [{"code": "unsupported_in_reference_profile", "path": "nodes.code",
"message": "python_code node 'code' runs author-supplied Python source in a sandbox that is a process boundary, not
isolation (a sandbox label does not establish it); the reference profile does not support it, so remove the node or
run this workflow outside the reference profile", "severity": "error"}], "warnings": []}}
POST /ajax-api/2.0/mlflow/caliber/workflow-versions/WFV-6219b6e5/publish
400 {"detail": "version does not compile: unsupported_in_reference_profile: python_code node 'code' runs ..."}
POST /ajax-api/2.0/mlflow/caliber/workflows/WF-adb7d7f0/deployments/staging/promote {"version_id": "WFV-6219b6e5"}
400 {"detail": "deployment preflight failed for alias 'staging': unsupported_in_reference_profile: python_code node 'code' runs ..."}
A run that was admitted before the code was refused ends failed with error_code: unsupported_in_reference_profile and the node never executed. A registered Python tool that is not one of CALIBER's shipped built-ins is refused at nodes.<id>.tools.<tool> with the message tool 'lookup_policy' runs a registered Python module (execution backend python_callable) that is not one of CALIBER's own shipped tools, which the reference profile does not support; publish it as an openapi_http tool or run this workflow outside the reference profile. With the sandbox switched off, any registered Python tool is refused with the message tool 'lookup_policy' runs registered Python (execution backend python_callable) and CALIBER_REGISTERED_TOOL_SANDBOX_ENABLED is false, so it would run unsandboxed inside the control plane, ....
Recovery.
- A
python_codeorexternal_appnode: remove it. Use an OpenAPI tool or a built-in data-transform or template node for the same job, or author the workflow in a development deployment. - A registered Python tool that is not a shipped built-in: publish the same operation as an OpenAPI tool (Governed OpenAPI tools), or author the workflow in a development deployment.
- An unsandboxed tool: set
CALIBER_REGISTERED_TOOL_SANDBOX_ENABLED=true(the default) and restart the process. - A version that was published before the profile was switched on and now holds code: it cannot be promoted or run. Author a new draft without the node and publish that; existing aliases keep pointing where they pointed, and are not rewritten.
Configuration, migration and rollback. No new setting, no migration and no stored data change. The development profile is unchanged: all of these forms keep working there, and a version authored there is refused when a reference process validates, compiles, promotes or runs it. The policy is process-wide state bound at startup (like the registered-tool module allowlist), so a change of profile or sandbox setting needs a restart. Rolling back is reverting the change; nothing refused was written.
What this does not do. It does not decide which modules a registered tool may import (the module allowlist, see "Plugins and host paths (B12.4b, #763)") and does not contain hostile tool code (the sandbox is trusted-code admission, see "Who is trusted to write tools" in the tools guide); the other refuse inventory rows are refused at run time by B04.7 (#774, Refused paths in the reference profile). A subworkflow node is not expanded at the parent: the parent validates, compiles and promotes, and the child is checked at its own validation, compile, promotion and runtime entry. A parent run over a child that holds code fails with the same code (error_code: unsupported_in_reference_profile, error naming the child and the node) and the child's node never runs. The refinement, calibration and deploy-gate replays that build a plan without a configuration are covered by the process-wide policy; in a reference deployment the app binds it at startup.
Capability exposure: what is supported (B15-Support.1, #755)
A feature flag says an area is on; it never says an area is supported. GET /ajax-api/2.0/mlflow/caliber/capabilities therefore carries a second object, adapters, next to the unchanged features: one entry per adapter, each exactly one of supported, preview or unavailable.
| adapter id | kind | gated by |
|---|---|---|
document_request_connector | connector | no flag (the dispatcher's trusted document_request transport) |
release_evaluation | release_evaluation | CALIBER_FEATURE_RELEASE_CANDIDATES |
mcp_servers | mcp_server | CALIBER_FEATURE_INTEGRATIONS |
openapi_integrations | openapi_integration | CALIBER_FEATURE_INTEGRATIONS |
Support is derived, never asserted. No setting marks an adapter supported. Only the trusted reference connector and the release evaluation path can be, because only they have an entry in caliber.features.SUPPORT_EVIDENCE: the scenario tests that demonstrate them and, for the evaluator, the pinned implementation and evidence shape those scenarios ran against. MCP servers and OpenAPI integrations have no entry, so no configuration promotes them. The other transports the dispatcher admits (http, registered_tool, openapi_http and the mcp-tool call connector) are not exposed here and claim nothing. http has a read-back by key only at the URLs an operator lists (#1055) and no evidence entry; the other three have no verifier by key and the worker refuses them (see "Not enforced yet" and The worker binds the governed path). Beta scope reads this report for an operator, with each supported claim's evidence and the known limits.
Each adapter is resolved in this order; the first rule that matches decides:
| adapter | rule | status | reason_code | disabled_by |
|---|---|---|---|---|
| any with a flag | the flag is off | unavailable | feature_disabled (the 404's own code) | the flag's variable |
release_evaluation | CALIBER_WORKSPACE_RELEASE_EVALUATOR_ENABLED is off | unavailable | evaluator_disabled | that variable |
mcp_servers | CALIBER_PROFILE=reference (the profile lists no MCP command or host) | unavailable | mcp_not_in_reference_profile | profile |
mcp_servers, openapi_integrations | otherwise (flag on) | preview | no_support_evidence | profile |
document_request_connector, release_evaluation | the profile is not reference | preview | not_reference_profile | CALIBER_PROFILE |
document_request_connector, release_evaluation | the configuration breaks the reference profile | unavailable | reference_profile_violations | profile |
document_request_connector, release_evaluation | CALIBER_BACKGROUND_TASKS_ENABLED is false (the reconciler and evaluator loops the cited recovery scenarios rely on do not run) | unavailable | background_tasks_disabled | that variable |
document_request_connector | CALIBER_EFFECT_RECONCILER_ENABLED is false (an effect whose outcome was never recorded stays blocked) | unavailable | reconciler_disabled | that variable |
release_evaluation | CALIBER_EVAL_PROVIDER is fake (simulated scores) | preview | simulated_provider | CALIBER_EVAL_PROVIDER |
release_evaluation | CALIBER_EVAL_PROVIDER is anything but mlflow or fake (an unknown or padded value, such as a typo; auto never reaches this rule, because the settings load resolves it to mlflow or fake) | preview | eval_provider_unrecognized | CALIBER_EVAL_PROVIDER |
document_request_connector | the live transport is not the one REFERENCE_CONNECTORS pins | unavailable | the admission code (for example connector_capability_mismatch) | profile |
release_evaluation | the evaluator class or the evidence schema version differs from the pin | unavailable | evaluator_evidence_mismatch | profile |
| the two supported adapters | none of the above | supported | null | null |
disabled_by is the environment variable that changes the answer, or profile when no setting does. evidence lists the scenario test ids only for a supported adapter and is empty otherwise. message is the exact text for an operator.
A deployment that supports the release path (a PostgreSQL reference process with a real evaluation provider):
GET /ajax-api/2.0/mlflow/caliber/capabilities -> data.adapters.release_evaluation
{
"status": "supported",
"kind": "release_evaluation",
"label": "Workspace release evaluation",
"reason_code": null,
"disabled_by": null,
"message": "Workspace release evaluation is supported: the evaluator and its evidence shape match the scenario evidence.",
"evidence": ["tests/egi_scenarios/test_v13_release_evaluation.py::test_evaluator_crash_recovers", "..."]
}
Refusals and recovery. A disabled path keeps its one error: the 404 with reason_code: feature_disabled that caliber.features already returned, and the adapter's message is that response's detail, word for word.
GET /ajax-api/2.0/mlflow/caliber/releases/candidates # CALIBER_FEATURE_RELEASE_CANDIDATES unset
404 {"detail": "Release-candidate signoff and workspace releases is disabled in this deployment. Set CALIBER_FEATURE_RELEASE_CANDIDATES=true to enable it.", "status_code": 404, "reason_code": "feature_disabled"}
release_evaluation.message (release flag on, evaluator off)
Workspace release evaluation is unavailable in this deployment. Set CALIBER_WORKSPACE_RELEASE_EVALUATOR_ENABLED=true to enable it.
release_evaluation.message (reference profile, CALIBER_EVAL_PROVIDER=fake)
Workspace release evaluation is preview while its scores are simulated. Set CALIBER_EVAL_PROVIDER=mlflow so the evaluation is a real one.
document_request_connector.message (CALIBER_PROFILE unset)
OpenAPI document-request connector is preview in this deployment: it is supported only under CALIBER_PROFILE=reference. Set CALIBER_PROFILE=reference and start from a configuration that passes the profile to use it as a supported path.
mcp_servers.message (CALIBER_PROFILE=reference, CALIBER_FEATURE_INTEGRATIONS=true)
MCP servers are unavailable under the reference profile: it lists no MCP command or host, so no server is reachable.
Recovery is the variable named in disabled_by; for profile there is nothing to set: the reference profile does not cover the adapter (MCP servers and OpenAPI integrations), or a pin no longer matches the code and a reviewer must re-confirm the scenarios (SUPPORT_EVIDENCE, REFERENCE_CONNECTORS). A reference_profile_violations message names the violation codes in the order the profile checks them (not alphabetically; see the table above for each one's variable), never a configured value. The queue (CALIBER_WORKFLOW_RUN_QUEUE_ENABLED) is not a condition: the cited scenarios run with it at its default.
How the web app renders it (B15-Support.3, #771). The navigation reads adapters from the same GET /capabilities request the feature flags use (one request, no second source) and renders three things from it. It writes no support claim of its own: the only text the app adds is the notice that the server did not say.
| where | adapter | what a person sees |
|---|---|---|
| MCP Servers (Integrations group) | mcp_servers | a status chip, listed only while CALIBER_FEATURE_INTEGRATIONS is on |
| OpenAPI Integrations (Integrations group) | openapi_integrations | a status chip, listed only while CALIBER_FEATURE_INTEGRATIONS is on |
Release candidates (Prompt lifecycle group; the signoff section of the Releases page, /releases#release-signoff) | release_evaluation | a status chip, listed only while CALIBER_FEATURE_RELEASE_CANDIDATES is on |
| Support status (a closed disclosure under the navigation) | all four, including document_request_connector, which has no page | each adapter's label, status chip, the message word for word and, for a supported adapter, how many scenario tests evidence cites |
- The flag still decides whether a destination is listed;
adaptersdecides what it is called. A flag that is off lists nothing, exactly as before, so with all three flags off the navigation lists the same destinations as the alpha, none of them labelled. Every install does get one new control under the navigation, the closed "Support status" button, and the area's exact refusal is one click away there, word for word the404text. - Status is a word and an icon, never a colour alone (
Supported,Preview,Unavailable, the server's three words and no other tier). A screen reader hears the destination's own name, then the status word and themessageas its description. A sighted person gets the same text as a popover on the item, on hover and on keyboard focus (not shown in the collapsed icon rail, whose tooltip carries the status), and in the Support status panel. The chip colours are set per theme (.adapter-chip-*instyles/index.css); the browser spec measures each status chip, on the panel and on the navigation items, and a disabled item's label at at least 4.5:1 against the colour actually painted, in both the light and the dark theme. That is a check of those elements, not an audit of the whole page. - An
unavailableadapter that is listed is a disabled item: visible, its label at full strength, reachable by keyboard so its reason is heard and shown, witharia-disabled="true", and not followed by a click or Enter. Apreviewadapter stays a normal link with itsPreviewchip:previewcan run, only nothing supports it. - Only two adapters can read
Supported. The app allowsSupportedonly fordocument_request_connectorandrelease_evaluation, the twocaliber.features.SUPPORT_EVIDENCEcan promote. If a server ever reportedmcp_serversoropenapi_integrationsassupported, the app would still showPreview, with the noticeThis app shows only the reference connector and release evaluation as supported, so this adapter is shown as preview.Every other rule below is the server's. - Fail closed. Nothing reads as
supportedunless the server reported asupportedentry that is whole: amessage, noreason_code, and at least oneevidenceentry. While capabilities load nothing is labelled; if the request fails, the server predatesadapters, an entry is missing ornull, or a status is not one of the three words, the adapter reads asPreviewwith the noticeThe server did not report why. Nothing is shown as supported unless the server says so.(anunavailableentry with nomessagekeepsUnavailable, with the same notice). A flag being on, or a visible entry, is never support. - No authority. Showing, labelling or enabling an entry grants nothing: the route behind it still checks authorization, approval and admission.
What a person sees on a reference deployment with the integrations area and release candidates on (the item name, its chip, and the text a screen reader reads after the name):
Release candidates [Supported] Supported. Workspace release evaluation is supported: the evaluator and its evidence shape match the scenario evidence.
MCP Servers [Unavailable] Unavailable. MCP servers are unavailable under the reference profile: it lists no MCP command or host, so no server is reachable. (disabled; disabled_by is profile: there is nothing to set)
OpenAPI Integrations [Preview] Preview. OpenAPI integrations are preview: no scenario evidence supports them in the reference profile, and no setting changes that.
and with the evaluator off (release_evaluation, release candidates on) the item is disabled with the recovery step in the same words as the report: Unavailable. Workspace release evaluation is unavailable in this deployment. Set CALIBER_WORKSPACE_RELEASE_EVALUATOR_ENABLED=true to enable it.
- Compatibility. The
featuresblock, its keys and itsstabilityvalues (preview,record_only) are unchanged, as is the top-levelopenapi_integrationsblock (stability: "beta"is the SDK tier, not a support claim).adaptersis additive: a client that predates it ignores it, andcaliber-uitypes it as optional so a server without it reads as "nothing is supported". No setting, default, route, error body or migration changes, and the alpha documents stay historical. - What it does not do. It does not grant authority: a visible or
supportedadapter is still subject to the authorization, approval and admission checks of its own route. It does not turn anything on, and it is not the D5 acceptance report (#613); it supplies the evidence list that gate reads. The web app's rendering of these values is described above (#771). - Scenario evidence is cited, not run here.
tests/test_feature_flags.pyfails when anevidenceentry does not name an existing test function, so a claim cannot cite a test that is not there; whether those tests pass is the "EGI scenarios (PostgreSQL)" job. - Oracle.
caliber/tests/test_feature_flags.py(supported_reference_visible,unsupported_mcp_not_promoted,unavailable_evaluator_disabled,compatibility_valuesand the pins),caliber/tests/test_beta_scope_contract.py(the Beta scope page cannot drift from the adapter table, the evidence or the quoted messages), the scenariocaliber/tests/egi_scenarios/test_b15_capability_exposure.pyon a real reference app, and the alpha-defaults browser speccaliber/caliber-ui/e2e/feature-flags.spec.ts. For the web app's rendering (#771):caliber/caliber-ui/src/components/__tests__/Sidebar.test.tsx(supported_visible,preview_label_retained,unavailable_disabled,alpha_navigation_regressionand the fail-closed cases) and the browser speccaliber/caliber-ui/e2e/adapter-support.spec.ts(supported, preview and unavailable states on a rewritten/capabilities, keyboard and contrast).
Plugins and host paths (B12.4b, #763)
Two more ways code or data reaches the control plane are held to the same refusal code, unsupported_in_reference_profile (caliber.workflows.code_policy.REFUSAL_CODE, ADR 0001): an installed optimizer plugin and a host path a workflow node reads or writes. There is no second code.
Plugins. A plugin is a distribution that advertises itself into the caliber.optimizers entry-point group; loading it imports its code into the control-plane process, where it can write the artifact CALIBER promotes. Allowlisting a distribution (CALIBER_PLUGIN_ALLOWLIST, a comma-separated list of distribution names) is trusted-code admission: a decision about who is trusted, not containment of hostile code. The entry-point group is the only way a plugin is admitted (there is no upload or install route; a ratchet test fails if another importlib.metadata.entry_points call appears in the source). The reference profile refuses at every point a plugin could be admitted:
| where | what happens to an installed plugin whose distribution is not allowlisted |
|---|---|
| startup | the process refuses to start, with the violation plugin_not_allowlisted naming the distribution (metadata is read, nothing is imported) |
the registry's first use (OptimizerRegistry.load_plugins, reached by every get, has, names, listing) | PluginRefused (code unsupported_in_reference_profile, distribution, distributions) is raised before any plugin is imported, allowlisted ones included, each refused distribution is recorded in load_errors, and every later use raises again |
discover_optimizer_plugins() | raises PluginRefused on the first iteration |
OptimizerRegistry.register(spec) with source="plugin" | raises PluginRefused: a plugin handed over directly is admitted on the same terms |
An allowlisted distribution loads as before (it is still experimental, and still cannot shadow a built-in). A distribution with no metadata name is refused; the allowlist match normalises names the way packaging does (Acme_Optimizers matches acme-optimizers). The development profile is unchanged: an unlisted plugin is skipped with an info log and shown in GET /capabilities as installed and inert.
reference profile refused (1 violation):
- optimizer plugin acme-optimizers is installed but not allowlisted, and the reference profile refuses a plugin it was not told to trust; set CALIBER_PLUGIN_ALLOWLIST to name its distribution (a deliberate decision to run that code inside the control plane) or uninstall it [plugin_not_allowlisted]
# a process that was started clean and had a plugin installed afterwards:
POST /ajax-api/2.0/mlflow/caliber/prompts/optimization/runs {"optimizer_type": "GEPA", ...}
503 {"detail": "unsupported_in_reference_profile: optimizer plugin acme-optimizers is installed but not allowlisted; the reference profile loads a plugin only when its distribution is named in CALIBER_PLUGIN_ALLOWLIST ..."}
GET /ajax-api/2.0/mlflow/caliber/capabilities # still answers
200 {"data": {"extensibility": {"optimizers": [], "plugins": [{"name": "acme", "distribution": "acme-optimizers",
"allowlisted": false, "error": "unsupported_in_reference_profile: optimizer plugin acme-optimizers is installed but ..."}], ...}}}
A refinement job that names an optimizer in a refused deployment fails with the same message (LLMProviderError); no optimizer is reported as dispatchable while the refusal stands, because none is: the registry refuses, it does not fall back to the built-ins.
Recovery: add the distribution to CALIBER_PLUGIN_ALLOWLIST (only if you have decided to run its code inside the control plane) or uninstall it, then restart the process. GET /capabilities lists each installed plugin with allowlisted and, for a refused one, the error above, and reading it imports nothing.
Host paths. CALIBER_WORKFLOW_FILE_ROOT confines the host-filesystem nodes (file_input without a managed file, folder_input, output_folder) to a directory: the path is resolved first (.. and symlinks included) and a path that lands outside raises PathOutsideRoot, a ValueError that carries the resolved path and the root, so ../../outside.txt is refused whatever the working directory. A folder_input node confines the files it reads as well as its folder: with a root configured, a glob pattern that is absolute or has a .. segment is refused, and each file the glob returns is resolved (symlinks included) and checked against the root before it is opened, so a symlink inside the root that points outside is refused too (names that merely contain dots, such as a..b.txt or *.tar.gz, are ordinary). Unset refuses these nodes outright. The reference profile removes the third state, the literal unconfined: startup refuses it (workflow_file_root_unconfined), and a process that is running the reference profile and sees it anyway refuses the node with unsupported_in_reference_profile rather than reading the path. The built-in read_text_file, list_folder_files, grep_files and regex_search tools are a different mechanism and are not confined by this root: the reference profile refuses them outright (inventory row EP-055, B04.7, #774; see Refused paths), so no host path reaches them there. The shipped extract_document tool also opens a host path (a bare path, not a managed ref), and it is confined, not refused (B12.4c, #770): it runs in the sandbox child, which a reference-profile sandbox gives CALIBER_PROFILE and CALIBER_WORKFLOW_FILE_ROOT and nothing else, and it resolves the path (.. and symlinks included) and checks it against the root before opening anything. A path outside raises PathOutsideRoot (the call fails; "outside the configured workflow file root"), no root refuses the read, and unconfined is refused with unsupported_in_reference_profile. A workflow that declares managed files binds the content-pinned override instead, which takes a ref and no host path. Before #770 this tool read any path the server could read in the reference profile. The managed file tools (caliber.workflows.file_tools) never take a host path: they take a caliber:// ref, and a traversal in a ref (../../outside.txt) is rejected by the ref grammar before any storage is touched.
reference profile refused (1 violation):
- workflow_file_root is 'unconfined', so a host-filesystem node can read or write any path the server can reach; set CALIBER_WORKFLOW_FILE_ROOT to a directory (or unset it to refuse those nodes) for the reference profile [workflow_file_root_unconfined]
file/folder input path '/etc/passwd' is outside the configured workflow file root '/srv/caliber/files'. Bind a managed project file, or widen CALIBER_WORKFLOW_FILE_ROOT.
Not done here, and why. The registered-tool module allowlist (CALIBER_REGISTERED_TOOL_MODULE_ALLOWLIST, unset permits every module) is unchanged: whether a reference deployment may run an administrator's module at all is the refusal of the protected-effect inventory rows EP-015, EP-016 and EP-019, refused at bind by B04.7 (#774, Refused paths) except CALIBER's own shipped tools, and a profile rule that demanded a module list now would be a second, partial answer to the same question.
Concurrency and ordering. The registry holds its lock for the whole load, so a caller that arrives while another is loading waits for the result (a refusal included) instead of being served a registry that is still empty. A registry first used before the profile was bound (so its load skipped an unlisted plugin as a development load does) checks the installed plugins once the profile is bound and refuses then, rather than keeping the earlier state. CALIBER_PLUGIN_ALLOWLIST is read from the environment only (it has no configuration field), so the profile's requirement names the variable as the setting.
Configuration, migration and rollback. No new setting, no migration and no stored data change. A reference deployment that has an unlisted plugin installed, or CALIBER_WORKFLOW_FILE_ROOT=unconfined, now refuses to start: fix it as above before upgrading. The development profile is unchanged. Rolling back is reverting the change; nothing refused was written.
Oracle. caliber/tests/test_profile_code_refusal.py (the plugin and file-root tests, with a scripted entry point and no network), caliber/tests/test_profile.py (the two requirement rows) and the scenario caliber/tests/egi_scenarios/test_b12_plugin_refusal.py, which starts real reference processes with a real installed distribution.
Attack pack (B12.4c, #770)
The refusals above are claims; this is the evidence that they hold against someone trying to get around them. caliber/tests/egi_scenarios/test_v14_reference_profile.py is a PostgreSQL public-path scenario file (the "EGI scenarios (PostgreSQL)" job) in which an attacker tries the public admission routes listed below (and says which are not covered), and each attempt is denied with the named status and reason while the effect is measured where it would have happened, never in CALIBER's logs:
downstream.mutations(): the attacker's installed module (anexternal_appentrypoint, a registered tool) files a request at the disposable system of record, so a refusal that failed to stop it is a committed mutation;- a marker file written when the attacker's module or a hostile plugin is imported (nothing is imported from a refused plugin);
- the sandbox spawn counter: every start of the tool-sandbox child process is recorded (a
python_codenode, an assistant tool draft and a tool test run each start one in the development profile and none in the reference profile).
The same hostile input runs on the development profile (the SQLite instance of reference_app, which runs development with the same safe settings), which is the control that proves the payload is live and that the refusal, not the payload, is what stopped it.
| case | what the attacker tries | what is asserted (reference profile) |
|---|---|---|
forged_identity_header | X-CALIBER-User with no, wrong, empty, truncated or over-long proxy secret, on reads and writes | 401, nothing stored, nothing dispatched; a proxied request is accepted (control); a user header that names no single user (anonymous, empty, a list) authenticates nobody |
csrf_without_token | no, empty, garbled, tampered, another user's, expired and future-dated CSRF tokens | 403 with a CSRF reason, nothing stored |
ssrf_metadata_ip | 169.254.169.254 as a literal, in decimal, in hex, as an IPv4-mapped and as the AWS IPv6 literal, a name that resolves to it, loopback and private names, a name with a public and a metadata record, through the OpenAPI spec-URL routes | 400 whose detail reads outbound request to '<host>' (resolved to <address>) is blocked: it points at the cloud instance-metadata endpoint (or a loopback address, a private network address); no request reaches the connection layer |
dns_rebinding | a name that answers a public address to the policy check and the metadata address to the connection | blocked before the connection layer; a stable public name connects to the vetted address with the original Host and SNI |
forbidden_module_import | an installed plugin that is not allowlisted (no allowlist, *, a prefix, a near miss, the entry-point name of an untrusted distribution), installed after the process started, or handed straight to the registry | the process exits with plugin_not_allowlisted and binds no port; the registry and every route that loads plugins answer with the one code; the module is never imported |
secret_canary | hostile manifests, tools and inputs that name a stored secret, refused code runs, traversals, forged requests | a refusal echoes neither what it was given nor what the platform knows: the value is in no response, log record, run event or audit row (the #666 scan, with a planted-value control; the secret is resolved by the administrator's provider-status read at the end, because the refused paths stop before any resolution) |
unsafe_config_refused | every rule of REFERENCE_REQUIREMENTS, alone and all at once, through a real process | the process exits with that one violation by code and by the variable to change, binds no port; a test fails if a rule has no attack |
Routes covered, and routes not. Covered (each with the control that the same input runs on the development profile): validate, compile, publish, promote, preview (saved version and manifest override), queued run (by alias and by version), event trigger, cron scheduler, service invoke, evaluation, import, export, the same hostile version run by a separate execution-owner process, a restart over the same database, sixteen concurrent publishes and promotions, an edit after validation, a dormant node, a code node reached through a subworkflow, an unknown node kind, an administrator's Python tool in both binding forms with the sandbox on and off (and rows that claim to be shipped, sandboxed, of a new backend, or that borrow a shipped callable's name in another module), an assistant tool draft, a tool test run, an MCP stdio command, file_input/folder_input escapes (dotdot, absolute, sibling directory, symlinked file, symlinked folder, glob walk), an output_folder write, the shipped extract_document tool, an upload named with a traversal, and plugins (unlisted, wildcard, prefix, near miss, entry-point name, no distribution, installed after start, handed straight to the registry).
Not covered here, and why: the synchronous POST /workflow-versions/{id}/run is closed before the version is looked at (409 sync_run_not_admitted), so it is not a code-refusal route (the unit test test_the_preview_run_and_evaluation_routes_answer_a_refused_manifest_by_the_code covers its refusal detail outside the reference profile); webhook and API-request nodes (their egress is enforced at the dispatcher, B04.3, and by ssrf_metadata_ip's guard, but the pack drives the guard through the OpenAPI spec-URL routes, the one operator-reachable fetch of a caller-supplied URL); model-selected tool calls (B04.6, test_b04_model_selected_calls.py); calibration runs, release evaluation, copilot edit, plan build and propose-patch (they compile through the same validate_manifest and compile_workflow the covered routes use; not driven separately); skill package import, object-store import and MCP invoke-tool. downstream.mutations() is the oracle for the external_app and registered-tool payloads; for python_code (restricted builtins, no out-of-process write) it is the sandbox spawn counter and the run's output, and for the separate owner process the import marker and the run's own failure. Exact examples of what each refusal says are in the sections above and in the table.
What the attack pack found and fixed.
- A shipped tool read any host path (a real bypass on main).
extract_documentis one of CALIBER's own shipped tools, so the profile admits it, but it opens whatever path it is given, and it runs in the tool-sandbox child, which has an empty environment and so knew neither the profile norCALIBER_WORKFLOW_FILE_ROOT. A tool node bound to it, given a path outside the root as the run input, completed (preview, queued run and tool test run) and returned the file's text. A prompt-injected or model-selected call would have exfiltrated any file the server can read. The fix is the smallest correct one: a reference-profile sandbox now hands its child exactlyCALIBER_PROFILEandCALIBER_WORKFLOW_FILE_ROOT, and the tool confines its path (caliber.workflows.host_paths): a path outside the root, a sibling whose name starts with the root's, a..and a symlink out are refused withPathOutsideRoot; no root refuses the read;unconfinedis refused withunsupported_in_reference_profile. The development profile and the content-pinned managed-file override (which takes a ref, not a host path) are unchanged. The audit of every shipped built-in (demo_tools,ingestion_tools,memory_tools,file_tools): the other host-path readers (read_text_file,list_folder_files,grep_files,regex_search) are refused wholesale (EP-055);list_workdir_files,read_workdir_file,get_file_metadata,write_workdir_file,create_artifactandgrok_parseare stubs or pure functions that open no path; the memory tools open no path. Inventory row EP-056 now says so. - Three routes dropped the refusal code. The preview-run, run and evaluation routes caught a compile failure in a broad
exceptand answered400withmanifest failed validation; cannot compile, dropping the code that publish, promotion, compile, import and the worker already carried. They now answer, for example,400 {"detail": "cannot preview: unsupported_in_reference_profile: python_code node 'code' runs author-supplied Python ..."}and400 {"detail": "failed to compile workflow 'WFV-...': unsupported_in_reference_profile: ..."}. The code is in thedetailstring, not a separate machine-readable field (publish, promote and the run summary carry it the same way). Nothing ran before the fix either.
Observations that are not defects. An MCP stdio command an administrator registers is refused by the MCP allowlist's own message (stdio command ... is not in CALIBER_MCP_STDIO_COMMAND_ALLOWLIST), not by the profile's code, because the reference profile lists no MCP command and the dispatcher admits an MCP call, never a server (B12.3b). python_code is a process boundary with ambient authority, but its source runs with restricted builtins, so the pack's python_code payload is observed by the sandbox spawn and the run's output rather than by a downstream write; the external_app and registered-tool payloads do write to the downstream. A python_code node in ordinary Preview is blocked in every profile ("Preview cannot isolate"); the refusal is observed on the routes that really run it.
The pack bites: mutation check. caliber/scripts/attack_pack_mutants.py copies src/caliber, breaks the refusal code in one way at a time (a registry kind classified inert, the policy never bound, every registered Python tool treated as shipped, validation and compile refusals removed, promotion not preflighted, the inventory refusals never firing, a plugin allowlist matched by prefix, startup accepting an unlisted plugin, an unconfined root or CSRF off, the file root not confining, the CSRF signature, the proxy secret and the egress pin, address list and literal-address checks) and runs the pack against each copy, including the CALIBER processes it starts. Every mutant must be killed. python scripts/attack_pack_mutants.py --check verifies that every edit's anchor still exists exactly once (offline; also a unit test, caliber/tests/test_attack_pack_mutants.py).
cd caliber
CALIBER_TEST_POSTGRES_URL=postgresql+psycopg://caliber:caliber@localhost:55432/caliber_egi_admin \
python -m pytest tests/egi_scenarios/test_v14_reference_profile.py --no-cov -q # the pack
CALIBER_TEST_POSTGRES_URL=... python scripts/attack_pack_mutants.py # the mutation check
Configuration, migration and rollback. No new setting, no migration and no stored data change; the only product change is the text of three 400 details. Trusted-code admission is not containment. The pack proves that code and plugins the profile does not admit are refused, and that an allowlisted plugin is admitted; it does not claim an allowlisted plugin, or the sandbox, contains hostile code.
Acceptance predicates (B09.1, #779)
A run is accepted on an authoritative domain predicate over what the system of record says, never on an HTTP status or on what a model wrote. caliber.acceptance holds the first piece: pure predicates over observations the caller has already read. A predicate does no I/O, reads no clock and draws no random number, so the same observations always give the same verdict, judging calls and changes nothing downstream, and a recorded observation can be judged again later without touching the downstream. The module imports only the standard library, and a test asserts that it imports no httpx, requests or sqlalchemy.
from caliber.acceptance import HARBORLIGHT_V1, Observations, evaluate_all
observations = Observations(
{
"proposal": {
"case_id": "MORT-2026-000184",
"document_type": "pay_statement",
"expected_version": 1,
},
"receipt": {"downstream_request_id": "DR-0001"},
"case_record": {
"case_id": "MORT-2026-000184",
"version": 2,
"document_requests": [
{"request_id": "DR-0001", "document_type": "pay_statement", "case_version": 2}
],
},
}
)
for result in evaluate_all(HARBORLIGHT_V1, observations):
print(result.predicate_id, result.passed, result.evidence_ref)
# document_request_exists True /case_record/document_requests/0
# attached_to_expected_version True /case_record/document_requests/0/case_version
Observationsis a frozen mapping of downstream reads and receipts. Dictionaries become read-only mappings and lists become tuples; the source is copied. Only JSON-shaped values are accepted: exact built-in strings, integers, finite floats, booleans andNone(astrorintsubclass is refused, because it can override equality), string-keyed mappings and lists, at most 32 levels of nesting (the top mapping is level 1), so nothing a predicate sees can change underneath it. A mapping or list whose accessors raise is refused, not propagated. The number of entries is not bounded here; the caller bounds what it reads.as_dict()returns a plain copy for a digest or a stored record.Predicate(id, criteria_version, rule_ids, evaluate)is one criterion (all predicates of a set are critical: a failed one rejects the candidate; there is nocriticalflag).idand eachrule_idare lower-case identifiers ([a-z0-9][a-z0-9._-]{0,127}, the shape of a rule id in a rule bundle) andcriteria_versionis[a-z0-9][a-z0-9._-]{0,63}.evaluatereturns aCriterionResult(predicate_id, passed, evidence_ref)whoseevidence_refis the RFC 6901 JSON pointer, into the observations, of the value that decided it.evaluate_all(predicates, observations)returns every result in the order given and does not stop at a failure. All the predicates must share onecriteria_version(a decision is made under one version).check_predicate_set(predicates)runs just those set checks (non-empty, allPredicate, unique ids, one version) and returns the tuple; B09.2a uses it to know the criteria version of a decision without judging.
Harborlight, HARBORLIGHT_V1 (criteria version harborlight-v1) reads three keys, all required: proposal (case_id, document_type, expected_version), receipt (downstream_request_id) and case_record (case_id and document_requests[], each with request_id, document_type, case_version):
| Predicate | Passes when |
|---|---|
document_request_exists | the case record lists the request the receipt names, with exactly the proposal's document_type |
attached_to_expected_version | that request's case_version is expected_version + 1 |
Both fail closed: a missing, malformed, mismatched or ambiguous value is a failed criterion, never an exception and never a pass. Every failure points at what was wrong:
evidence_ref | Meaning |
|---|---|
/proposal/document_type, /proposal/expected_version | missing, not a (non-empty) string, or not a non-negative integer (a boolean is not an integer) |
/case_record/case_id | the proposal's case_id is missing or empty, or the record is of another case (compared exactly) |
/case_record/document_requests | the list is missing or not a list, or the receipt's request is not listed (or is listed with another document_type) |
/receipt/downstream_request_id | no usable receipt: the acceptance is judged against nothing |
/case_record/document_requests/N/request_id | the same request_id is listed twice (the receipt would not identify one request) |
/case_record/document_requests/N/case_version | the request is listed at the wrong or a non-integer version: a downstream that answered 2xx and left the case where it was, the false success of gap analysis V11 |
Three choices are worth knowing:
expected_version + 1, notexpected_version. The downstream (and the connector that dispatches to it) stamps a stored request with the case version after its mutation, one more than theIf-Matchit was sent; the document-request connector's own lookup check uses the same rule. A literal equality with the proposal's expected version would reject every real success, and equality with it now means the downstream did not advance the case.- The receipt is required and binding. Only the request the receipt names is judged. Without that, a refused second proposal for the same document type would be accepted on the first proposal's request. A dispatch that was refused has no receipt and so is not accepted.
- The case must be the proposal's. A case record of another case, or a proposal that names none, proves nothing.
The proposal's expected_version is an integer here; the connector's ProposalView.expected_resource_version is a string, so a caller converts it (and refuses a value that is not a decimal integer) before it builds the observations.
Contract errors are raised, not judged. PredicateError carries a stable code and a message that names a JSON pointer and never an observation value: invalid_observations (not a mapping, not JSON-shaped, too deep, a non-string key, a non-finite number, or observations that were not frozen into Observations), invalid_predicate (a bad id, criteria version or rule id, a non-callable evaluate, something that is not a Predicate), empty_predicate_set (a decision over nothing would accept everything), duplicate_predicate_id, mixed_criteria_versions, predicate_failed (a predicate raised; the original is the __cause__) and invalid_result (not the predicate's own CriterionResult). Recovery: fix the caller. The one exception is invalid_observations raised while building Observations from what a downstream returned (a NaN, a non-JSON value, too deep): the caller must catch it and record the acceptance as rejected for that reason, not let it crash the run.
Configuration, migration and rollback. No setting, no endpoint and no stored data of its own: the predicates are pure. Persisting a decision is Acceptance decisions (B09.2a, #784); the runtime and status integration is Acceptance at run completion (B09.2b, #791), recording observations (#799) and replay (#805) build on them, and the consolidated acceptance report belongs to #612. The development profile is unchanged. Rolling back is reverting the change.
Acceptance decisions (B09.2a, #784)
caliber.acceptance.decision turns the predicates' verdict into a stored decision. judge(predicates, observations) is pure (no database, no I/O) and returns a Verdict; record_decision(session, ...) judges and stores the verdict in the caller's transaction (it flushes and never commits, so the decision lands or rolls back with whatever the caller does next, such as completing the run, #791). The package root caliber.acceptance stays I/O-free: import caliber.acceptance.decision explicitly.
from caliber.acceptance import HARBORLIGHT_V1
from caliber.acceptance.decision import record_decision
with Session(engine) as session, session.begin():
recorded = record_decision(
session,
workflow_run_id="run-123",
candidate_id="prop-9f2c", # the effect proposal (or counterfactual candidate) that was judged
predicates=HARBORLIGHT_V1,
observations={"proposal": {...}, "receipt": {...}, "case_record": {...}},
)
recorded.decision.outcome # "accepted" or "rejected"
recorded.decision.failed_criteria # ("attached_to_expected_version",) for a downstream that answered 2xx and left the case where it was
recorded.created # False when the same decision was already recorded
What identifies a decision. (workflow_run_id, candidate_id, criteria_version, observation_digest) is unique (uq_acceptance_decision_key). observation_digest is the SHA-256 of the canonical JSON of the observations the predicates saw (sorted keys, no whitespace, UTF-8, so key order does not matter). Recording the same decision again, also from a concurrent worker, returns the stored row with created false and changes nothing (the first decision keeps its decided_at). A new candidate, a new criteria version or any other observation is a new decision: a run can hold several, for example a retry whose observations differ from the first attempt's. One key with a different verdict (the predicates changed without a new criteria version) is decision_conflict and never replaces the first. The observation bytes are not stored here; only their digest is (recording them in StorageBackend is B09.3, #799).
What decides the outcome. Only the criteria. Every predicate is critical: the decision is accepted if and only if none failed. Nothing else is an input: judge and record_decision take no transport status, no model text and no override, and the table refuses an accepted row that has a failed criterion even from raw SQL (ck_acceptance_decision_critical). The stored criteria list, in predicate order, is the per-criterion evidence: predicate_id, passed, evidence_ref (the JSON pointer into the observations of the value that decided it, as above) and the rule_ids the predicate enforces; criteria_total and criteria_failed count them.
Unreadable observations are a recorded rejection, not a crash. If the observations cannot be frozen (invalid_observations: not a mapping, a NaN, a non-JSON value, nesting past 32 levels, text that is not valid Unicode), the decision is rejected with no criteria, reason_code invalid_observations and reason_detail set to the contract error's redacted message: a JSON pointer whose mapping keys are elided to * (list indexes stay, e.g. /*/*/1 is not a finite number) and a type, never a key or a value, because a key is downstream data and the row is write-once (non-ASCII is replaced and the text is cut at 512 characters; PredicateError.redacted). Its digest covers that detail, so unreadable observations with the same problem at the same place (keys elided) are one decision, and another problem or another place is another. Every other predicate contract error (empty_predicate_set, duplicate_predicate_id, mixed_criteria_versions, invalid_predicate, predicate_failed, invalid_result) is raised as PredicateError and nothing is stored: a bug cannot become an accepted run or a silent rejection.
Refusals. AcceptanceError carries a stable code; its message never carries an observation value.
code | Meaning | Recovery |
|---|---|---|
bad_field | workflow_run_id is not 1..64 characters, candidate_id does not match [A-Za-z0-9][A-Za-z0-9._:-]{0,127}, or now is not a datetime | fix the caller |
unknown_run | the run does not exist (checked by the writer on SQLite, where foreign keys are not enforced, and by the foreign key on PostgreSQL) | record only for a run that was admitted |
decision_conflict | a different verdict is already stored under this run, candidate, criteria version and observation digest | the stored decision stands; ship the changed predicates under a new criteria_version |
decision_corrupt | a reader found a row whose criteria do not match its counts or its outcome (a row inserted around the application) | treat the run as unaccepted and investigate the row; readers never repair it |
store_failed | the database refused the row for a reason other than the key (a defect, or the migration has not run) | run alembic upgrade head; the session stays usable and nothing was stored |
read_decision, find_decision and decisions_for_run (oldest decided_at first, ties by decision id) rebuild the record from the stored columns and verify it, so a reader never sees a decision other than the one the row states. A run holds one decision per key, so which of a run's decisions settles the run is the runtime's rule, not stored here: see Acceptance at run completion.
Migration 0135. Creates caliber_acceptance_decisions: a unique key, CHECK constraints (an accepted row has no failed criterion and no reason; a row has criteria or an invalid_observations reason, not both; counts are in range; the digest is 64 characters), a foreign key to caliber_workflow_runs (enforced on PostgreSQL), and write-once triggers on SQLite and PostgreSQL (UPDATE and DELETE; PostgreSQL adds a TRUNCATE trigger and revokes UPDATE, DELETE and TRUNCATE from PUBLIC; the trigger function is pinned to the migration's schema). A role that was granted those privileges anyway is stopped by the trigger. The ORM refuses edits and bulk changes too. On SQLite a BEFORE INSERT trigger also refuses an insert whose id or key already exists, so INSERT OR REPLACE cannot swap a decision (it deletes without firing the DELETE trigger); unenforced foreign keys remain possible from raw SQL, as for migration 0133. The PostgreSQL protection holds against a non-owner role only: the application runs as the table owner by default (see the 0114 section above), and an owner can disable triggers and grant itself privileges, so run the application as a role that does not own the tables where this evidence must resist the application itself.
Deleting runs. A run with a decision is retained evidence: deleting a workflow whose runs carry one is refused with 409 (cannot delete workflow: its runs have immutable acceptance decisions), and retention pruning (prune_workflow_runs) skips such runs, so neither orphans a decision (SQLite) nor breaks on its foreign key (PostgreSQL).
For the evidence package (#826) and the other consumers. The runtime integration (#791) is Acceptance at run completion (B09.2b, #791) below and settled the questions this section used to leave open: it passes HARBORLIGHT_V1 explicitly, audits decision_conflict and decision_corrupt, defines which decision settles a run, and fixes the candidate_id convention. A predicate that raises is a PredicateError and nothing is recorded. The migration is purely additive and nothing reads the table before the code that writes it, so migrations run before the new code serves with no rolling-deploy hazard. There is no backfill: runs that finished before this revision have no decision and are never given one. Rollback: alembic downgrade 0134 drops the table and its function and loses the stored decisions; reverting the code alone leaves the table in place and unused. No setting is added and the development profile is unchanged.
Acceptance at run completion (B09.2b, #791)
A queued run that the worker would mark completed is first judged by the platform. In the reference profile the worker calls caliber.acceptance.completion.evaluate_run for the run it owns, and the run is completed only if every effect of the run that has a criteria set (today: document-request; not the generic http webhook) has an accepted decision. A downstream that answered 2xx and committed, but whose record of the case is wrong, does not make the run a success (gap-analysis V11, "false success"): the run is failed with error_code acceptance_rejected, and the rejection is a stored decision. Nothing the model wrote, the manifest, the request or the HTTP status of the dispatch is an input.
What is judged. Every effect proposal of the run whose connector has a criteria set (CRITERIA_BY_CONNECTOR: document-request, judged by HARBORLIGHT_V1, passed explicitly so the criteria version is the registry's and never a caller's). The platform builds the observations itself, from its own records and one read of the downstream:
| Observation | Source |
|---|---|
proposal.case_id, proposal.document_type | the proposal's recorded resource (cases/<case_id>/document-requests, exactly that shape) and recorded arguments |
proposal.expected_version | the proposal's expected_resource_version text, converted strictly to an integer: 0 or digits with no leading zero, ASCII only, at most 18 digits. "01", " 1", "+1", "-1", "1.0", "1e3", a non-ASCII digit and a missing version are not converted and the criterion then fails closed (/proposal/expected_version) |
receipt.downstream_request_id | the proposal's own verified receipt, read back and recomputed (read_receipt). No receipt (a refused or never-sent dispatch) means the effect is not accepted |
case_record | the downstream's record of that case, read now by the platform (GET /cases/{case_id} at the base_url of the project's CALIBER_EFFECT_CALLBACK_CONNECTORS binding, the address the reconciler asks, through the guarded OpenAPI read, 5 s, one attempt), projected onto the keys the criteria read (case_id and each request's request_id, document_type and case_version) so an unrelated field changing never makes the same effect a new observation |
A case that cannot be read (no binding for the project, a connection error, a status other than 200, a body that is not a case, a list of more than 10 000 requests) is simply absent: both criteria fail closed and the decision is a recorded rejection. The run does not wait for a downstream that may never answer; a new run is the retry. A pass reads each distinct case once, however many of the run's effects are on it; the worker's heartbeat has already stopped when the pass runs, so a run whose effects are on many different cases that are all unreachable spends up to 5 s on each before it fails (keep that well under CALIBER_WORKFLOW_RUN_LEASE_SECONDS). Observations that cannot be frozen as JSON (for example a NaN) are the existing invalid_observations rejection, never a crash. A proposal with no expected_resource_version cannot satisfy attached_to_expected_version and is rejected: propose document requests against the case version you read (the downstream stamps the stored request with that version plus one).
The candidate id of a decision about a run's own effect is the proposal's id (prop-<32 hex>, is_proposal_candidate). A candidate that is not a recorded proposal (a counterfactual candidate, B09.5 #812, resolved by the evidence package, B14.2 #826) must use another prefix, since candidate_id has no foreign key.
Which decision settles the run. The decision the completion pass obtained for each candidate (record_decision's return value, never an ordering by decided_at). The run is accepted if and only if every one is accepted; one rejection rejects the run, and every candidate is judged so each has a decision. The ids are kept in the run's summary. A decision is recorded in the worker's transaction and commits with the run's terminal status, so it cannot outlive a rolled-back completion; judging the same observations again (a restart, a replay, a concurrent worker) returns the same row and stores nothing new. A downstream that now shows something else is a new observation, a new decision, and the first stays as evidence.
Failure is closed and audited. A different verdict under a stored key (decision_conflict), an inconsistent stored row (decision_corrupt), a criterion that raises (predicate_failed), a refused store and any unexpected error fail the run with error_code acceptance_error, take back the decisions of that pass, write an acceptance_error audit entry (severity high, with the fixed code and the exception type, never an observation value) and are logged; none is swallowed and none is a pass.
Public record. GET /workflow-runs/{id} (and every response that serializes a run, the SDK's WorkflowRun.acceptance and the UI's WorkflowRun.acceptance) carries acceptance:
{"status": "rejected", "criteria_version": "harborlight-v1", "error_code": null,
"decisions": [{"decision_id": "acc-...", "candidate_id": "prop-...", "outcome": "rejected",
"observation_digest": "<64 hex>", "failed_criteria": ["attached_to_expected_version"]}]}
status is accepted, rejected or error (error_code says why). acceptance is null for a run that has no effect with a criteria set and for every run that completed before this existed: legacy completed runs are never relabelled. No lifecycle status was added: a run that is not accepted never reaches completed, so every consumer that reads completed as success stays correct (status_after_acceptance in caliber.workflows.run_state). A summary whose acceptance is present but unreadable is served as error (acceptance_unreadable), never as acceptance.
| Run | status | error_code | acceptance.status |
|---|---|---|---|
| every governed effect accepted | completed | none | accepted |
| a downstream 2xx whose recorded state is stale, wrong or missing, or a case that cannot be read | failed | acceptance_rejected | rejected |
| a decision could not be recorded or read, or a criterion broke | failed | acceptance_error | error |
| no governed effect with criteria, or a run from before this change | completed | none | null |
Recovery. acceptance_rejected: read acceptance.decisions[].failed_criteria and the decision row's evidence_ref pointers (they name the value that decided each criterion), look at the downstream's own record of the case, and start a new run; the original effect is not undone and is not sent again (the receipt and the proposal stay committed). acceptance_error: the audit entry names the code; decision_corrupt and decision_conflict mean a decision row or the predicates changed under a stored key (see the refusal table above), predicate_failed is a defect in a criterion.
Configuration, compatibility and rollback. No setting, no migration and no endpoint were added; it uses migration 0135. Only the reference profile judges a run; the development profile has no governed effect and keeps its completion unchanged. One behavioural change: in the reference profile a document-request effect without an expected_resource_version now fails its run (acceptance_rejected) where it used to complete. The causal-links acceptance marker stays not_available (acceptance_record_not_available): linking decisions into the causal chain and the evidence package is B14 (#818, #826), which resolves the candidate ids above. Existing run records and GET responses gain one nullable acceptance field. Rolling back is reverting the code; the decision rows and the acceptance entries already written remain (the summary is a JSON column) and are ignored by older code.
Evidence package contract (B14.1, #818)
evidence_package v1 is the strict contract for a later authorized assembler. It is not an endpoint or a backfill: B14.2 will select and join the persisted records, and the verifier will consume the package only after that work is complete. The package's view.authorization must be authorized; view.redaction records whether policy redaction was applied, so a caller cannot silently widen the evidence scope.
The package contains the complete selected membership, each member's registered record kind, payload and metadata digests, parent ids, explicit missing_links, and evaluator provenance (including criteria, provider/simulation, input/result, and optional observation digests). Member ids are unique. A parent id must name another package member or an expected_member_id explicitly declared as missing. A member's metadata_sha256 is the SHA-256 of its canonical metadata object; package_sha256 is the SHA-256 of the canonical package manifest, including the authorized view, membership, parent links, missing-link declarations, and evaluator provenance, but excluding itself and optional signatures. Members and parent ids are normalized before hashing, so presentation order cannot change the package identity.
Refusal and recovery. Unknown schema versions, unknown fields, unregistered member kinds, duplicate members, altered metadata, broken parent links, and a missing or mismatched package digest are refused as evidence_package is invalid: .... Preserve the original control records, correct the assembler's selected view or explicit missing-link declaration, recompute the affected member/package digests, and revalidate before publishing a package. Do not infer a missing record, accept an altered linkage, or treat a signature as repairing a bad package digest. There is no migration or deployment setting in B14.1; rolling back the schema registration removes package validation but does not rewrite existing records.
Authorized evidence-package assembly (B14.2, #826)
caliber.evidence.assemble(session, run_id=..., identity=...) is the server-side, read-only producer for the v1 contract. It first authorizes the persisted run through the same project visibility boundary as run reads, then derives tenant, region, project, selected membership and the redaction marker from server state. The caller supplies neither a project nor a view selector. A projectless or otherwise unrepresentable run is refused explicitly; the assembler never invents a default project or broadens a legacy visibility scope.
The returned package is a digest-only authorized projection. It joins only rows belonging to the requested run, records payload digests without copying intent, context, receipt or other payload bytes, and emits parent links for manifest, context, proposal, receipt, policy decision and approval records. Missing receipts, approvals, decisions, manifests and acceptance decisions remain explicit missing_links or not_required/pending/unrecorded entries. When no persisted acceptance decision exists, evaluator_provenance is empty rather than fabricated from unrelated run fields; the acceptance missing link is authoritative. If an acceptance decision exists, its stable criteria and observation digest are carried as the available provenance.
The package digest is computed by the public contract canonicalizer shared with validation: every field except package_sha256 and optional signatures is covered, member and parent ordering is normalized, and the complete record is validated before bytes are returned. This slice adds no HTTP export, storage retention, signature, verifier or SDK model; those consumers must use the same canonical manifest and must not read foreign payloads to fill an absent link. There is no migration or deployment setting for B14.2; rollback is reverting the assembler and its tests while leaving the already-registered contract unchanged.
Evidence archive export (B14.3a, #833)
GET /ajax-api/2.0/mlflow/caliber/workflow-runs/{run_id}/evidence materializes the already-authorized B14.2 package as a deterministic ZIP. The archive contains the canonical manifest.json plus one JSON payload at members/<sha256(member_id)>.json for each selected member; it contains no workflow files, traces, checkpoints or observations. The route resolves the identity and project server-side, applies the same run visibility and payload-read policy as the run surface, and never accepts a caller-supplied project or authorization scope.
When the identity may not read raw payloads, redaction is applied to payloads, metadata and evaluator provenance before their member, package, archive and object-key digests are computed. Authorized raw and redacted views therefore have distinct package identities and scope-bound storage keys. A configured process redactor cannot silently redact an identity that has been authorized for raw payloads. Unredacted and redacted exports are independently cached by (run, package view, authorization-scope digest); conditional object creation and digest verification prevent a concurrent exporter or a storage-key collision from overwriting bytes.
Archive bytes are written through the project's configured StorageBackend and indexed by caliber_evidence_archives, including the package digest, authorization-scope digest, member ids, storage locator and archive digest. Generic workflow-run pruning retains runs with an archive. The expiry, deletion, tombstone/HTTP-410 behavior and signatures remain later slice #845; this export is an integrity-checked archive, not proof of origin. Migration 0138 is required; rollback removes the archive table and export route but does not delete already-written storage objects.
Evidence archive verification (B14.3b, #840)
The server verifier and the server-free SDK/CLI verifier both fail closed before extraction. They reject duplicate or unsafe ZIP paths, directories and symlinks, encrypted or unsupported entries, malformed or CRC-invalid members, archive/member/total-size and compression- ratio violations, a non-canonical manifest, unknown or mismatched package/member digests, exact-membership changes, unsupported declared schema versions, and broken parent or explicit-missing-link declarations. Verification reads members through bounded ZIP streams and never calls extractall.
The SDK exposes synchronous and asynchronous evidence download methods; the CLI's workflow evidence command verifies before optional output and refuses an existing path unless --force is explicit. These checks establish archive and package integrity only. Beta archives have no signature, so origin_verified is false and verification does not establish server origin, authorization, freshness, retention, deletion, or provenance. The standalone SDK/CLI verifier intentionally uses only their installed standard-library dependencies rather than importing the server package.
Evidence archive retention and expiry (B14.4, #845)
Each export is assigned expires_at = exported_at + evidence_retention_days; the default is 365 days and the operator setting is CALIBER_EVIDENCE_RETENTION_DAYS. The janitor uses the configured StorageBackend to delete expired archive bytes, then records deleted_at and tombstone_json = {"removed_members": [...]} on the retained archive row. Deletion is recorded only after the storage operation succeeds, so a transient storage failure leaves the archive retryable and does not produce a false 410.
After a tombstone exists, GET /ajax-api/2.0/mlflow/caliber/workflow-runs/{run_id}/evidence returns HTTP 410 with {"reason":"evidence_expired","tombstone":{"removed_members":[...]}}. The route never recreates an expired scope/view archive. A zero-day retention setting expires an archive immediately after export and is suitable for lifecycle tests; normal deployments should keep the 365-day default or choose an explicit non-negative window.
Beta fault matrix (B16.1, #881)
The Beta fault matrix is the deterministic offline oracle for the fourteen V01–V14 fault injections. Each row names the collected scenario case and remains automated only when that case is collected and passes; the matrix does not claim live-provider quality, production deployment, independent security review, or restore evidence.
For a reproducible local check, run:
PYTHONPATH=caliber/src caliber/.venv/bin/python -m pytest caliber/tests/test_beta_fault_matrix_contract.py
When a run parks with an approval or an unknown effect, preserve the original run/release pins and use the owner/reconciler recovery path documented in the reference-profile recovery runbook. Never retry an unknown external mutation by sending a second request; reconcile by its stable effect key and record the downstream evidence before marking it committed. A changed policy, destination, or approval identity requires a new decision and must not reuse the old grant.
Not enforced yet
ADR 0001 describes the whole reference shape; this table is what the process checks today. Not checked:
- The shape itself: one tenant and region, MLflow addressed by
MLFLOW_TRACKING_URI, an S3-compatible object store, at least two projects, and one real model provider next to the scripted adapter. Readiness reporting for MLflow and the object store is #535. The PostgreSQL version and thepgvectorextension are checked by the migrations (migration0060) and the migration-parity CI job, not by the profile. - Origin rules (#533). ADR 0001 names them, but #533 has no allowed-origins task yet; that rule is not scheduled.
- The trusted-connector set (#534), the full attack pack (#535), a single execution owner (#536) and the Apply separation-of-duties flag (#589).
- A governed effect context outside the supported worker path (#1051, #1068): the worker binds one for an admitted reference-profile run, and its nested subworkflows inherit only the operator-listed HTTP portion; synchronous version runs, evaluation, gate, Aria preview, calibration and export paths remain without a context, while registered/OpenAPI/MCP effects and unlisted HTTP URLs remain refused. Agents in worker subworkflows that can reach a mapped tool still have no governed step context and are refused; see "Profiles and a missing governed context".
- A verifier for the other workflow connectors (#1055, #1051): a registered-tool, OpenAPI or MCP node, and a webhook or API-request node whose URL the operator did not list in
CALIBER_EFFECT_HTTP_VERIFIERS, is refusedno_authoritative_verifierin the reference profile because the connector has no lookup by key the platform can call; a governed agent step reachesdocument_requestand a listed webhook reacheshttpend to end. A permanent unknown (a lookup that never shows the request) has the evidence-bearing #1054 operator exit: an execution-owner admin may attestfailedwith downstream absence evidence, but nevercommitted; a workflow node whose effect ended unknown fails its run and a settlement does not resume it. Model-chosen calls of an agent that is not governed (B04.6, #768) are not routed. - Acceptance covers
document-requesteffects only (#784, #791): in this profile a run is judged, and iscompletedonly when everydocument-requesteffect it proposed has anaccepteddecision (see Acceptance at run completion). Effects of any other connector, the operator-listed generichttpwebhook included, have no criteria set and are not judged: a run whose only effects are such completes as before withacceptance: null. The criteria set is the registrycaliber.acceptance.completion.CRITERIA_BY_CONNECTOR; adding a connector means adding its criteria, not a setting. - Cookie flags:
auth_session_cookie_secureis not checked. - The database role: whether the application connects as a role without
UPDATE,DELETEorTRUNCATEoncaliber_run_manifests(see "Run manifests are written once").
A configuration that passes this page is the minimum for the reference profile, not the whole of it.
Related
- Beta scope for what the reference profile supports, with the evidence behind each claim and the known limits.
- Reference profile recovery runbook for the operator steps when the owner dies, an effect is
unknown, a callback is redelivered or events back up. - Health and readiness for what the readiness response contains.
- Configuration and provider setup for the settings themselves.