Dashboard › opencode › Distillation
aacd20da-f381-4fe0-a307-edf26d082b34["lore_tm_v1_NWoNrHuSJlXmg5QYKVEZ6xb62ZtozdeVoc4uJyQIbMc","lore_tm_v1_5tDlg7HaGGXYdI7v8FiXHU0sQwmrscSPpfnODn9fc18","lore_tm_v1_EdMJ-KTT0pQM40o6BdUF3sip1V097So_82AHwaQN0aQ","lore_tm_v1_kTJO9WxY2yfeP_SII0wjcL3Y8t_UCtq1vxsi_Y3-p80","lore_tm_v1_ePpeEXyo89V77710J6U0XKOjUCluBJa0IAjpR7vNI4I","lore_tm_v1_0Tu32QB8YAXcUMxy3y7Rfzow4cBTaWLdvEVzTcb5a4s","lore_tm_v1_g00DZH1y52tG9CHqMzU58rvjTAf-MvqF717gql7q2kY","lore_tm_v1_4w01DN5WRpc9NMXMp5GbxZoLRXIFUavLZyhhZyEGe8k"]
Date: Sep 16, 2026
packages/core/src/session/execution/local.ts implements current-process routing for implicit-local Locations through SessionExecutionLocal.make; it generates one process-level ownerID with crypto.randomUUID(), tracks claims in activeClaims: Map<SessionSchema.ID, SessionExecutionClaim.Claim>, and derives renewal timing from SESSION_EXECUTION_LEASE_MS.packages/core/src/session/execution/local.ts, a drain creates a fresh executionID, attempts to insert a SessionExecutionTable row with phase "ready" and expires_at = now + leaseDuration, and returns without running when .onConflictDoNothing() cannot obtain the session’s unique claim.packages/core/src/session/execution/local.ts selects the oldest eligible SessionRecoveryTable row where the session matches, wake_pending = true, and recovery_error IS NULL, ordered by time_created then execution_id; its continuation_message_id is supplied to input.run(claim, force, recoveryInputID).packages/core/src/session/execution/local.ts races the session run via Effect.raceFirst; SessionExecutionClaim.update(db, claim) repeats every leaseDuration / 3. Non-interrupt-only drain failures are logged as "Failed to drain Session" with sessionID.packages/core/src/session/execution/local.ts removes only the matching executionID from activeClaims; successful runs clear their claim. For failures, interrupted execution is retained unless its current phase is "safe", while existing claims outside phases "unknown" and "continue" are cleared.SessionExecutionLocal.interrupt() first renews a known active claim, starts scoped renewal every leaseDuration / 3, then asks SessionRunCoordinator to interrupt and clear the claim. A SessionExecutionClaim.Lost defect is tolerated only if no current SessionExecutionTable row remains for that session; otherwise it is rethrown.packages/core/src/session/execution/local.ts exposes active, interrupt, resume: coordinator.run, and wake: coordinator.wake. Its global node uses service SessionExecution.Service with dependencies Database.node, SessionStore.node, and LocationServiceMap.node; the runner is provided the location-specific layer from locations.get(session.location).packages/core/src/session/run-coordinator.ts defines a per-key coordinator that serializes execution for the same key while permitting different keys to run concurrently. Its API is active, run(key), wake(key), and interrupt(key, cleanup?).SessionRunCoordinator entry stores done, optional owner, optional exit, pendingWake, and stopping. New direct runs call drain(key, true); wake-triggered and successor runs call drain(key, false).SessionRunCoordinator.run() joins an already-active execution; if that entry is stopping, it waits for completion and retries run(key). Otherwise it creates an entry, starts forced execution, and waits on the entry’s Deferred.SessionRunCoordinator.wake() coalesces work by setting pendingWake = true on an active entry; when idle, it creates an entry and starts a non-forced drain. A successful execution with a pending wake reuses the entry for one yielded successor; other settlement paths create a replacement entry only when another wake is pending.SessionRunCoordinator.interrupt() marks the entry as stopping and initially clears pendingWake, interrupts its owner fiber, runs cleanup, then either removes the entry or starts a non-forced successor if work arrived during stopping. It throws "Interrupted Session execution did not settle" if the interrupted owner never recorded an exit, completes the original done deferred with that exit, and propagates cleanup failure causes.packages/core/src/session/projector.ts projects tool lifecycle events SessionEvent.Tool.Input.Ended, Tool.Called, Tool.Progress, Tool.Success, and Tool.Failed; reasoning events Reasoning.Started and Reasoning.Ended; and Compaction.Ended. Projection of SessionEvent.Retried is currently commented out.SessionEvent.RevertEvent.Staged updates SessionTable.revert, defensively copies revert.files when present, and sets time_updated from the event timestamp; RevertEvent.Cleared sets revert to null and also updates time_updated.SessionEvent.RevertEvent.Committed resolves the boundary message’s SessionMessageTable.seq and dies with Revert boundary message not found: ${event.data.messageID} if absent. It deletes later session messages, deletes session inputs whose admitted_seq or promoted_seq is beyond the boundary, then clears SessionTable.revert and updates time_updated.packages/core/src/event.ts found 28 commit/publish-related matches. PublishOptions.commit is documented as a local operational projection committed atomically with a new durable event and is neither replayed nor serialized; the implementation rejects commit hooks on non-durable events with "Local commit hooks require a durable event".