Reliable by Design · 05.04
The Execution Model: Ticks, Ready Queue & Waiting Inputs
Inside WorkflowEngine: the ReadyQueue, the WaitingInputBuffer, and what happens on every tick from dispatch to snapshot.
One engine, decomposed behind typed facades
WorkflowEngine keeps a ReadyQueue and a WaitingInputBuffer per run. On each tick it drains ready nodes up to configured parallelism, dispatches each through an exhaustive type switch, records a ledger event, publishes realtime state, and periodically snapshots. The engine itself no longer contains every behavior directly — the cognitive loop (convergeLoop.ts), the node executors, and self-heal each live in their own module behind a small typed host facade, so the core engine reads as a legible dispatcher instead of a single sprawling file with everything inlined.
Why a facade instead of a direct import
Modules like ConvergeLoopController take a narrow LoopEngineHost interface — a handful of bound closures over the engine's own private methods — rather than importing the engine directly. That keeps the engine's internal state properly encapsulated while still letting an extracted module drive real engine behavior (starting a run, completing a node, ticking), and avoids a runtime import cycle between the engine and the modules it delegates to.
Continue
A proven, blessed workflow graph is never autonomously restructured — repair requires certification and a rollback path.
How a run-scoped Objective declares the acceptance checks that define done, verified against real outputs rather than a self-report.