From 4c46dd3b3987fb9ed50824710a1fde55e61d9559 Mon Sep 17 00:00:00 2001 From: "exe.dev user" Date: Thu, 16 Apr 2026 14:58:01 +0000 Subject: [PATCH] fix(v2): await handleRecurrence so the DB isn't closed mid-flight MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit sweepSession called handleRecurrence without await, then synchronously closed inDb in its finally block. handleRecurrence is async because it does a dynamic `import('cron-parser')` before the first DB write; that import resolved after the finally had already run, so insertRecurrence hit a closed handle and threw "The database connection is not open". Net effect: every recurring task was correctly marked completed by syncProcessingAcks, but its next occurrence never got scheduled. Single-word fix — `await`. Co-Authored-By: Claude Opus 4.6 (1M context) --- src/host-sweep.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/host-sweep.ts b/src/host-sweep.ts index b1b49f9..8316cc5 100644 --- a/src/host-sweep.ts +++ b/src/host-sweep.ts @@ -101,7 +101,7 @@ async function sweepSession(session: Session): Promise { } // 4. Handle recurrence for completed messages - handleRecurrence(inDb, session); + await handleRecurrence(inDb, session); } finally { inDb.close(); outDb?.close();