MCPcopy Create free account
hub / github.com/github/gh-aw / isTransientSHAResolutionError

Function isTransientSHAResolutionError

pkg/cli/fetch.go:269–288  ·  view source on GitHub ↗

isTransientSHAResolutionError returns true when the ref-to-SHA failure appears transient and worth retrying (rate limits, network/timeout failures, or HTTP 5xx). All other errors are treated as permanent and fail immediately.

(err error)

Source from the content-addressed store, hash-verified

267// transient and worth retrying (rate limits, network/timeout failures, or HTTP 5xx).
268// All other errors are treated as permanent and fail immediately.
269func isTransientSHAResolutionError(err error) bool {
270 if err == nil {
271 return false
272 }
273
274 errorText := strings.ToLower(err.Error())
275 if strings.Contains(errorText, "http 429") ||
276 strings.Contains(errorText, "rate limit") ||
277 strings.Contains(errorText, "timeout") ||
278 strings.Contains(errorText, "timed out") ||
279 strings.Contains(errorText, "context deadline exceeded") ||
280 strings.Contains(errorText, "temporary") ||
281 strings.Contains(errorText, "connection reset") ||
282 strings.Contains(errorText, "connection refused") ||
283 strings.Contains(errorText, "eof") {
284 return true
285 }
286
287 return transientHTTP5xxPattern.MatchString(errorText)
288}
289
290// fetchGenericURLWorkflow fetches a workflow from an arbitrary HTTP(S) URL and dispatches
291// on the response Content-Type to produce a FetchedWorkflow.

Callers 1

Calls 2

ToLowerMethod · 0.80
ErrorMethod · 0.45

Tested by

no test coverage detected