From b9e8392cf028487aeef58b7be2e389089842483c Mon Sep 17 00:00:00 2001 From: dtzp555 Date: Tue, 12 May 2026 11:49:26 +1000 Subject: [PATCH] fix(plugin): default OCP plugin port to 3478 + env-overridable; v3.16.1 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit ocp-plugin/index.js hard-coded http://127.0.0.1:3456 since the plugin was created. OCP server moved to 3478 default in v3.14+ as part of the same wave that renamed the launchd label (dev.ocp.proxy). The plugin never got the memo. Result: `/ocp usage` from OpenClaw bots (e.g. the home Telegram bot 大内总管) hit the dead port 3456 and returned "OCP error: fetch failed". Fix: - Default PROXY → http://127.0.0.1:3478 - Read OCP_PROXY_URL env (full URL) first - Else read CLAUDE_PROXY_PORT env (port only, localhost assumed) - Else fall back to the 3478 default openclaw.plugin.json bumped (3.12.0 → 3.16.1) and configSchema default updated. Plugin version now matches OCP version. Top-level package.json bumped 3.16.0 → 3.16.1. CHANGELOG entry added. Diagnostic trail: caught 2026-05-12 when home Telegram bot reported "OCP error: fetch failed" against `/ocp usage`. Mac mini OCP service was healthy on port 3478; lsof -iTCP:3456 had no listener; plugin index.js had hardcoded 3456. No cli.js citation needed: this is OCP-internal plugin code with no corresponding cli.js operation. Co-Authored-By: Claude Opus 4.7 --- CHANGELOG.md | 12 +++++++++++- ocp-plugin/index.js | 14 +++++++++++--- ocp-plugin/openclaw.plugin.json | 6 +++--- package.json | 2 +- 4 files changed, 26 insertions(+), 8 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index d7d7fb2..26fabdf 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,6 +1,16 @@ # Changelog -## v3.16.0 — 2026-XX-XX (release date filled at tag time) +## v3.16.1 — 2026-05-12 + +### Fixes + +- **OCP plugin port lag** — `ocp-plugin/index.js` hard-coded `http://127.0.0.1:3456` while OCP server moved to 3478 in v3.14+. Result: `/ocp` slash commands in OpenClaw (e.g. `/ocp usage` from the home Telegram bot) returned "OCP error: fetch failed". Default is now `http://127.0.0.1:3478` and the plugin reads `OCP_PROXY_URL` env (full URL) or `CLAUDE_PROXY_PORT` env (port only) when set. `openclaw.plugin.json` `configSchema.proxyUrl.default` also updated and the plugin version bumped to `3.16.1`. Run `ocp update` to redeploy the plugin into `~/.openclaw/extensions/ocp/`. + +### Governance + +- No `cli.js` citation needed (no `server.mjs` change). ALIGNMENT.md Rule 2 not engaged. + +## v3.16.0 — 2026-05-10 ### Features diff --git a/ocp-plugin/index.js b/ocp-plugin/index.js index dca4740..2f689ee 100644 --- a/ocp-plugin/index.js +++ b/ocp-plugin/index.js @@ -1,9 +1,17 @@ /** * OCP Plugin — registers /ocp as a native slash command in OpenClaw gateway. - * Calls the local claude-proxy at http://127.0.0.1:3456 and formats the response. + * Calls the local claude-proxy and formats the response. + * + * Port resolution (in priority order): + * 1. OCP_PROXY_URL env (full URL, e.g. http://10.0.0.5:3478) + * 2. CLAUDE_PROXY_PORT env (port only; localhost assumed) + * 3. Fallback: http://127.0.0.1:3478 (OCP v3.14+ default) + * + * (The legacy 3456 default — pre-v3.14 — caused "OCP error: fetch failed" + * on machines whose OCP server moved to 3478 while the plugin lagged.) */ - -const PROXY = "http://127.0.0.1:3456"; +const PROXY = process.env.OCP_PROXY_URL + || (process.env.CLAUDE_PROXY_PORT ? `http://127.0.0.1:${process.env.CLAUDE_PROXY_PORT}` : "http://127.0.0.1:3478"); // Wrap output in monospace code block for Telegram/Discord alignment function mono(text) { return "```\n" + text + "\n```"; } diff --git a/ocp-plugin/openclaw.plugin.json b/ocp-plugin/openclaw.plugin.json index a73ff5f..3f3922d 100644 --- a/ocp-plugin/openclaw.plugin.json +++ b/ocp-plugin/openclaw.plugin.json @@ -2,15 +2,15 @@ "id": "ocp", "name": "OCP Commands", "description": "Slash commands for the OpenClaw Proxy — /ocp usage, /ocp settings, /ocp health, etc.", - "version": "3.12.0", + "version": "3.16.1", "configSchema": { "type": "object", "additionalProperties": false, "properties": { "proxyUrl": { "type": "string", - "default": "http://127.0.0.1:3456", - "description": "URL of the Claude proxy" + "default": "http://127.0.0.1:3478", + "description": "URL of the Claude proxy. Overridable via OCP_PROXY_URL or CLAUDE_PROXY_PORT env." } } } diff --git a/package.json b/package.json index 6f01a6b..d5446a4 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "open-claude-proxy", - "version": "3.16.0", + "version": "3.16.1", "description": "OCP (Open Claude Proxy) — use your Claude Pro/Max subscription as an OpenAI-compatible API for any IDE. Works with Cline, OpenCode, Aider, Continue.dev, OpenClaw, and more.", "type": "module", "bin": {