Fix: OpenClaw health check falsely reports connected when endpoint returns 404#50
Open
kbaker827 wants to merge 2 commits intoIntent-Lab:mainfrom
Open
Fix: OpenClaw health check falsely reports connected when endpoint returns 404#50kbaker827 wants to merge 2 commits intoIntent-Lab:mainfrom
kbaker827 wants to merge 2 commits intoIntent-Lab:mainfrom
Conversation
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 Intent-Lab#36 Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
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 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
When the
/v1/chat/completionsendpoint is disabled inopenclaw.json, the gateway returns 404. The health check incheckConnection()was accepting HTTP 200–499 as "connected", so a 404 silently showed a green indicator while every tool call failed.Fixes #36
Solution
Exclude 404 specifically from the accepted status range, keeping the rest of 200–499 intact.
The original 200–499 range was intentional: a GET request to
/v1/chat/completionson a healthy 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. Narrowing to 200–299 would cause a correctly-configured gateway to falsely show as "unreachable".Test plan
chatCompletions.enabled: trueinopenclaw.jsonchatCompletionsinopenclaw.jsonand restart the gateway🤖 Generated with Claude Code