#1 Persistent memory for AI coding agents based on real-world benchmarks
TypeScript agentmemoryagentsaiclaudeclaudecodecodexcopilotcursorgenaiharnesshermesmemoryompopenclawopencodepi
fix(viewer): surface health status from non-2xx /agentmemory/health responses (#1046)
Vidit Gujrathia8e7d19a814a
diff --git a/src/viewer/index.html b/src/viewer/index.htmlindex 305397e9..3efe4342 100644--- a/src/viewer/index.html+++ b/src/viewer/index.html@@ -1244,11 +1244,24 @@headers.Authorization = 'Bearer ' + viewerToken;}var fetchOpts = Object.assign({}, opts || {}, { headers: headers });+ var readErrorBody = fetchOpts.readErrorBody;+ delete fetchOpts.readErrorBody;var res = await fetch(url, fetchOpts);if (!res.ok) {if (res.status === 401) showViewerAuthPrompt();console.warn('[viewer] API ' + (fetchOpts.method || 'GET') + ' ' + path + ' returned ' + res.status);- return null;+ // Non-2xx responses resolve to null so callers can keep treating+ // null as "request failed" (e.g. loadGraph's disabled/error state).+ // The health endpoint opts out via readErrorBody: it intentionally+ // responds 503 with a valid JSON body when status is "critical"+ // (see #1019), and the dashboard badge needs that body.+ if (!readErrorBody) return null;+ try {+ return await res.json();+ } catch (parseErr) {+ console.debug('[viewer] API ' + path + ' non-2xx body was not JSON:', parseErr);+ return null;+ }}hideViewerAuthPrompt();return await res.json();@@ -1344,7 +1357,7 @@el.innerHTML = '<div class="loading">Loading dashboard...</div>';try {var results = await Promise.all([- apiGet('health'),+ api('health', { readErrorBody: true }),apiGet('sessions'),apiGet('memories?latest=true&limit=500'),apiGet('graph/stats'),