From 4d4bd34325bc92e7408b8444870d98441281a219 Mon Sep 17 00:00:00 2001 From: Lauren ten Hoor <32955832+laurentenhoor@users.noreply.github.com> Date: Tue, 10 Feb 2026 01:30:45 +0800 Subject: [PATCH] fix: re-throw error when state update fails after dispatch (#23) (#25) When a worker session is successfully dispatched but activateWorker fails to update projects.json, the error was being logged but not re-thrown. This caused task_pickup to return success even though the state wasn't updated, leading to task_complete failures later. Now we re-throw the error after logging the warning, so the caller knows the state update failed even though the session is running. Fixes: #23 --- lib/dispatch.ts | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/lib/dispatch.ts b/lib/dispatch.ts index 374f254..5f908c5 100644 --- a/lib/dispatch.ts +++ b/lib/dispatch.ts @@ -226,6 +226,10 @@ export async function dispatchTask( error: (err as Error).message, sessionKey, }); + // Re-throw so caller knows state update failed + throw new Error( + `State update failed after successful session dispatch: ${(err as Error).message}. Session is running but projects.json was not updated.`, + ); } else { // Dispatch failed — rollback label try {