Skip to content
TypeScript

fix(server): stop event subscribers before closing the database (#27831)

maria1820fbe6bc9f
diff --git a/apps/server/src/orchestration-v2/Orchestrator.ts b/apps/server/src/orchestration-v2/Orchestrator.ts
index b0a52315923..6c1ff428400 100644
--- a/apps/server/src/orchestration-v2/Orchestrator.ts
+++ b/apps/server/src/orchestration-v2/Orchestrator.ts
@@ -13398,7 +13398,7 @@ const makeOrchestrator = Effect.fn("orchestrationV2.Orchestrator.layer")(functio
stored.event.payload.status === "rolled_back"),
),
Stream.runForEach(handleRunUpdate),
- Effect.forkDetach,
+ Effect.forkScoped,
);
// A child whose run ends while its background tasks or its own subagents still run has no
@@ -13440,7 +13440,7 @@ const makeOrchestrator = Effect.fn("orchestrationV2.Orchestrator.layer")(functio
),
),
),
- Effect.forkDetach,
+ Effect.forkScoped,
);
const recoverDelegatedTasks = Effect.gen(function* () {