Class UpstreamRetryException

java.lang.Object
java.lang.Throwable
java.lang.Exception
java.lang.RuntimeException
ai.redouble.nucleo.harness.errors.retry.UpstreamRetryException
All Implemented Interfaces:
Serializable
Direct Known Subclasses:
OverloadRetryException, RateLimitRetryException, TransientErrorRetryException

public abstract sealed class UpstreamRetryException extends RuntimeException permits RateLimitRetryException, OverloadRetryException, TransientErrorRetryException
A provider could not serve this attempt and the framework should retry it transparently - without charging the job's own retry budget. The dispatcher has one backoff loop for every such signal; what varies by signal is carried here as data: how long to wait before the next attempt, and how hard the model's admission limiter should yield fleet-wide.

Three signals exist. A 429 (RateLimitRetryException) means this caller nudged past its own budget - standard pacing, one throttle increment. A 529 (OverloadRetryException) means the provider's fleet is saturated regardless of budgets, and every concurrent job is about to hear the same thing - longer pacing, a harder throttle bump, letting success-driven recovery walk it back. A plain 5xx or connection failure (TransientErrorRetryException) is a fault, not a slow-down request - standard pacing, no throttle: cutting the fleet's rate over a stray 500 would be an overreaction.

Since:
0.1 (2026-08-25)
Author:
Andrey Santrosyan
See Also:
  • Constructor Details

    • UpstreamRetryException

      protected UpstreamRetryException(String message, Throwable cause)
  • Method Details

    • details

      public static String details(Throwable e)
      The failure rendered as a diagnosable string: the exception's own message, plus the root cause beneath it when that is a different exception.

      A transport failure is what forces this. An SDK that wraps an IOException reports only its own wrapper text, and the exception underneath it - unknown host, connect timed out, TLS handshake - carries the only fact that separates a broken egress path from a provider fault. Callers persist and log this string and nothing else of the throwable, so a cause missing from here is a cause nobody reading the row can recover.

      Parameters:
      e - the failure as the provider's client threw it
      Returns:
      the message, followed by the root cause in brackets when there is a distinct one
    • baseMinJitterMs

      public abstract long baseMinJitterMs()
      Lower edge of the backoff jitter window, in milliseconds, before the dispatcher scales it by the attempt factor.
    • baseMaxJitterMs

      public abstract long baseMaxJitterMs()
      Upper edge of the backoff jitter window, in milliseconds, before attempt scaling.
    • backpressureIncrements

      public abstract int backpressureIncrements()
      How many throttle increments this signal feeds the model's admission limiter (TokenBucketRateLimiter.recordBackpressure(int)); zero means the limiter does not hear about it.