From 42d4d72e3fffb2406e024748f0cf4f4d01487815 Mon Sep 17 00:00:00 2001 From: goofoo Date: Thu, 16 Apr 2026 11:51:51 -0400 Subject: [PATCH 1/2] Fix: OpenClaw health check falsely reports connected on 404 checkConnection() accepted HTTP 200-499 as "connected", so a 404 from a disabled /v1/chat/completions endpoint would show a green indicator while all tool calls silently fail. Narrow to 200-299 only so users get an accurate unreachable state when the chatCompletions endpoint is not enabled in openclaw.json. Fixes #36 Co-Authored-By: Claude Sonnet 4.6 --- samples/CameraAccess/CameraAccess/OpenClaw/OpenClawBridge.swift | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/samples/CameraAccess/CameraAccess/OpenClaw/OpenClawBridge.swift b/samples/CameraAccess/CameraAccess/OpenClaw/OpenClawBridge.swift index 1f48ac6f..b65f2c7f 100644 --- a/samples/CameraAccess/CameraAccess/OpenClaw/OpenClawBridge.swift +++ b/samples/CameraAccess/CameraAccess/OpenClaw/OpenClawBridge.swift @@ -48,7 +48,7 @@ class OpenClawBridge: ObservableObject { request.setValue("glass", forHTTPHeaderField: "x-openclaw-message-channel") do { let (_, response) = try await pingSession.data(for: request) - if let http = response as? HTTPURLResponse, (200...499).contains(http.statusCode) { + if let http = response as? HTTPURLResponse, (200...299).contains(http.statusCode) { connectionState = .connected NSLog("[OpenClaw] Gateway reachable (HTTP %d)", http.statusCode) } else { From 9a5a20cafaa2e5da68d0418cdd23aa0b75b3ace8 Mon Sep 17 00:00:00 2001 From: goofoo Date: Thu, 16 Apr 2026 12:13:07 -0400 Subject: [PATCH 2/2] Fix: exclude 404 specifically rather than narrowing to 200-299 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit A GET to /v1/chat/completions on a healthy OpenClaw gateway may return a 4xx (e.g. 400 Bad Request or 405 Method Not Allowed) because the endpoint only accepts POST with a JSON body. The original 200-499 range was intentional for exactly this reason. Narrowing to 200-299 would cause a correctly-configured gateway to show as "unreachable". Instead, exclude only 404 — the status that indicates the chatCompletions endpoint is explicitly disabled in openclaw.json. Co-Authored-By: Claude Sonnet 4.6 --- .../CameraAccess/CameraAccess/OpenClaw/OpenClawBridge.swift | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/samples/CameraAccess/CameraAccess/OpenClaw/OpenClawBridge.swift b/samples/CameraAccess/CameraAccess/OpenClaw/OpenClawBridge.swift index b65f2c7f..92ccfaa7 100644 --- a/samples/CameraAccess/CameraAccess/OpenClaw/OpenClawBridge.swift +++ b/samples/CameraAccess/CameraAccess/OpenClaw/OpenClawBridge.swift @@ -48,7 +48,8 @@ class OpenClawBridge: ObservableObject { request.setValue("glass", forHTTPHeaderField: "x-openclaw-message-channel") do { let (_, response) = try await pingSession.data(for: request) - if let http = response as? HTTPURLResponse, (200...299).contains(http.statusCode) { + if let http = response as? HTTPURLResponse, + (200...499).contains(http.statusCode), http.statusCode != 404 { connectionState = .connected NSLog("[OpenClaw] Gateway reachable (HTTP %d)", http.statusCode) } else {