Repository navigation
fix(circuit-breaker): advise when per-agent toggle is inert with the global gate off (#1491) - #1499
Merged
Merged
Conversation
…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]>
|
Resolve by running |
vybe
approved these changes
Jul 7, 2026
vybe
left a comment
Contributor
There was a problem hiding this comment.
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
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
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
The dispatch breaker is two-tier gated (platform
DISPATCH_BREAKER_ENABLEDAND per-agentcircuit_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
warningwhenenabled=trueis 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 fieldTesting
tests/unit/test_1491_circuit_breaker_advisory.py— warning-when-global-off, none-when-global-on, none-when-disabling, write-always-succeeds (4 passed).Fixes #1491.
🤖 Generated with Claude Code