From 54689d523c56944e46306fb89d5ba7c7d4519346 Mon Sep 17 00:00:00 2001 From: root Date: Sat, 25 Apr 2026 23:37:52 -0500 Subject: [PATCH] =?UTF-8?q?observer:=20fix=20gateway=20health=20probe=20?= =?UTF-8?q?=E2=80=94=20text/plain=20not=20JSON?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Same bug as matrix-agent-validated 5db0c58. observer.ts:645 did fetch().then(r => r.json()) against /health which returns text/plain "lakehouse ok". r.json() throws on non-JSON, .catch swallows to null, observer exits assuming gateway down. With systemd Restart=on-failure this crash-loops every 5s — confirmed live on matrix-test box today. Fix: r.ok ? r.text() : null. Same shape, accepts the actual content type. Sealed in pathway_memory as TypeConfusion:fetch-health-json. Co-Authored-By: Claude Opus 4.7 (1M context) --- mcp-server/observer.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/mcp-server/observer.ts b/mcp-server/observer.ts index 1150af1..9984fb5 100644 --- a/mcp-server/observer.ts +++ b/mcp-server/observer.ts @@ -642,7 +642,7 @@ async function main() { console.error(`[observer] started — cycle=${CYCLE_SECS}s, gateway=${GATEWAY}, port=${OBSERVER_PORT}`); // Run a health check first - const health = await fetch(`${GATEWAY}/health`).then(r => r.json()).catch(() => null); + const health = await fetch(`${GATEWAY}/health`).then(r => r.ok ? r.text() : null).catch(() => null); if (!health) { console.error("[observer] gateway unreachable — exiting"); process.exit(1);