# Circuit breaker policy management

**Last updated:** 2026-11-13T10:22:13-03:00 (UTC-3)

Adjust the [circuit breaker](/docs/features/resilience/) threshold and duration from the console or the API, without editing YAML or restarting. The change applies to all replicas. Flag: `resilience_management`, which requires `circuit_breaker`, the interface and PostgreSQL.

## How it works

The YAML (`resiliency.circuit_breaker`) is the baseline. An edit from the console writes an override to PostgreSQL, which wins until it is removed. Removing the override goes back to the YAML. With nothing declared, 3 failures and 30 seconds apply.

| Field | Values |
| --- | --- |
| `failure_threshold` | 1 to 100 |
| `open_duration` | 1 s to 10 min |

The policy is shared by the replicas through PostgreSQL. Failure observations remain local unless `shared_circuit_breaker` is explicitly enabled; see [shared state and checks](/docs/features/resilience/). Applying a new policy replaces the applicable observation generation.

## How to use it

**In the console:** **Providers → Circuit breaker policy**. Admin and operator edit and revert; viewer only reads.

**Through the API:**

| Method | Permission | What it does |
| --- | --- | --- |
| `GET /api/v1/admin/resiliency` | `resilience:read` (global admin, viewer, operator) | Version, source (YAML or override) and the values in effect |
| `PUT /api/v1/admin/resiliency` | `resilience:manage` (admin, operator) | Writes the override; requires `version` and both fields |
| `DELETE /api/v1/admin/resiliency` | `resilience:manage` | Removes the override and goes back to the YAML; 404 if there is no override |

Writes require a console session on the same origin and a CSRF token, and are recorded in the audit trail.

## Concurrent edits

Every write carries the `version` you read. If someone else saved first, yours gets a 409 and the console keeps your draft for you to review or discard; a background refresh never overwrites a newer configuration.

If the write was confirmed but the following sync failed, the response is a 503 indicating that the commit happened. Check the state before trying again.

## Defaults and field origins

With the existing `boot_settings_view` flag, `GET /api/v1/admin/resiliency` adds an optional two-row `settings` projection. The circuit policy card shows each effective policy value separately from its field default (3 failures and 30 seconds), origin and change requirement. Omitted/null threshold and omitted/empty duration use defaults; explicit values equal to a default still have YAML origin. A managed override has Console origin for both fields. Reverting restores the original YAML origins. Untrusted programmatic origins remain **Unavailable**; this does not infer an installed circuit or provider health.

Default/YAML rows describe file changes, which require a rollout. Console rows describe the existing hot override. The same versioned API can replace a YAML-based policy without a restart; each replica applies it through its normal control refresh. Local observations reset when the new policy is applied; optional shared observations use fenced PostgreSQL generations. Late completions cannot restore an obsolete circuit state.

The existing stream-timeout editor separately receives an optional `defaults` map under the boot view: first byte 60s, idle 120s, maximum duration 30m and client write stall 60s. Equivalent Go duration formatting is expected. These are field defaults, not every operation's effective deadlines: model/runtime overrides can differ, and existing streams keep their captured clocks. Disabling the view removes only the new metadata; management permissions and enforcement remain unchanged.

Inference retries remain explicit per-model consent. Values suggested when creating a retry policy are editor presets, not an automatic retry policy; no new retry permission or replay after a response begins is introduced here.

The editor rejects malformed policy snapshots without echoing arbitrary values. An observed 401/403 or disabled endpoint clears its snapshot and draft; permission/flag loss invalidates pending replies. A later authorized load can restore the reader. Conflict or validation errors retain the correction draft and its captured version, including version zero; a reload never silently rebases it.

## Limits

- Team roles neither see nor edit the global policy.
- Reading the policy says nothing about the provider's health.
- Shared failure counters require the explicit shared-circuit flag. No policy adds retries or guarantees zero errors during a rollout.

## See also

- [Circuit breaker](/docs/features/resilience/).
- [Configuration parity](/docs/reference/configuration-parity/): what can be edited in the console and what stays in the YAML.

## Shared policy definitions

The [parameter registry](/docs/reference/parameter-registry/) owns the existing failure threshold and open-duration defaults and constraints used by Go policy validation, safe metadata and console controls. This does not report circuit health or add a mutation path. File changes require rollout; the existing managed override, authorization, version checks, audit and replica refresh retain their behavior.

## Active checks and shared circuits (V2)

The new typed console controls require `boot_settings_view` so their parameter definitions are available. It is enabled in the bundled profile; if it is disabled or metadata is incompatible, the new controls remain read-only rather than guessing constraints. Enable the view and reload the console. YAML/API use remains available for headless operation.

The console explicitly requests `GET /api/v1/admin/resiliency?version=2`. This adds the raw optional `health_checks` and `shared_circuit` profiles, their resolved defaults, per-field sources, operational flags and live edit rights. Default/version1 keeps its historical circuit-only projection. Parameter catalog V23 adds the two typed policy definitions without changing versions1–22.

Edit active-check cadence, timeout, freshness, concurrency, failure/recovery thresholds and unknown-result policy in the existing resilience card. Edit the half-open lease when using shared circuits. Common `state_retention` and `state_timeout` controls expose idle cleanup and one shared-state action deadline, including effective values, defaults and sources. Configure an individual check in the model's target editor. The [health guide](/docs/features/resilience/) explains each default and the difference between metadata reachability and inference health.

All writes retain the global version, live role, CSRF, whole-candidate validation and audit boundary. An old PUT that omits new profiles preserves their authoritative values; explicit `null` removes the named optional profile, subject to before/after permissions and license checks. Reverting also checks the profile being removed and the YAML profile being restored. A default-valued explicit object remains a real configuration choice.

Health-profile writes require the applicable rights for both active checks and health routing; shared-profile writes require the shared-circuit right. The API exposes these edit capabilities without granting them. A reader can inspect effective configuration while an expired or restricted license makes the affected editor read-only. Operational flags remain independent of authorization.

The V2 observation panel labels process-local circuits, PostgreSQL shared circuits and active checks separately. An empty or stale observation is not a healthy deployment. Shared mode does not add passive circuit coverage to unrelated realtime/resource helper paths, and a probe success never closes a passive circuit. Existing object retrieval remains pinned.
