diff --git a/internal/cloud/workbench-facts-store.ts b/internal/cloud/workbench-facts-store.ts index 04e5c878..8465c57f 100644 --- a/internal/cloud/workbench-facts-store.ts +++ b/internal/cloud/workbench-facts-store.ts @@ -243,6 +243,10 @@ function otelNonNegativeIntegerOrNull(value) { return Number.isFinite(parsed) && parsed >= 0 ? Math.trunc(parsed) : null; } +function objectValue(value) { + return value && typeof value === "object" && !Array.isArray(value) ? value : {}; +} + async function durableTraceSnapshot(runtimeStore, traceId) { if (!runtimeStore || typeof runtimeStore.queryAgentTraceEvents !== "function") return null; const safeId = safeTraceId(traceId); diff --git a/internal/db/runtime-store.ts b/internal/db/runtime-store.ts index 849d20fe..51d52930 100644 --- a/internal/db/runtime-store.ts +++ b/internal/db/runtime-store.ts @@ -2835,7 +2835,10 @@ export function classifyRuntimeDbError(error) { function isRuntimeDbConnectTimeout(error) { const message = String(error?.message ?? error ?? "").toLowerCase(); - if (!message.includes("timeout exceeded when trying to connect")) return false; + const pgConnectTimeout = message.includes("timeout exceeded when trying to connect"); + const pgConnectionTimeoutTermination = message.includes("connection terminated due to connection timeout"); + if (!pgConnectTimeout && !pgConnectionTimeoutTermination) return false; + if (pgConnectionTimeoutTermination) return true; const stack = String(error?.stack ?? "").toLowerCase(); return !stack || stack.includes("pg-pool") || stack.includes("node_modules/pg"); }