MCPcopy Index your code
hub / github.com/anomalyco/opencode / retryStatusFailures

Function retryStatusFailures

packages/llm/src/route/executor.ts:353–364  ·  view source on GitHub ↗
(
  effect: Effect.Effect<A, LLMError, R>,
  retries = MAX_RETRIES,
  attempt = 0,
)

Source from the content-addressed store, hash-verified

351}
352
353const retryStatusFailures = <A, R>(
354 effect: Effect.Effect<A, LLMError, R>,
355 retries = MAX_RETRIES,
356 attempt = 0,
357): Effect.Effect<A, LLMError, R> =>
358 Effect.catchTag(effect, "LLM.Error", (error): Effect.Effect<A, LLMError, R> => {
359 if (!error.retryable || retries <= 0) return Effect.fail(error)
360 return retryDelay(error, attempt).pipe(
361 Effect.flatMap((delay) => Effect.sleep(delay)),
362 Effect.flatMap(() => retryStatusFailures(effect, retries - 1, attempt + 1)),
363 )
364 })
365
366export const layer: Layer.Layer<Service, never, HttpClient.HttpClient> = Layer.effect(
367 Service,

Callers 1

executor.tsFile · 0.85

Calls 1

retryDelayFunction · 0.85

Tested by

no test coverage detected