From 5ef70972e802cda49076cbffa35a669ca22eaf44 Mon Sep 17 00:00:00 2001 From: Julie Yaunches Date: Fri, 7 Aug 2026 11:43:40 -0400 Subject: [PATCH] fix(inference): propagate OpenClaw provider timeout --- Dockerfile | 3 ++- docs/inference/configure-inference-timeouts.mdx | 2 +- docs/reference/commands.mdx | 2 +- scripts/generate-openclaw-config.mts | 1 + src/lib/onboard/dockerfile-patch.ts | 4 ++-- test/generate-openclaw-config.test.ts | 4 ++-- 6 files changed, 9 insertions(+), 7 deletions(-) diff --git a/Dockerfile b/Dockerfile index 1bb11f5d2fe..cc8edf31cf7 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1183,7 +1183,8 @@ ARG NEMOCLAW_TOOL_DISCLOSURE=progressive # (e.g. "text" or "text,image" for vision-capable models). OpenClaw's # model schema currently accepts "text" and "image". See #2421. ARG NEMOCLAW_INFERENCE_INPUTS=text -# Per-request inference timeout (seconds) baked into agents.defaults.timeoutSeconds. +# Per-request inference timeout (seconds) baked into agents.defaults.timeoutSeconds +# and models.providers..timeoutSeconds. # Increase for slow local inference (e.g., CPU Ollama). openclaw.json is # immutable at runtime (Landlock read-only), so this can only be changed by # rebuilding via `nemoclaw onboard`. Ref: issue #2281 diff --git a/docs/inference/configure-inference-timeouts.mdx b/docs/inference/configure-inference-timeouts.mdx index 4b11d563b5d..2b89e2a143b 100644 --- a/docs/inference/configure-inference-timeouts.mdx +++ b/docs/inference/configure-inference-timeouts.mdx @@ -36,7 +36,7 @@ An unset, blank, invalid, or negative value uses 30 seconds for OpenClaw gateway Increase `NEMOCLAW_AGENT_TIMEOUT` for a slow model server, such as CPU-only local inference or modest vLLM hardware. -NemoClaw writes this value to `agents.defaults.timeoutSeconds` during onboarding. +NemoClaw writes this value to `agents.defaults.timeoutSeconds` and `models.providers..timeoutSeconds` during onboarding. ```bash export NEMOCLAW_AGENT_TIMEOUT=1800 diff --git a/docs/reference/commands.mdx b/docs/reference/commands.mdx index c4d20a3dd80..cb841a52963 100644 --- a/docs/reference/commands.mdx +++ b/docs/reference/commands.mdx @@ -4203,7 +4203,7 @@ OpenClaw-specific onboarding configuration: | `NEMOCLAW_WEB_SEARCH_PROVIDER` | `brave`, `tavily`, or `none` | Selects Brave Search or Tavily Search in non-interactive onboarding, or disables web search explicitly. When unset, `BRAVE_API_KEY` implicitly selects Brave before `TAVILY_API_KEY` can implicitly select Tavily. | | `BRAVE_API_KEY` | Brave Search API key | Supplies and implicitly selects Brave Search when no web search provider is set. NemoClaw validates the key and stores it in OpenShell rather than the sandbox. | | `TAVILY_API_KEY` | Tavily Search API key | Supplies and implicitly selects Tavily Search when no provider is set and no Brave key is available. NemoClaw validates the key and stores it in OpenShell rather than the sandbox. | -| `NEMOCLAW_AGENT_TIMEOUT` | positive integer (seconds) | Overrides `agents.defaults.timeoutSeconds` in the built OpenClaw config. Raise for slow inference. | +| `NEMOCLAW_AGENT_TIMEOUT` | positive integer (seconds) | Overrides `agents.defaults.timeoutSeconds` and `models.providers..timeoutSeconds` in the built OpenClaw config. Raise for slow inference. | | `NEMOCLAW_MCP_SHADOW_DIAGNOSTICS` | literal `1` to enable | Forwards opt-in successful Streamable HTTP MCP timing diagnostics to a newly created or rebuilt OpenClaw sandbox. It does not change timeouts, retries, requests, or responses. Unset it and rebuild after evidence collection to restore failure-only logging. Other values are ignored. | | `NEMOCLAW_AUTO_PAIR_SLOW_INTERVAL_SECS` | positive number of seconds | Sets the post-pairing poll cadence for the in-sandbox OpenClaw auto-pair watcher. Defaults to `5` so late allowlisted CLI and browser scope upgrades are approved before clients time out. Raise only on load-sensitive gateways. | | `NEMOCLAW_AUTO_PAIR_FAST_REENTRY_POLLS` | positive integer | Sets how many fast polls run after the watcher observes a fresh allowlisted scope-upgrade request. Defaults to `5`; set lower only when you need to reduce gateway polling. | diff --git a/scripts/generate-openclaw-config.mts b/scripts/generate-openclaw-config.mts index 98e798dac69..10807e4bfac 100755 --- a/scripts/generate-openclaw-config.mts +++ b/scripts/generate-openclaw-config.mts @@ -1409,6 +1409,7 @@ export function buildConfig(env: Env = process.env): JsonObject { baseUrl: inferenceBaseUrl, apiKey: "unused", api: inferenceApi, + timeoutSeconds: agentTimeout, models: providerModels, }, }; diff --git a/src/lib/onboard/dockerfile-patch.ts b/src/lib/onboard/dockerfile-patch.ts index 42098785584..a6880c58f10 100644 --- a/src/lib/onboard/dockerfile-patch.ts +++ b/src/lib/onboard/dockerfile-patch.ts @@ -391,8 +391,8 @@ export function patchStagedDockerfile( `ARG NEMOCLAW_INFERENCE_INPUTS=${sanitizeDockerArg(inferenceInputs)}`, ); } - // NEMOCLAW_AGENT_TIMEOUT — override agents.defaults.timeoutSeconds at build - // time. Lets users increase the per-request inference timeout without + // NEMOCLAW_AGENT_TIMEOUT overrides the agent-run and provider-request timeouts + // at build time. Users can increase the inference timeout without // editing the Dockerfile. Ref: issue #2281 const agentTimeout = process.env.NEMOCLAW_AGENT_TIMEOUT; if (agentTimeout && POSITIVE_INT_RE.test(agentTimeout)) { diff --git a/test/generate-openclaw-config.test.ts b/test/generate-openclaw-config.test.ts index 9d97605f625..48f72080079 100644 --- a/test/generate-openclaw-config.test.ts +++ b/test/generate-openclaw-config.test.ts @@ -786,10 +786,10 @@ describe("generate-openclaw-config.mts: config generation", () => { expect(config.tools?.toolSearch).toEqual(STRUCTURED_TOOL_SEARCH); expect(config.tools?.web?.search).toBeUndefined(); }); - - it("propagates agent timeout", () => { + it("propagates the agent timeout to the run and provider request (#8468)", () => { const config = runConfigScript({ NEMOCLAW_AGENT_TIMEOUT: "300" }); expect(config.agents.defaults.timeoutSeconds).toBe(300); + expect(config.models.providers["test-provider"].timeoutSeconds).toBe(300); }); it("rejects invalid agent timeout values", () => {