Skip to content

[Bug]: OpenClaw 5.22: ~10 sec per-call inference overhead in infer model run (both --gateway and --local) vs ~1.3 sec direct provider call #88201

Open

Description

@adamdksaad-ops

Bug type

Regression (worked before, now fails)

Beta release blocker

No

Summary

Every model invocation through OpenClaw carries ~10–13 seconds of overhead independent of execution mode or model choice. With agents making 3+ model calls per response, this produces 30–40 second response times for trivial prompts (e.g. "Hi") on a fully-resourced Hostinger VPS template (ghcr.io/hostinger/hvps-openclaw).
A direct curl to the same upstream provider with the same model returns in 1.3 sec, confirming the bottleneck is in OpenClaw's inference path, not network, provider, or model.

Steps to reproduce

1. In a running OpenClaw container (this example is on the Hostinger VPS template, OpenClaw 2026.5.22),

with a valid ANTHROPIC_API_KEY available, time a direct curl to Anthropic for a trivial prompt:

time curl -sS -o /tmp/resp.json -w "Total: %{time_total}s\n"
-X POST https://api.anthropic.com/v1/messages
-H "x-api-key: $ANTHROPIC_API_KEY"
-H "anthropic-version: 2023-06-01"
-H "content-type: application/json"
-d '{"model":"claude-sonnet-4-6","max_tokens":10,"messages":[{"role":"user","content":"Hi"}]}'

2. Then time the equivalent call via OpenClaw, both modes:

time openclaw infer model run --prompt "Hi, respond with just OK" --gateway
time openclaw infer model run --prompt "Hi, respond with just OK" --local

Expected behavior

A single model invocation through OpenClaw should add minimal latency on top of the upstream provider call — typically in the range of 1–2 seconds of overhead, accounting for auth resolution, request marshalling, response handling, and gateway communication.
For a claude-sonnet-4-6 prompt that returns in 1.3 seconds via direct curl to Anthropic, the equivalent call via openclaw infer model run should complete in approximately 2–3 seconds end-to-end, regardless of execution mode (--gateway or --local).
This matches the bot's pre-regression behavior: agent responses to trivial Telegram messages completed in under 10 seconds on this same VPS template prior to the auto-updates that advanced OpenClaw from 2026.5.12 → 2026.5.22.

Actual behavior

A single model invocation through OpenClaw on 2026.5.22 takes 14–16 seconds for the same trivial prompt, representing approximately 10–13 seconds of unaccounted overhead per call.

The overhead is present in both --gateway and --local execution modes, ruling out the gateway daemon as the cause:

ModeTimeDirect curl to api.anthropic.com1.33 secopenclaw infer model run --gateway14.48 secopenclaw infer model run --local15.99 sec

Partial mitigation by clearing two plugin warnings (brave plugin ownership fix + oxylabs duplicate install rename) brought --gateway timing down to 10.86 sec, indicating that plugin registry validation is running per-invocation rather than at startup. The remaining ~9.6 sec of overhead per call is unexplained by user-visible config and persists after openclaw doctor --fix shows zero warnings.

Real-world impact: agents in this deployment make 3–4 model calls per response (planning, memory, response generation, optional tool use). At ~10.9 sec per call, this produces 40-second end-to-end response times for trivial Telegram messages like "Hi" — making the bot unusable for the production workload it was deployed for.

OpenClaw version

2026.5.22 (a374c3a)

Operating system

Ubuntu 24.04 LTS (Hostinger VPS, Docker host) Container runs Debian-based Linux (per ghcr.io/hostinger/hvps-openclaw image)

Install method

Hostinger VPS template (managed). Docker image: ghcr.io/hostinger/hvps-openclaw Container name: openclaw-b4ba-openclaw-1 Auto-updates via internal openclaw update cron, last update advanced version from 2026.5.12 → 2026.5.22 without user intervention.

Model

anthropic/claude-sonnet-4-6 (alias "Claude Sonnet 4.6")

Provider / routing chain

Direct: OpenClaw gateway → Anthropic API (api.anthropic.com) No OpenRouter / no proxy / no intermediate model router on the path being timed. Auth: ANTHROPIC_API_KEY environment variable, resolved at request time.

Additional provider/model setup details

  • Config primary set to anthropic/claude-sonnet-4-6 in agents.defaults.model.primary (set by an update; pre-update value was openrouter/anthropic/claude-haiku-4-5).
  • openrouter:default auth profile also configured in /data/.openclaw/agents/main/agent/auth-profiles.json and used separately for embeddings via custom memorySearch.remote.baseUrl=https://openrouter.ai/api/v1/.
  • No custom models.providers.<id> definitions for Anthropic — using OpenClaw's default anthropic adapter.
  • No prompt caching, no streaming-specific flags, no thinking budget set on the test prompts.
  • The same 13-second per-call overhead is reproducible with the direct Anthropic provider via infer model run even when the agent loop and Telegram channel are entirely uninvolved — so this is not a Telegram-layer or agent-orchestration issue, it's in the inference path.

Logs, screenshots, and evidence

$ time curl -sS -o /tmp/resp.json -w "\nHTTP %{http_code}\nDNS lookup: %{time_namelookup}s\nConnect: %{time_connect}s\nTLS handshake: %{time_appconnect}s\nFirst byte: %{time_starttransfer}s\nTotal: %{time_total}s\n" -X POST https://api.anthropic.com/v1/messages -H "x-api-key: $KEY" -H "anthropic-version: 2023-06-01" -H "content-type: application/json" -d '{"model":"claude-sonnet-4-6","max_tokens":10,"messages":[{"role":"user","content":"Hi"}]}'

HTTP 200
DNS lookup: 0.001315s
Connect: 0.008815s
TLS handshake: 0.029779s
First byte: 1.324463s
Total: 1.325297s
real    0m1.340s

$ time docker exec openclaw-b4ba-openclaw-1 openclaw infer model run --prompt "Hi, respond with just OK" --gateway
model.run via gateway
provider: anthropic
model: claude-sonnet-4-6
outputs: 1
OK
real    0m14.476s

$ time docker exec openclaw-b4ba-openclaw-1 openclaw infer model run --prompt "Hi, respond with just OK" --local
model.run via local
provider: anthropic
model: claude-sonnet-4-6
outputs: 1
OK
real    0m15.995s

$ docker exec -u root openclaw-b4ba-openclaw-1 chown -R root:root /data/.openclaw/npm/node_modules/@openclaw/brave-plugin
$ docker exec -u root openclaw-b4ba-openclaw-1 mv /data/.openclaw/extensions/oxylabs-ai-studio-openclaw /data/.openclaw/extensions/oxylabs-ai-studio-openclaw.disabled

$ time docker exec openclaw-b4ba-openclaw-1 openclaw infer model run --prompt "Hi, respond with just OK" --gateway
model.run via gateway
provider: anthropic
model: claude-sonnet-4-6
outputs: 1
OK
real    0m10.859s

2026-05-29T14:27:55.380-04:00 [diagnostic] liveness warning: reasons=event_loop_delay interval=39s eventLoopDelayP99Ms=21.2 eventLoopDelayMaxMs=11014.2 eventLoopUtilization=0.517 cpuCoreRatio=0.528 active=1 waiting=0 queued=2 recentPhases=post-attach.update-check:1ms,sidecars.restart-sentinel:52ms,post-attach.update-sentinel:46ms,sidecars.session-locks:92ms,post-ready.maintenance:359ms,sidecars.model-prewarm:5689ms work=[active=agent:main:main(processing/embedded_run,q=1,age=15s last=embedded_run:started) queued=agent:pat:main(idle,q=2,age=86423s last=embedded_run:ended)]

◇  Config warnings ────────────────────────────────────────────────────────────╮
│                                                                              │
│  - plugins: plugin brave: blocked plugin candidate: suspicious               │
│    ownership (/data/.openclaw/npm/node_modules/@openclaw/brave-plugin,       │
│    uid=1000, expected uid=0 or root)                                         │
│  - plugins: plugin oxylabs-ai-studio-openclaw: duplicate plugin id           │
│    detected; global plugin will be overridden by global plugin               │
│    (/data/.openclaw/npm/node_modules/oxylabs-ai-studio-openclaw/dist/index.  │
│  js)                                                                         │
│                                                                              │
├──────────────────────────────────────────────────────────────────────────────╯

Impact and severity

No response

Additional information

Production AI assistant deployed for business operations. Affects all model invocations on the affected version (not a single-feature break). Workarounds available (model swap to faster models, clearing plugin warnings) reduce but do not eliminate the overhead. Not data-loss or security, so not Critical.

Activity

  1. added
    bug
    on May 30, 2026
  2. added
    regression
    on May 30, 2026
  3. clawsweeper commented on May 30, 2026

    @clawsweeper
    Contributor

    Codex review: this still needs some work.

    Summary
    Keep open: the assigned owner explicitly confirmed remaining startup latency after the linked fixes, and current source does not establish full resolution.

    Reproducibility: Reporter timings and the owner's later live probes establish historical latency, but this read-only review did not reproduce the remaining delay on current main or an installed current release.

    Maintainer decision needed

    • Question: Which current installed-build profile establishes the remaining inference-command startup bottleneck?
    • Recommendation: Profile matched installed-build probes: Compare direct-provider, local CLI, and warm-Gateway requests with matched model inputs and output limits, separating startup from provider time.
    • Why: The linked fixes establish partial improvements, while development-launcher timings and subsequent runtime changes leave the current installed-package cost unresolved.

    Next step
    The assigned owner should profile matched current installed-build direct-provider, local CLI, and warm-Gateway requests to identify the remaining startup cost before selecting a repair.

    Review details

    Best possible solution:

    Remove the remaining measured startup work at its existing owner while preserving model selection, authentication, and resource cleanup.

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

    Reporter timings and the owner's later live probes establish historical latency, but this read-only review did not reproduce the remaining delay on current main or an installed current release.

    Is this the best way to solve the issue?

    The merged optimizations remove demonstrated unnecessary work; another repair should follow matched profiling rather than treating all CLI startup cost as per-inference agent overhead.

    AGENTS.md: found and applied where relevant.

    Remaining risk / open question:

    • No matched current installed-package benchmark establishes the remaining latency or its dominant owner.
    • Whole-command timings include process startup and differ from the direct-provider request parameters.

    Codex review notes: model internal, reasoning medium; reviewed against 961f85dc8adb.

    Label changes

    Label changes:

    No label changes.

    Label justifications:

    • P2: Measured inference-command latency merits continued investigation, but current-release severity and a bounded repair remain unverified.
    • impact:other: The reported impact is excessive inference-command and assistant response latency.
    Evidence reviewed

    What I checked:

    How this review workflow works
    • ClawSweeper keeps one durable marker-backed review comment per issue or PR.
    • Re-runs edit this comment so the latest verdict, findings, and automation markers stay together instead of adding duplicate bot comments.
    • A fresh review can be triggered by eligible @clawsweeper re-review comments, exact-item GitHub events, scheduled/background review runs, or manual workflow dispatch.
    • PR/issue authors and users with repository write access can comment @clawsweeper re-review or @clawsweeper re-run on an open PR or issue to request a fresh review only.
    • Maintainers can also comment @clawsweeper review to request a fresh review only.
    • Fresh-review commands do not start repair, autofix, rebase, CI repair, or automerge; those execution lanes are retired.
    • Maintainers can comment @clawsweeper explain to ask for more context, or @clawsweeper stop to stop active automation.

    Reviewed October 27, 2026, 4:41 AM ET / 08:41 UTC.

  4. added
    P1
    impact:other
    issue-rating: 🦐 gold shrimp
    clawsweeper:needs-info
    clawsweeper:no-new-fix-pr
    clawsweeper:needs-maintainer-review
    on May 30, 2026
  5. adamdksaad-ops commented on May 31, 2026

    @adamdksaad-ops
    Author

    Thanks for the quick triage and for confirming this matches work already in progress on main.
    A few questions to help me plan around the regression in production:

    Release ETA — Is there a target version (or rough timeline) for the lean-path and prewarm mitigations landing in a tagged release? We're running OpenClaw 2026.5.22 in production via the managed Hostinger VPS template, and the per-call overhead is materially affecting daily usage of the bot for business operations.
    Affected scope — Is the mitigation expected to fully restore pre-5.12 inference latency, or is it a partial improvement? Want to set the right expectation internally before the patch lands.
    Interim guidance — Until the fix is released, is there an officially supported way to:

    Pin to an earlier version (e.g. 2026.5.12) on a managed template, OR
    Disable the model-prewarm sidecar via config, even if unsupported?

    I'd rather not modify anything that hasn't been blessed by a maintainer, given this is production infrastructure. Happy to operate as-is if no safe interim exists — I just want to make sure I'm not missing a documented option.
    Reproduction help — Re your note that current-main timing data would help confirm the fix: I can run the same timing comparison against main if you can point me at a Docker image or build instructions that match what a managed Hostinger customer would eventually receive. Happy to contribute that data back to this issue.

    On the requested "expected vs actual" addition — I've added that explicitly to the original report. Apologies for the field omission.
    Thanks again for keeping this open. Will track the issue for updates.

  6. self-assigned this
    on Jun 2, 2026
  7. added
    issue-rating: 🐚 platinum hermit
    clawsweeper:needs-live-repro
    and removed
    clawsweeper:needs-info
    issue-rating: 🦐 gold shrimp
    on Jun 19, 2026
  8. 27 remaining items

  9. added
    clawsweeper:needs-info
    clawsweeper:needs-maintainer-review
    clawsweeper:no-new-fix-pr
    issue-rating: 🦐 gold shrimp
    on Sep 26, 2026
  10. added
    issue-rating: 🦪 silver shellfish
    and removed
    clawsweeper:needs-info
    issue-rating: 🦐 gold shrimp
    on Oct 10, 2026
  11. steipete commented on Oct 11, 2026

    @steipete
    Contributor

    Progress: #169354 has landed. openclaw infer model run no longer loads the model catalog on every run; it now loads it only when an explicit model override needs case correction. With warm native Ollama llama3.2 answering in about 0.1 s, Gateway infer model run probes dropped from 10.5 s to about 6.4 s.

    Local --local runs still take 7–11 s, so most of the per-call overhead is CLI and runtime startup rather than inference. This stays open for that remaining work.

  12. added
    clawsweeper:needs-info
    issue-rating: 🦐 gold shrimp
    and removed
    issue-rating: 🦪 silver shellfish
    on Oct 16, 2026
  13. added
    clawsweeper:intake:bug
    and removed
    clawsweeper:intake:bug
    on Oct 27, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

P2bugclawsweeper:needs-infoclawsweeper:needs-maintainer-reviewclawsweeper:no-new-fix-primpact:otherissue-rating: 🦐 gold shrimpregression

Type

No type

Fields

Priority

None yet

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions