Skip to content

Fix gateway status probes for OpenClaw 2.0 path change - #85

Open
courtneyr-dev wants to merge 1 commit into
RegionallyFamous:mainfrom
courtneyr-dev:fix/openclaw-2-status-path
Open

courtneyr-dev wants to merge 1 commit into
RegionallyFamous:mainfrom
courtneyr-dev:fix/openclaw-2-status-path

Conversation

@courtneyr-dev

Copy link
Copy Markdown

Description

OpenClaw 2.0 removed the /api route prefix from the gateway. Against a 2.0 gateway (verified on a live Elestio instance today) /v1/status answers 200 while the /api/v1/status path this plugin probes answers 404 — so the Site Health test reports a critical "cannot reach the AI gateway", the settings connection test fails, wp pinch status shows disconnected, and the status REST route reports connected: false, all while chat/webhooks keep working.

This adds Rest\Helpers::gateway_status_request(), which probes the legacy /api/v1/status first and retries /v1/status only on a 404, and routes all four call sites through it:

  • includes/class-site-health.php (Site Health test)
  • includes/Rest/Status.php (status REST route)
  • includes/Settings/Settings_Admin_Pages_Trait.php (connection test)
  • includes/CLI/Status_Command.php (wp pinch status)

1.x gateways see no behavior change (legacy path still tried first and still succeeds). Each call site keeps its previous transport — the two that used wp_safe_remote_get() still do, via the helper's $safe flag — so no SSRF posture changes either direction.

Type of change

  • Bug fix
  • New feature
  • Documentation
  • Refactor / chore

Checklist

  • Self-review done; no debug code or commented-out blocks left in.
  • Changelog updated (if user-facing or notable).
  • Code follows the project's coding standards — php -l clean on all five touched files; I couldn't run the full make check locally, happy to fix anything CI flags.
  • New or changed behavior covered by tests where appropriate — none added; the probe is a thin transport wrapper. Can add a unit test around the 404-fallback if you'd like one.
  • Docs / wiki updated — not needed; no setup or behavior change for correctly-pathed gateways.

Related issues

None filed — found while debugging a Site Health critical after an OpenClaw 2.0 upgrade.

OpenClaw 2.0 removed the /api route prefix: the gateway answers 200 on
/v1/status but 404 on /api/v1/status, so every probe (Site Health test,
status REST route, settings connection test, wp pinch status) reported
the gateway unreachable while chat kept working.

New Rest\Helpers::gateway_status_request() probes the legacy path first
and retries /v1/status only on a 404 — no behavior change for 1.x
gateways. Each call site keeps its previous transport (wp_remote_get vs
wp_safe_remote_get) via the $safe flag.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant