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
This commit is contained in:
Lauren ten Hoor
2026-02-10 01:30:45 +08:00
committed by GitHub
parent 56143cb208
commit 4d4bd34325

View File

@@ -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 {