Module: RobotLab::Errors
- Defined in:
- lib/robot_lab/errors.rb
Overview
Classification surface for "should this error be retried?" — so hosts (ActiveJob retry_on lists, robot_lab-to's takeover loop, custom retry wrappers) don't reimplement the same case statement against RobotLab's error hierarchy.
InferenceError(transient LLM/API failures) is always retryable, except its more specific subclassToolLoopError(a circuit breaker tripped by a repeating tool-call pattern — retrying immediately would just re-trigger the same loop).MCPErrorandToolErrorare opt-in: retryable only when raised withretryable: true, since some instances are transient (a connection drop, a timeout) and some are not (an explicit rejection from the server or tool).- Everything else (+ConfigurationError+,
ToolNotFoundError,DependencyError,RactorBoundaryError,BusError, and any non-RobotLab error) is never retryable.
Class Method Summary collapse
-
.retryable?(error) ⇒ Boolean
True when the host should retry the operation that raised
error. -
.retryable_classes ⇒ Array<Class>
Always-retryable error classes, for explicit ActiveJob-style
retry_onallow-lists.
Class Method Details
.retryable?(error) ⇒ Boolean
Returns true when the host should retry the operation that raised error.
23 24 25 26 27 28 29 30 31 32 33 34 |
# File 'lib/robot_lab/errors.rb', line 23 def self.retryable?(error) return false if error.nil? || error.is_a?(RobotLab::ToolLoopError) case error when RobotLab::MCPError, RobotLab::ToolError error.respond_to?(:retryable) && error.retryable == true when RobotLab::InferenceError true else false end end |
.retryable_classes ⇒ Array<Class>
Always-retryable error classes, for explicit ActiveJob-style
retry_on allow-lists. Excludes +MCPError+/+ToolError+ because
their retryability is per-raise (via retryable:), not per-class.
41 42 43 |
# File 'lib/robot_lab/errors.rb', line 41 def self.retryable_classes [RobotLab::InferenceError].freeze end |