MCPcopy Index your code
hub / github.com/docker/docker-agent / recordSuccess

Method recordSuccess

pkg/runtime/fallback.go:172–179  ·  view source on GitHub ↗

recordSuccess updates the per-agent cooldown state after a successful model attempt. If a fallback rescued a non-retryable primary failure, pin to that fallback for the cooldown window. If the primary itself succeeded, clear any existing cooldown (handles both a clean primary success and recovery af

(a *agent.Agent, modelEntry modelWithFallback, primaryFailedWithNonRetryable bool)

Source from the content-addressed store, hash-verified

170// succeeded, clear any existing cooldown (handles both a clean primary
171// success and recovery after a cooldown expires).
172func (e *fallbackExecutor) recordSuccess(a *agent.Agent, modelEntry modelWithFallback, primaryFailedWithNonRetryable bool) {
173 switch {
174 case modelEntry.isFallback && primaryFailedWithNonRetryable:
175 e.cooldowns.Set(a.Name(), modelEntry.index, getEffectiveCooldown(a))
176 case !modelEntry.isFallback:
177 e.cooldowns.Clear(a.Name())
178 }
179}
180
181// classifyAttemptError handles an error from a stream attempt: checks for
182// context cancellation, classifies the error, and returns either a

Callers 1

executeMethod · 0.95

Calls 4

getEffectiveCooldownFunction · 0.85
NameMethod · 0.65
ClearMethod · 0.65
SetMethod · 0.45

Tested by

no test coverage detected