mirror of
https://github.com/iamlukethedev/Claw3D.git
synced 2026-07-30 11:12:32 +00:00
* fix(gateway): don't surface protocol-mismatch hint when server rejects origin/auth The heuristic that flags INVALID_REQUEST errors mentioning minProtocol or maxProtocol as a possible protocol mismatch can fire on any schema validation error that happens to mention those field names, including rejections whose real cause is origin allowlist, missing device identity, or upstream policy. Prefer the structured details.code when the gateway provides one, and treat known non-protocol codes (CONTROL_UI_ORIGIN_NOT_ALLOWED, CONTROL_UI_DEVICE_IDENTITY_REQUIRED, UPSTREAM_NOT_ALLOWED) as non-mismatches so the UI does not send operators down the wrong diagnostic path. * fix(server): log explicit warning when gateway proxy rejects an upstream Previously isUpstreamAllowed returned false silently when UPSTREAM_ALLOWLIST was empty in production, when the upstream host was not in the allowlist, or when the URL could not be parsed. The caller closes the connection without forwarding anything to the browser, which sees an opaque 'WebSocket closed before the connection is established' and the server logs contain no hint of what happened. Emit a console.warn in each of the three rejection branches with an actionable message that names the missing env var or the rejected hostname, so operators can diagnose the rejection from the server logs without reading the proxy source. * fix(gateway): don't bias the local-timeout hint toward a protocol mismatch formatGatewayError unconditionally appended a hint suggesting the user upgrade OpenClaw or switch to the Hermes adapter whenever the browser reported a generic "timed out connecting to the gateway" Error. That Error is raised by a local Promise.race timeout, so it carries no information about why the upstream did not respond. Common real causes are network reachability, nginx idle timeouts, origin allowlist, missing UPSTREAM_ALLOWLIST in production, or credential mismatches — none of which are addressed by upgrading the gateway. Replace the biased suggestion with a neutral pointer to the likely diagnostic paths so the hint helps in the common cases without misleading away from origin/auth/policy issues. --------- Co-authored-by: Jose Antonio Martinez <257598434+jamartineztelecoengineer84-dotcom@users.noreply.github.com>