Dashboard › opencode › Distillation
82279897-e4b2-40be-ae70-38dd216c9f66["lore_tm_v1_f3R3C9qbt57GiTEnTyAwo_-X7bWiX4h5rx-y0DKfwOA"]
Date: Sep 17, 2026
packages/core/test/session-run-coordinator.test.ts lines 260-283 show a coordinator interruption-race test: while the first drain run is blocked in interruption cleanup, coordinator.wake("session") is called; after cleanupGate opens and the interrupt fiber joins, secondStarted completes and expect(runs).toBe(2) verifies one follow-up run.packages/core/test/session-run-coordinator.test.ts lines 285-328 define it.effect("finalizes interruption when cleanup dies", ...): the first run blocks forever, interruption cleanup waits on cleanupGate and then executes Effect.die(defect) where defect = new Error("cleanup defect"); a wake is registered during cleanup. The test verifies Exit.isFailure(exit) && Cause.hasDies(exit.cause), waits for the second run, calls coordinator.run("session"), confirms coordinator.active is [], and expects exactly runs === 2.packages/core/test/session-run-coordinator.test.ts lines 330-364 define it.effect("starts a resume registered during interruption cleanup", ...): drain(_key, force) records force values, the first run blocks through interruption cleanup, and coordinator.run("session") is forked while cleanup is active. After releasing cleanupGate, both interruption and resume fibers join, secondStarted completes, and expect(forces).toEqual([false, true]) verifies the resumed follow-up is forced.packages/core/test/session-run-coordinator.test.ts lines 366-394 define it.effect("starts one follow-up when a wake races with failure", ...): the first coordinator.run("session") waits on gate and fails with new Error("failed"), while coordinator.wake("session") races with that failure. The joined run is expected to fail with the same failure, a second run must start, and expect(runs).toBe(2) verifies exactly one follow-up.packages/core/test/session-run-coordinator.test.ts lines 396-415 define it.effect("does not cancel execution when a joined waiter is interrupted", ...): two callers join the same keyed run, the second waiter fiber is interrupted, and releasing gate lets the first finish; expect(runs).toBe(1) confirms interrupting a joined waiter does not cancel or duplicate the underlying execution.packages/core/test/session-run-coordinator.test.ts lines 417-438 define it.effect("runs different keys concurrently", ...): runs for keys "first" and "second" increment a shared active count, signal bothStarted when active === 2, wait on the same gate, and successfully join after the gate opens, demonstrating per-key concurrency.packages/core/test/session-run-coordinator.test.ts; lines 440-463 remained undisplayed and were available via offset=440.