Skip to content

fix(circuit-breaker): advise when per-agent toggle is inert with the global gate off (#1491) - #1499

Merged
vybe merged 1 commit into
devfrom
fix/1491-circuit-breaker-advisory
Jul 7, 2026
Merged

vybe merged 1 commit into
devfrom
fix/1491-circuit-breaker-advisory

Conversation

@dolho

@dolho dolho commented Jul 7, 2026 •

Copy link
Copy Markdown
Contributor

Problem

The dispatch breaker is two-tier gated (platform DISPATCH_BREAKER_ENABLED AND per-agent circuit_breaker_enabled). PUT /api/agents/{name}/circuit-breaker {"enabled":true} with the global flag off returned a plain 200 — the owner had no signal their toggle was inert.

Fix

The PUT response now includes a non-fatal warning when enabled=true is set while the global flag is off. The write still succeeds (the preference applies once the global flag flips on). No advisory when disabling or when the global flag is on — response unchanged there. Advisory only — no breaker-logic or gate change.

{ "agent_name": "asdfsdf", "enabled": true, "global_enabled": false,
  "warning": "Per-agent toggle saved, but the breaker stays inactive until the platform-wide DISPATCH_BREAKER_ENABLED flag is enabled." }

Acceptance

  • {"enabled":true} with global off → 200 + advisory field
  • No behavior/response change when the global flag is on
  • "Owner UI toggle reflects the advisory" — N/A: no owner-facing breaker toggle exists today (the agent-header badge is read-only display). The API now carries the advisory for whenever such a toggle is built.

Testing

  • tests/unit/test_1491_circuit_breaker_advisory.py — warning-when-global-off, none-when-global-on, none-when-disabling, write-always-succeeds (4 passed).
  • Live: verified the advisory appears/absent per the two cases; toggle reset to off after.

Fixes #1491.

🤖 Generated with Claude Code

…global gate off (#1491)

The dispatch breaker is two-tier gated: it engages only when BOTH the platform
`DISPATCH_BREAKER_ENABLED` flag AND the per-agent `circuit_breaker_enabled`
toggle are on. Turning the per-agent toggle on via
`PUT /api/agents/{name}/circuit-breaker` while the global flag is off returned a
plain 200 — the owner had no signal their switch was inert ("switch is on but
nothing happens").

The PUT now includes a non-fatal `warning` in the response when `enabled=true`
is set while the global flag is off. The write still succeeds (the stored
preference applies once the global flag flips on); no advisory when disabling or
when the global flag is on — response unchanged there. Advisory only: no change
to breaker logic or the two-tier gate.

Tests: `tests/unit/test_1491_circuit_breaker_advisory.py` (warning-when-global-off,
none-when-global-on, none-when-disabling, write-always-succeeds) — 4 passed.
Live: `{"enabled":true}` with the global flag off → 200 + the advisory;
`{"enabled":false}` → no advisory.

Note: no owner-facing UI *toggle* for the breaker exists today (the agent-header
badge is read-only display), so there is no toggle to surface the advisory on —
the API now carries it for whenever a toggle is built. The acceptance item
"owner UI toggle reflects the advisory" is therefore N/A until that toggle lands.

Related to #1491.

Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]>
@github-actions

github-actions Bot commented Jul 7, 2026

Copy link
Copy Markdown

⚠️ Nightly unit-suite check skipped — merge conflict against dev.

Resolve by running git merge dev locally and pushing the result. The next nightly run will re-test once the conflict is gone.

@vybe vybe left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Validated via /validate-pr: focused advisory-only change, 4 named regression tests (test_1491_*), CI green incl. pytest head runs, security sweep clean. Approving.

@vybe
vybe merged commit 8ecd052 into dev Jul 7, 2026
18 checks passed
vybe pushed a commit that referenced this pull request Jul 21, 2026
…#1712) (#1717)

* fix(reliability): honest per-agent circuit-breaker toggle in Settings (#1712)

The dispatch breaker is two-tier — per-agent `circuit_breaker_enabled` AND the
platform-wide `DISPATCH_BREAKER_ENABLED` must both be on. The endpoint already
returns `config.global_enabled` (GET) and a `warning` (PUT) when a toggle is
inert (#1491/#1499). The residual #1712 gap was the UI: there was no owner-facing
toggle at all — it was a growth-path TODO in SettingsPanel — and the API-level
"toggle reports success while doing nothing" had no honest surface.

New `ReliabilityPanel.vue` (agent Settings tab):
- Reads `config.global_enabled` from the endpoint (consumes, doesn't infer), so
  the honest state shows on every (re)load — including a persisted-but-inert "on".
- When the global flag is OFF: a clear amber notice names the REASON (the
  platform-wide flag is off) and the REMEDY (an admin sets
  `DISPATCH_BREAKER_ENABLED=true` in the environment) — it does not silently
  accept-and-succeed. The toggle stays operable (the owner may pre-set their
  preference), with a "saved · inactive" badge so the inertness is explicit.
- On save while global-off, surfaces the endpoint's `warning` as the outcome,
  not a plain "Saved". When both flags are on, shows an "active" badge.

No change to gating semantics (both flags still required; config.py untouched).

Open question (global default) — decision: keep `DISPATCH_BREAKER_ENABLED=false`
for this release. Flipping it to true would start engaging the breaker for any
already-opted-in agent mid-freeze (a runtime behaviour change needing soak); the
honest UI removes the confusion without that risk. Revisit post-freeze. Recorded
on #1712.

Static guards (tests/unit/test_1712_*): fail if the panel drops the
global_enabled read, the warning surface, the reason/remedy copy, or its mount in
SettingsPanel — the honesty can't silently regress. Verified live: GET returns
`global_enabled:false` on this install; PUT enabled=true returns the inert
warning, which the panel surfaces.

Related to #1712

* ci: re-trigger unit suite (prior run cancelled, not a failure)

The pytest + regression-diff jobs on 6536a34 were CANCELLED mid-run (15m in),
not failing — this PR is frontend-only (ReliabilityPanel.vue + a static guard
test) and can't affect the Python suite. Empty commit for a clean run.

Related to #1712

* ci: raise backend-unit-test pytest timeout 15m → 25m (fixes spurious cancels)

The pytest matrix job runs ~7-8 min on a normal GitHub runner, but the shared
runners vary ~2-2.5x. A slow one was sitting at ~78% of the suite (all tests
passing — pure dots in the log) when it hit the 15-min `timeout-minutes` and got
killed, which surfaces as a red "pytest (…) fail" + a "regression diff" fail even
though the diff itself reports "No new failures". Seen repeatedly this cycle
(#1700, #1712) with zero real failures.

25 min gives headroom for the slow tail without masking a genuine hang —
pytest-timeout still bounds any single test. Not payload-specific; belongs on
dev so every PR stops flaking on runner variance.

Related to #1712
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants