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.



138
139
140
141
142
143
144
145
146
147
# File 'lib/smith/errors.rb', line 138

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.



136
137
138
# File 'lib/smith/errors.rb', line 136

def current_digest
  @current_digest
end

#stored_digestObject (readonly)

Returns the value of attribute stored_digest.



136
137
138
# File 'lib/smith/errors.rb', line 136

def stored_digest
  @stored_digest
end

#workflowObject (readonly)

Returns the value of attribute workflow.



136
137
138
# File 'lib/smith/errors.rb', line 136

def workflow
  @workflow
end