feat: feed selector health and demote in-call failed sources

RetryMW keeps a per-call failure map (local, never instance state):
a source failing twice in one call yields to the next candidate.
Attempt outcomes feed OutcomeAwareSelector behind a swallow-and-warn
guard; ResultInvalid and provider-rejected paths record success with
count_attempt=False so the breaker window stays clean. Same accounting
applied in EmbeddingClient.
This commit is contained in:
2026-07-21 09:55:08 -04:00
parent e69dc05fd5
commit 4c2a148db9
5 changed files with 139 additions and 13 deletions
+4 -2
View File
@@ -25,9 +25,11 @@ class BreakerGate:
except Exception as exc:
raise GovernanceBackendError(f"熔断后端故障(try_enter): {exc}") from exc
async def record_success(self, entry: GateDecision) -> GateUpdate:
async def record_success(
self, entry: GateDecision, *, count_attempt: bool = True
) -> GateUpdate:
try:
return await self._gate.record_success(entry)
return await self._gate.record_success(entry, count_attempt=count_attempt)
except GovernanceBackendError:
raise
except Exception as exc: