From 3c6ed7cfa69b9d1b5eabf5222fbb34f91d1368f9 Mon Sep 17 00:00:00 2001 From: Cursor Agent Date: Wed, 17 Jun 2026 23:25:42 +0000 Subject: [PATCH] Fix output drain timeout dropping logs by interrupting fibers after timeout After the 250ms drain timeout elapses, output fibers could still be running and writing chunks to the session buffer. When persistFailure then snapshots and clears the buffer, those late-arriving chunks are lost. Interrupt the output fibers after the timeout so that any in-flight writeOutputChunk completes but no new chunks arrive before persistFailure reads the buffer. --- apps/desktop/src/backend/DesktopBackendManager.ts | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/apps/desktop/src/backend/DesktopBackendManager.ts b/apps/desktop/src/backend/DesktopBackendManager.ts index 94a4f41942..2613628126 100644 --- a/apps/desktop/src/backend/DesktopBackendManager.ts +++ b/apps/desktop/src/backend/DesktopBackendManager.ts @@ -330,6 +330,10 @@ const runBackendProcess = Effect.fn("runBackendProcess")(function* ( concurrency: "unbounded", discard: true, }).pipe(Effect.timeout(DEFAULT_BACKEND_OUTPUT_DRAIN_TIMEOUT), Effect.ignore); + yield* Effect.forEach(outputFibers, Fiber.interrupt, { + concurrency: "unbounded", + discard: true, + }).pipe(Effect.ignore); return exit; });