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)
| 170 | // succeeded, clear any existing cooldown (handles both a clean primary |
| 171 | // success and recovery after a cooldown expires). |
| 172 | func (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 |
no test coverage detected