Scheduler class
Single-authority scheduler that owns dispatch, reconciliation, and retries.
Implements the Symphony orchestration state machine (§7) using an in-memory state model. The scheduler is the only component that mutates scheduling state — runners and trackers report results back through it.
Constructors
- Scheduler({required WorkflowConfig config, required IssueTrackerClient tracker, required WorkspaceManager workspaceManager, required AgentRunner runner, required PromptBuilder promptBuilder, required Logger logger, int eventHistorySize = 100, String runsRoot = '.spectra/runs', bool writeProofOfWork = true})
- Creates a scheduler.
Properties
-
claimed
→ Set<
String> -
Issue ids reserved by the scheduler (running or queued for retry).
no setter
-
completed
→ Set<
String> -
Issue ids that completed at least once (bookkeeping only).
no setter
- config → WorkflowConfig
-
Returns the currently active workflow config.
no setter
- eventHistorySize → int
-
Maximum retained orchestration events for snapshots.
final
- hashCode → int
-
The hash code for this object.
no setterinherited
- isRunning → bool
-
Whether the scheduler poll loop is active.
no setter
- logger → Logger
-
Logger for status messages.
final
- promptBuilder → PromptBuilder
-
Builds the rendered prompt for an issue.
final
-
proofPaths
→ Map<
String, String> -
Proof-of-work artifact path per issue identifier, for completed or
reviewable runs.
no setter
-
recentEvents
→ List<
OrchestrationEvent> -
Recent orchestration events (most recent last).
no setter
- retainedRetryHistoryCount → int
-
Number of issues for which retry history is currently retained.
no setter
-
retryAttempts
→ Map<
String, RetryEntry> -
Pending retry entries (read-only view).
no setter
- runner → AgentRunner
-
Agent runner used to actually execute work.
final
-
running
→ Map<
String, RunningEntry> -
Currently running entries (read-only view).
no setter
- runsRoot → String
-
Root directory for per-run proof-of-work artifacts.
final
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
- totals → CodexTotals
-
Aggregate token + runtime totals.
no setter
- tracker → IssueTrackerClient
-
Tracker adapter used to fetch candidates and refresh state.
final
-
validationErrors
→ List<
String> -
Latest dispatch validation errors. Empty when dispatch can proceed.
no setter
- workspaceManager → WorkspaceManager
-
Workspace manager used to create per-issue workspaces.
final
- writeProofOfWork → bool
-
Whether proof-of-work artifacts are written when runs end.
final
Methods
-
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
requestImmediateTick(
) → Future< void> - Runs an immediate tick. Used by the HTTP refresh endpoint.
-
start(
) → Future< void> - Starts the poll loop. Returns immediately after kicking off the first tick; the loop runs in the background until stop is called.
-
stop(
) → Future< void> - Stops the scheduler and cancels all running workers/timers.
-
tick(
) → Future< void> - Runs one full tick: reconcile -> validate -> fetch -> dispatch.
-
toString(
) → String -
A string representation of this object.
inherited
-
updateConfig(
WorkflowConfig next) → void - Hot-swaps the active workflow config.
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited
Static Methods
-
computeFailureBackoff(
{required int attempt, required Duration cap}) → Duration -
Computes the exponential backoff delay capped at
cap. -
sortForDispatch(
List< Issue> issues) → List<Issue> -
Sorts
issuesin dispatch order: priority asc, oldest createdAt, then identifier as a stable tie-breaker.