From c1b45b724e83960c78a413405d6d66d1061114c1 Mon Sep 17 00:00:00 2001 From: cf3901646 Date: Mon, 9 Nov 2026 17:11:33 +0000 Subject: [PATCH] fix(sqlite_authority_store): surface underlying SQLite error in status Signed-off-by: cf3901646 --- .../coordination/sqlite_authority_store.ts | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/loopx/control_plane/coordination/sqlite_authority_store.ts b/loopx/control_plane/coordination/sqlite_authority_store.ts index 2ef3eab5de..268d6ba7c3 100644 --- a/loopx/control_plane/coordination/sqlite_authority_store.ts +++ b/loopx/control_plane/coordination/sqlite_authority_store.ts @@ -143,10 +143,12 @@ export function sqliteAuthorityPath(directory: string, goalId: string): string { function protocol(message: string): never { throw new AuthorityStoreProtocolError(message); } function readFailure(error: unknown): AuthorityStoreReadFailure { - return error instanceof AuthorityStoreProtocolError || error instanceof SyntaxError - ? {status: "failed", reason_code: "provider_protocol_violation", reason: error.message} - : {status: "unavailable", reason_code: "provider_read_unavailable", - reason: "SQLite authority store could not be read; check database availability and lock contention"}; + if (error instanceof AuthorityStoreProtocolError || error instanceof SyntaxError) { + return {status: "failed", reason_code: "provider_protocol_violation", reason: error.message}; + } + // For other errors, include the original error message if available + const reason = error instanceof Error ? error.message : "SQLite authority store could not be read; check database availability and lock contention"; + return {status: "unavailable", reason_code: "provider_read_unavailable", reason}; } function fileBytes(path: string): number {