Dashboard › opencode › Distillation
deb5c452-4829-472f-a13e-353e0671248c["lore_tm_v1_5j61JDcHleovhA0HIk-Yz5i7hPNfYsv_1TK6FT4Xe0w","lore_tm_v1_J0mAI4b_o2qdbeUwmDdf8bmpq1pr0aNMoFAhdNXaiBQ","lore_tm_v1_QU9nOkJJxlRfXD6cRYNOiKQ4MHUBpe_l6Wr0jwjVvcc","lore_tm_v1_kENDQI1fDkyTbOniNvVmrEUs81zh2V1oi1pIhynhYpc"]
Date: Sep 16, 2026
packages/core/src/session/run-coordinator.ts showed SessionRunCoordinator.make<Key, E>() is an in-memory, process-local coordinator backed by Map<Key, Entry<E>> and FiberSet.makeRuntime<never, void, never>(); it serializes execution per key while allowing different keys to run concurrently.SessionRunCoordinator.Coordinator<Key, E> exposes 4 operations: active snapshots keys owned by this coordinator, run(key) starts while idle or joins active execution, wake(key) coalesces one follow-up after newly recorded work, and interrupt(key, cleanup?) stops execution, performs cleanup, then starts work that arrived while stopping.Entry<E> stores done: Deferred.Deferred<void, E>, optional owner: Fiber.Fiber<void, never>, optional exit: Exit.Exit<void, E>, pendingWake, and stopping; makeEntry() initializes both flags to false.start(key, entry, force, successor) invokes options.drain(key, force) in the coordinator’s runtime fiber set. Initial work waits on a ready deferred before draining, while successor work first uses Effect.yieldNow; settle(key, entry, exit) runs through Effect.onExit.run(key) executes under Effect.uninterruptibleMask: it joins the existing entry’s done deferred, waits and recursively retries if that entry is stopping, or creates a new entry and starts drain(key, true) when idle.wake(key) sets pendingWake = true when execution is active, coalescing repeated wakes into one boolean follow-up; when idle it creates an entry and starts drain(key, false).pendingWake clears the flag and immediately starts a successor drain on the same entry with force: false; otherwise settle() either deletes the active key or installs a new successor entry, then completes the prior entry’s done deferred with its exact exit.interrupt(key, cleanup = Effect.void) marks an active entry as stopping, clears its existing pending wake, interrupts its owner fiber, captures the cleanup exit, and runs uninterruptibly. Wakes arriving during stopping can create a successor; absent such a wake, the active entry is deleted.interrupt() throws Error("Interrupted Session execution did not settle") if the interrupted owner does not record an exit, completes the stopped entry’s deferred with that owner exit, and propagates cleanup failure via Effect.failCause(cleanupExit.cause).SessionExecution, SessionDurable from @opencode-ai/schema/durable-event-manifest, durable event listing with { events: ReadonlyArray<SessionEvent.DurableEvent>; hasMore: boolean }, and prompt recording/execution paths using SessionMessage.ID.create().PromptExecutionRequested, session.next.step.started, session.next.step.failed, and session.next.step.interrupted, alongside assistant, reasoning, shell, tool input/result/error/progress, compaction, and revert event families.