feat: gate in-call demotion on credible alternative health
Round 3 showed unconditional yield-after-two-failures pushes the third attempt onto known-bad sources in heterogeneous pools (83% vs 10% expected success). OutcomeAwareSelector now exposes health(); a failed source only yields when some untried candidate scores at least half its health. Health-blind selectors keep the unconditional rule.
This commit is contained in:
@@ -63,6 +63,10 @@ class HealthAwareSelector:
|
||||
prev = self._ewma.get(source_name, 1.0)
|
||||
self._ewma[source_name] = prev + _EWMA_ALPHA * ((1.0 if ok else 0.0) - prev)
|
||||
|
||||
def health(self, source_name: str) -> float:
|
||||
"""EWMA 裸值(OutcomeAwareSelector 端口): RetryMW 降权门槛用。"""
|
||||
return self._ewma.get(source_name, 1.0)
|
||||
|
||||
def _score(self, name: str, stats: dict[str, SourceStats]) -> float:
|
||||
ewma = max(self._ewma.get(name, 1.0), _SCORE_FLOOR)
|
||||
inflight = stats[name].inflight if name in stats else 0
|
||||
|
||||
Reference in New Issue
Block a user