From afe0c6e1be59a8f22d70a50cf1f66d499129ddd9 Mon Sep 17 00:00:00 2001 From: dtzp555 Date: Sat, 4 Apr 2026 09:26:01 +1000 Subject: [PATCH] fix: computeFirstByteTimeout now respects CLAUDE_FIRST_BYTE_TIMEOUT env var The adaptive timeout calculation ignored BASE_FIRST_BYTE_TIMEOUT (set via CLAUDE_FIRST_BYTE_TIMEOUT env), always using the tier base (120s for Sonnet). Now uses whichever is larger: adaptive or env override. Bump to v3.2.2. Co-Authored-By: Claude Opus 4.6 --- ocp-plugin/openclaw.plugin.json | 2 +- ocp-plugin/package.json | 2 +- package.json | 2 +- server.mjs | 4 +++- 4 files changed, 6 insertions(+), 4 deletions(-) diff --git a/ocp-plugin/openclaw.plugin.json b/ocp-plugin/openclaw.plugin.json index d4d4b95..d87421f 100644 --- a/ocp-plugin/openclaw.plugin.json +++ b/ocp-plugin/openclaw.plugin.json @@ -2,7 +2,7 @@ "id": "ocp", "name": "OCP Commands", "description": "Slash commands for the OpenClaw Proxy — /ocp usage, /ocp settings, /ocp health, etc.", - "version": "3.2.1", + "version": "3.2.2", "configSchema": { "type": "object", "additionalProperties": false, diff --git a/ocp-plugin/package.json b/ocp-plugin/package.json index b8ecbbd..ec53e79 100644 --- a/ocp-plugin/package.json +++ b/ocp-plugin/package.json @@ -1,6 +1,6 @@ { "name": "ocp", - "version": "3.2.1", + "version": "3.2.2", "description": "Slash commands for the OpenClaw Proxy", "main": "index.js", "type": "module", diff --git a/package.json b/package.json index 7856013..efc64db 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "openclaw-claude-proxy", - "version": "3.2.1", + "version": "3.2.2", "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": { diff --git a/server.mjs b/server.mjs index 7b885f8..e6149b5 100644 --- a/server.mjs +++ b/server.mjs @@ -374,7 +374,9 @@ function getModelTier(cliModel) { function computeFirstByteTimeout(cliModel, promptLength) { const tier = MODEL_TIMEOUT_TIERS[getModelTier(cliModel)]; - const timeout = tier.base + Math.floor(promptLength * tier.perPromptChar); + const adaptive = tier.base + Math.floor(promptLength * tier.perPromptChar); + // Use whichever is larger: adaptive calculation or BASE_FIRST_BYTE_TIMEOUT (env override) + const timeout = Math.max(adaptive, BASE_FIRST_BYTE_TIMEOUT); return Math.min(timeout, Math.max(TIMEOUT - 5000, 10000)); }