fix(failover): patch P1-P3 reliability gaps surfaced by team review

- Forwarder buffers non-streaming bodies and primes streaming first
  chunk before signaling success, so body timeouts and SSE first-chunk
  failures route through the circuit breaker instead of being recorded
  as success on response-header arrival
- Atomic enable-failover: switch to P1 before persisting the flag, and
  roll back auto-added queue entries when the switch is rejected
  (e.g. official providers)
- Hot-reload circuit breaker config on per-app proxy config change
  instead of waiting for a proxy restart
- FailoverToggle / FailoverQueueManager / AutoFailoverConfigPanel
  require proxy takeover for the active app; the backend command also
  rejects enabling when takeover is off
- ProviderHealthBadge consumes the backend is_healthy flag instead of
  hardcoding the 5-failure threshold

Cleanup:
- impl From<&AppProxyConfig> for CircuitBreakerConfig and use it from
  the command layer
- Collapse three identical TabsContent blocks into a single map
This commit is contained in:
Jason
2026-05-14 21:35:02 +08:00
parent 940161fb0e
commit b642ef0633
14 changed files with 389 additions and 98 deletions
+9 -1
View File
@@ -133,9 +133,17 @@ pub async fn update_proxy_config_for_app(
config: AppProxyConfig,
) -> Result<(), String> {
let db = &state.db;
let app_type = config.app_type.clone();
let circuit_config = CircuitBreakerConfig::from(&config);
db.update_proxy_config_for_app(config)
.await
.map_err(|e| e.to_string())
.map_err(|e| e.to_string())?;
state
.proxy_service
.update_circuit_breaker_config_for_app(&app_type, circuit_config)
.await
}
async fn get_default_cost_multiplier_internal(