observer: fix gateway health probe — text/plain not JSON
Some checks failed
lakehouse/auditor 1 blocking issue: todo!() macro call in tests/real-world/scrum_master_pipeline.ts

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) <noreply@anthropic.com>
This commit is contained in:
root 2026-04-25 23:37:52 -05:00
parent 779158a09b
commit 54689d523c

View File

@ -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);