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

Function getEffectiveRetries

pkg/runtime/fallback.go:136–147  ·  view source on GitHub ↗

getEffectiveRetries returns the number of retries to use for the agent. If no retries are explicitly configured (retries == 0), returns the default to provide sensible retry behavior out of the box. This ensures that transient errors (e.g., Anthropic 529 overloaded) are retried even when no fallback

(a *agent.Agent)

Source from the content-addressed store, hash-verified

134// Note: Users who explicitly want 0 retries can set retries: -1 in their config
135// (though this is an edge case - most users want some retries for resilience).
136func getEffectiveRetries(a *agent.Agent) int {
137 retries := a.FallbackRetries()
138 // -1 means "explicitly no retries" (workaround for Go's zero value)
139 if retries < 0 {
140 return 0
141 }
142 // 0 means "use default" - always provide retries for transient error resilience
143 if retries == 0 {
144 return modelerrors.DefaultRetries
145 }
146 return retries
147}
148
149// chainStartIndex returns the index in the model chain (primary at 0,
150// fallbacks at 1+) at which to begin trying. Normally 0, but during an

Callers 2

TestGetEffectiveRetriesFunction · 0.85
executeMethod · 0.85

Calls 1

FallbackRetriesMethod · 0.80

Tested by 1

TestGetEffectiveRetriesFunction · 0.68