From 89c0db86b92f9ed24a5834e921fcd54344ef8d4f Mon Sep 17 00:00:00 2001 From: Kit Langton Date: Thu, 2 Apr 2026 00:04:56 -0400 Subject: [PATCH] fix(sync): restore ALS for published events --- packages/opencode/src/sync/index.ts | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/packages/opencode/src/sync/index.ts b/packages/opencode/src/sync/index.ts index f320f49357..c6b9e95882 100644 --- a/packages/opencode/src/sync/index.ts +++ b/packages/opencode/src/sync/index.ts @@ -2,6 +2,7 @@ import z from "zod" import type { ZodObject } from "zod" import { EventEmitter } from "events" import { Effect, Layer, ServiceMap } from "effect" +import { InstanceState } from "@/effect/instance-state" import { makeRuntime } from "@/effect/run-service" import { Database, eq } from "@/storage/db" import { Bus as ProjectBus } from "@/bus" @@ -219,7 +220,7 @@ export namespace SyncEvent { ) } - yield* Effect.sync(() => process(def, event, { publish: !!options?.republish })) + yield* InstanceState.withALS(() => process(def, event, { publish: !!options?.republish })) }) const run: Interface["run"] = Effect.fn("SyncEvent.run")(function* ( @@ -235,7 +236,7 @@ export namespace SyncEvent { throw new Error(`SyncEvent.run: running old versions of events is not allowed: ${def.type}`) } - yield* Effect.sync(() => + yield* InstanceState.withALS(() => Database.transaction( (tx) => { const id = EventID.ascending()