Module: Smith::Errors

Defined in:
lib/smith/errors.rb

Overview

Classification surface for host retry policies. Smith owns the answer to “should the workflow attempt be retried?” so consumers don’t reimplement the case statement in every Execution / Job.

Class Method Summary collapse

Class Method Details

.retryable?(error) ⇒ Boolean

Returns true when the host should retry the workflow attempt. AgentError + DeadlineExceeded are always retryable. DeterministicStepFailure + ToolGuardrailFailed honor their ‘retryable` attribute (opt-in at the raise site). All other Smith errors and non-Smith errors return false.

Returns:

  • (Boolean)


13
14
15
16
17
18
19
20
21
22
23
24
# File 'lib/smith/errors.rb', line 13

def self.retryable?(error)
  return false if error.nil?

  case error
  when Smith::DeterministicStepFailure, Smith::ToolGuardrailFailed
    error.retryable == true
  when Smith::AgentError, Smith::DeadlineExceeded
    true
  else
    false
  end
end

.retryable_classesObject

Always-retryable error classes for explicit ActiveJob retry_on allow-lists. Excludes the retryable-bearing families because their retryability is per-raise, not per-class.



29
30
31
# File 'lib/smith/errors.rb', line 29

def self.retryable_classes
  [Smith::AgentError, Smith::DeadlineExceeded].freeze
end