Class: Silas::AgentLoopJob
- Inherits:
-
ActiveJob::Base
- Object
- ActiveJob::Base
- Silas::AgentLoopJob
- Includes:
- ActiveJob::Continuable
- Defined in:
- app/jobs/silas/agent_loop_job.rb
Overview
One durable turn. Step-name sequence: :prepare, :step_0, :step_1, …, :finalize. Every between-step loop-control read hits write-once persisted state (Step#terminal, invocation approval state at-or-after the cursor), so a resumed continuation regenerates the IDENTICAL sequence — the spike's hard-won determinism constraint, owned by the framework so users can't violate it.
Parking (approval / in-doubt) is a NORMAL job exit at zero compute; resume is a fresh job enqueued by approve!/decline!, replaying completed steps from rows (no model calls, no re-effects — StepRunner's replay path).
Instance Method Summary collapse
Instance Method Details
#perform(turn_id) ⇒ Object
19 20 21 22 23 24 25 26 27 28 |
# File 'app/jobs/silas/agent_loop_job.rb', line 19 def perform(turn_id) turn = Turn.find(turn_id) return if turn.completed? || %w[failed canceled].include?(turn.status) if Silas.resolved_engine.class.loop_ownership == :engine perform_engine_owned(turn) else perform_framework_owned(turn) end end |