Exception: Smith::SeedMismatch

Inherits:
Error
  • Object
show all
Defined in:
lib/smith/errors.rb

Overview

Raised when restore detects that the workflow’s seed_messages builder now produces a different digest than what was persisted (i.e., the system prompt or seed template changed in code after this workflow was already running). Only fires when the workflow opts into ‘seed_validation :strict`; the default `:off` skips validation and `:warn` logs without raising.

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(workflow:, stored_digest:, current_digest:) ⇒ SeedMismatch

Returns a new instance of SeedMismatch.



128
129
130
131
132
133
134
135
136
137
# File 'lib/smith/errors.rb', line 128

def initialize(workflow:, stored_digest:, current_digest:)
  @workflow = workflow
  @stored_digest = stored_digest
  @current_digest = current_digest
  super(
    "seed_messages drift detected for #{workflow}: stored digest #{stored_digest.inspect}, " \
    "current digest #{current_digest.inspect}. The seed_messages block changed after this " \
    "workflow was persisted. Restoring this state would mix old + new prompt context."
  )
end

Instance Attribute Details

#current_digestObject (readonly)

Returns the value of attribute current_digest.



126
127
128
# File 'lib/smith/errors.rb', line 126

def current_digest
  @current_digest
end

#stored_digestObject (readonly)

Returns the value of attribute stored_digest.



126
127
128
# File 'lib/smith/errors.rb', line 126

def stored_digest
  @stored_digest
end

#workflowObject (readonly)

Returns the value of attribute workflow.



126
127
128
# File 'lib/smith/errors.rb', line 126

def workflow
  @workflow
end