Skip to content

LLM idle timeout cannot be configured for long local llama.cpp requests in 2026.5.3-1 #77744

Closed

Description

@juaps

Bug type

Regression (worked before, now fails)

Beta release blocker

No

Summary

After updating to OpenClaw 2026.5.3-1, long local llama.cpp requests time out even though the backend is still actively processing the prompt.

The old agents.defaults.llm.idleTimeoutSeconds config is rejected as an unrecognized key. The suggested models.providers.<id>.timeoutSeconds config is accepted and hot reloaded, but it does not prevent the chat from being cut off during long local model prefill.

This looks like the idle watchdog is still using another timeout path that is not configurable through the current schema.

Steps to reproduce

  1. Install or update OpenClaw to 2026.5.3-1.
  2. Run OpenClaw in Docker.
  3. Configure a local llama.cpp / OpenAI-compatible provider.
  4. Use a large-context local model, for example qwen3.6-35b.
  5. Configure the agent primary model as llamacpp/qwen3.6-35b.
  6. Send a very large prompt, around 150k tokens, through webchat.
  7. Observe that llama.cpp keeps processing the prompt, but OpenClaw cancels before the model produces a reply.
  8. Try adding agents.defaults.llm.idleTimeoutSeconds.
  9. Observe OpenClaw rejects the config with Unrecognized key: "llm".
  10. Try using models.providers.llamacpp.timeoutSeconds.
  11. Observe the config is accepted and hot reloaded, but the chat still times out.

Expected behavior

OpenClaw should wait for the local provider according to the configured timeout, especially when the provider is still processing a long prefill and has not failed.

A long local llama.cpp prefill should not be treated as a failed model request merely because no output token has been produced yet.

Actual behavior

OpenClaw cuts off the agent request before the local llama.cpp backend finishes prompt prefill and produces a reply.

The llama.cpp server is still alive and processing. It is not dead. The request is cancelled from the OpenClaw side before completion.

When fallbacks are configured, OpenClaw then tries fallback providers even though the local model was still working.

OpenClaw version

2026.5.3-1

Operating system

Docker container on NAS, with local llama.cpp backend running on Mac.

Install method

Docker / custom image based on ghcr.io/openclaw/openclaw:latest.

Model

OpenClaw model id:

llamacpp/qwen3.6-35b

Local backend model:

Qwen3.6-35B-A3B-GGUF

Qwen3.6-35B-A3B-Q6_K.gguf

Provider / routing chain

OpenClaw → local llama.cpp OpenAI-compatible server → /v1/responses

Additional provider/model setup details

Provider config:

"models": {
  "mode": "merge",
  "providers": {
    "llamacpp": {
      "baseUrl": "http://cerebro-mac:8080/v1",
      "apiKey": "dummy",
      "api": "openai-responses",
      "timeoutSeconds": 14400,
      "models": [
        {
          "id": "qwen3.6-35b",
          "name": "Qwen 3.6 35B A3B local llama.cpp",
          "reasoning": true,
          "input": ["text"],
          "contextWindow": 262144,
          "maxTokens": 100000
        }
      ]
    }
  }
}

Agent config:

"agents": {
  "defaults": {
    "timeoutSeconds": 14400,
    "model": {
      "primary": "llamacpp/qwen3.6-35b",
      "fallbacks": []
    },
    "compaction": {
      "timeoutSeconds": 10800
    },
    "models": {
      "llamacpp/qwen3.6-35b": {
        "timeoutSeconds": 14400,
        "streaming": true
      }
    }
  }
}

Config that no longer works:

{
  "agents": {
    "defaults": {
      "llm": {
        "idleTimeoutSeconds": 3600
      }
    }
  }
}

This raises:

agents.defaults: Unrecognized key: "llm"

models.providers.llamacpp.timeoutSeconds is accepted by hot reload, but the long request still gets cancelled.

Logs, screenshots, and evidence

OpenClaw logs show fallback and timeout behavior:

Embedded agent failed before reply: All models failed
llamacpp/qwen3.6-35b: LLM request timed out

Config reload confirms models.providers.llamacpp.timeoutSeconds is accepted:

config hot reload applied (... models.providers.llamacpp.timeoutSeconds ...)

Adding agents.defaults.llm.idleTimeoutSeconds fails:

config reload skipped (invalid config): agents.defaults: Unrecognized key: "llm"

The local llama.cpp backend receives the request and starts processing a very large prompt:

task.n_tokens = 152780
prompt processing progress ...
n_tokens = 67584
srv stop: cancel task
done request: POST /v1/responses 200

This suggests the backend was still processing and did not crash. The request was cancelled before the model had a chance to produce a reply.

Impact and severity

Affected: local large-context llama.cpp users.

Severity: Critical for long-running local model workflows.

Frequency: 100% on very large prompts since updating to 2026.5.3-1.

Consequence: long local model requests cannot complete because OpenClaw cancels before the first reply.

Additional information

This appears to be a regression or schema/config mismatch around idle timeout behavior.

The old agents.defaults.llm.idleTimeoutSeconds path is rejected.

The new suggested models.providers.<id>.timeoutSeconds path is accepted but does not stop the idle watchdog cancellation.

Question:

What is the correct supported config key in 2026.5.3-1 to increase the idle watchdog timeout for long local model prefill?

Is there a separate hidden/default idle timeout still active even when models.providers.<id>.timeoutSeconds is set?

Activity

  1. clawsweeper commented on May 5, 2026

    @clawsweeper
    Contributor

    Codex review: keeping this open for maintainer follow-up; there is still a little grit to resolve.

    Summary
    Keep open: current main and the latest release still match the reported timeout path for a Docker/self-hosted llama.cpp provider using a bare hostname, because the explicit provider timeout is converted to model request metadata but then clamped by the non-local idle-watchdog branch.

    Reproducibility: yes. for the source-level mismatch: with modelRequestTimeoutMs=14400000 and baseUrl=http://cerebro-mac:8080/v1, current main classifies the host as non-local and caps the idle watchdog at 120s. I did not run the full Docker and llama.cpp prefill path.

    Next step
    This is a focused source-backed regression candidate: the failing branch, likely files, related timeout cluster, and validation path are clear enough for one repair PR.

    Review details

    Best possible solution:

    Keep the provider-scoped timeout contract and make explicit models.providers.<id>.timeoutSeconds reach the model idle watchdog for self-hosted/local OpenAI-compatible providers, including Docker bare-host aliases, without restoring agents.defaults.llm.

    Do we have a high-confidence way to reproduce the issue?

    Yes for the source-level mismatch: with modelRequestTimeoutMs=14400000 and baseUrl=http://cerebro-mac:8080/v1, current main classifies the host as non-local and caps the idle watchdog at 120s. I did not run the full Docker and llama.cpp prefill path.

    Is this the best way to solve the issue?

    Yes. The narrow maintainable fix is to align the existing provider-timeout contract with the idle watchdog for this self-hosted provider path, not to reintroduce the retired legacy key or add a new timeout hierarchy here.

    Acceptance criteria:

    • node scripts/run-vitest.mjs src/agents/pi-embedded-runner/run/llm-idle-timeout.test.ts src/agents/pi-embedded-runner/model.test.ts src/agents/provider-transport-fetch.test.ts
    • node scripts/crabbox-wrapper.mjs run --shell -- "pnpm check:changed"

    What I checked:

    • Issue evidence: The reporter configured models.providers.llamacpp.timeoutSeconds: 14400 with baseUrl: http://cerebro-mac:8080/v1, saw hot reload accept it, and logged OpenClaw cancelling while llama.cpp was still processing a 152k-token prompt; a follow-up comment confirms the replacement key is the specific failing path.
    • Provider timeout reaches model metadata: Current main converts provider timeoutSeconds to requestTimeoutMs and attaches it to configured provider models, so the configured 14400s value reaches the idle resolver input. (src/agents/pi-embedded-runner/model.ts:355, 0ad3d25fb7cd)
    • Bare host stays on the clamped branch: The local-provider classifier explicitly does not detect DNS-resolved local aliases, so a bare host like cerebro-mac is not local; for non-local models, modelRequestTimeoutMs goes through clampImplicitTimeoutMs, which caps it at the 120s default. (src/agents/pi-embedded-runner/run/llm-idle-timeout.ts:35, 0ad3d25fb7cd)
    • Focused tests preserve the mismatch: The current tests expect remote/non-local provider timeouts above the default to cap at 120s, and only verify full explicit provider timeout for a locally classified 127.0.0.1 base URL. (src/agents/pi-embedded-runner/run/llm-idle-timeout.test.ts:46, 0ad3d25fb7cd)
    • Documented contract says provider timeout covers the idle watchdog: The agent-loop docs say models.providers.<id>.timeoutSeconds extends the model idle watchdog for slow local/self-hosted providers and applies to provider HTTP handling plus model stream idle watchdog. Public docs: docs/concepts/agent-loop.md. (docs/concepts/agent-loop.md:169, 0ad3d25fb7cd)
    • Legacy key is intentionally retired: The strict agent defaults schema exposes timeoutSeconds but no llm object, and doctor docs say to remove agents.defaults.llm in favor of models.providers.<id>.timeoutSeconds, so restoring the old key is not the right repair path. (src/config/zod-schema.agent-defaults.ts:245, 0ad3d25fb7cd)

    Likely related people:

    • steipete: Current blame and file history point to Peter Steinberger for the current timeout resolver, provider-timeout metadata, and public timeout docs that define the replacement contract. (role: recent area contributor; confidence: high; commits: 532759e1ab2e, 7e2a1db53b8d, d9dc75774bcb; files: src/agents/pi-embedded-runner/run/llm-idle-timeout.ts, src/agents/pi-embedded-runner/model.ts, docs/concepts/agent-loop.md)
    • liuy: Git history shows Liu Yuan introduced the streaming LLM idle-timeout wrapper and resolver surface that now enforces the no-output watchdog. (role: introduced adjacent behavior; confidence: medium; commits: 84b72e66b918; files: src/agents/pi-embedded-runner/run/llm-idle-timeout.ts, src/agents/pi-embedded-runner/run/attempt.ts)
    • ImLukeF: Git history shows ImLukeF worked on aligning LLM idle-timeout defaults and explicit run-timeout behavior in the same resolver policy area. (role: adjacent timeout contributor; confidence: medium; commits: ddefce3c1868, 7f2814fc4a76; files: src/agents/pi-embedded-runner/run/llm-idle-timeout.ts, src/agents/pi-embedded-runner/run/attempt.ts)

    Remaining risk / open question:

    • No live Docker plus 150k-token llama.cpp replay was run in this read-only review; the high-confidence proof is the resolver path plus reporter logs.
    • A broad change could lengthen dead-stream waits for cloud providers, so the repair should preserve the default cloud watchdog when no explicit provider timeout is configured.
    • The broader user-facing idle-timeout hierarchy remains tracked separately in Expose model stream idle-timeout as user config (currently ~120s, hardcoded) #78361 and should not be mixed into this narrow bug fix.

    Codex review notes: model gpt-5.5, reasoning high; reviewed against 0ad3d25fb7cd.

  2. juaps commented on May 5, 2026

    @juaps
    Author

    Additional clarification: the most specific regression in my case is that my previous timeout configuration used to work, but after the update the timeout behavior changed.

    Before the update, setting timeout-related config was enough to let long local model requests keep running. Now there are two different failure modes:

    1. If I use the old idle timeout path:
    {
      "agents": {
        "defaults": {
          "llm": {
            "idleTimeoutSeconds": 3600
          }
        }
      }
    }

    OpenClaw rejects the config:

    agents.defaults: Unrecognized key: "llm"
    
    1. If I use the currently suggested provider timeout path:
    "models": {
      "providers": {
        "llamacpp": {
          "timeoutSeconds": 14400
        }
      }
    }

    OpenClaw accepts / hot reloads the config, but the chat still gets cut off during long local prefill. So the key is accepted, but it does not seem to affect the actual idle watchdog that cancels the request before the first token.

    So the specific issue is not just that a local model is slow. The regression is that the timeout configuration that previously allowed long local requests no longer works, and the replacement key appears to configure a different timeout path than the one actually aborting the agent run.

    In short:

    • agents.defaults.llm.idleTimeoutSeconds used to be the obvious setting but is now rejected by schema.
    • models.providers.<id>.timeoutSeconds is accepted but does not prevent the cutoff.
    • The backend is still processing when OpenClaw cancels the request.

    That is why I suspect there is still a separate idle watchdog timeout path that is either hardcoded, not exposed in the current schema, or no longer wired to the provider timeout value.

  3. esqandil commented on May 6, 2026

    @esqandil
    Contributor

    Adding source-level evidence from 2026.5.4 (325df3e) for the silent clamp behaviour:

    The bundled dist code clamps any caller-provided implicit timeout down to a hard 120s ceiling:

    clampImplicitTimeoutMs(valueMs) = Math.min(valueMs, DEFAULT_LLM_IDLE_TIMEOUT_MS)

    with these constants:

    • DEFAULT_LLM_IDLE_TIMEOUT_MS = 120_000 (120s)
    • MAX_SAFE_TIMEOUT_MS = 2_147_001 — used as a sentinel: any value ≥ this returns 0, which fully disables the idle watchdog.

    So:

    • runTimeoutSeconds: 1800 → clamped silently to 120s. Run dies at 120s.
    • runTimeoutSeconds: 14400 → clamped silently to 120s. Run dies at 120s.
    • runTimeoutSeconds: 2147001 → watchdog disabled entirely (the only way to actually get >120s).

    This matches the reporter's experience: models.providers.llamacpp.timeoutSeconds is accepted by hot reload but does not affect the idle watchdog because the watchdog reads from the implicit-timeout pathway, which is clamped.

    There is no warning or log entry when the clamp fires, so users have no signal that their requested timeout was ignored. We hit this for hours on long-reasoning models (gpt-5.5-pro, gemini-3.x-pro) before the dist source revealed the clamp.

    Suggested fixes (in order of preference):

    1. Treat user-provided values as authoritative — remove the implicit clamp for explicit caller input.
    2. At minimum, log a warning when the clamp fires, and document DEFAULT_LLM_IDLE_TIMEOUT_MS and the MAX_SAFE_TIMEOUT_MS sentinel in docs/gateway/configuration-reference.md.

    Related: #8724 — once per-model requestTimeoutMs is schema-accepted, the runtime path that reads it (params.model.requestTimeoutMs) bypasses this clamp.

  4. shakkernerd commented on May 19, 2026

    @shakkernerd
    Contributor

    Fixed on current main by #83979.

    The provider timeout now feeds the model idle watchdog directly instead of being clamped back to the implicit ~120s default. I verified the reported self-hosted bare-host path on current main with http://cerebro-mac:8080/v1 and models.providers.<id>.timeoutSeconds: 14400; resolveLlmIdleTimeoutMs returns 14400000 ms for that case.

    Relevant landed path:

    • src/agents/pi-embedded-runner/run/llm-idle-timeout.ts: explicit modelRequestTimeoutMs from models.providers.<id>.timeoutSeconds is honored, still bounded by any shorter run/agent timeout.
    • docs/concepts/agent-loop.md: documents that provider timeout now covers the model stream idle watchdog.

    Closing this as fixed by #83979.

  5. locked as resolved and limited conversation to collaborators on May 22, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Fields

    Priority

    None yet

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions