Skip to content

[Bug]: model-resolution and auth stages take 11-14s and 8-10s respectively on every agent dispatch (even with 0 plugins, 1 model) #77649

Closed

Description

@qing30653

Bug type

Regression (worked before, now fails)

Beta release blocker

No

Summary

Node: 24.13.1
Windows 10 x64
OpenClaw: 2026.5.3-1

Even with 0 plugins, 1 model (deepseek-v4-flash), no feishu, no moonshot:

  • model-resolution: 11852-14091ms every agent run
  • auth: 7779-10882ms every agent run
  • Total dispatch: 20-28s
  • openclaw health: 10.5s (should be <100ms)
  • openclaw status: 24s (should be <1s)
  • Single thread consuming 97% CPU (153s out of 157s)
  • eventLoopDelayMaxMs up to 45s
  • RSS memory 700MB+ with 4 models defined (270MB with 1 model)

DeepSeek API responds in 203ms (network not the issue).
DNS is 5ms (fast).

Steps to reproduce

openclaw gateway restart

Expected behavior

openclaw health spend 10s (normal < 100ms)

Actual behavior

openclaw health spend 10s (normal < 100ms)

OpenClaw version

OpenClaw 2026.5.3-1 (2eae30e)

Operating system

Window 10

Install method

No response

Model

deepseek v4

Provider / routing chain

Non

Additional provider/model setup details

No response

Logs, screenshots, and evidence

Impact and severity

No response

Additional information

No response

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 still has the reported hot-path surfaces, the issue is fresh with concrete timing data, and I did not find a merged current-main or shipped-release fix for the model-resolution/auth latency or the Windows event-loop stall.

    Reproducibility: no. The stage names and slow thresholds are source-backed on current main, but I did not establish a high-confidence Windows current-main reproduction from only openclaw gateway restart and the provided measurements.

    Next step
    The report is severe and recent, but it needs maintainer-guided Windows profiling or clearer logs before an autonomous repair PR has a narrow enough root cause.

    Review details

    Best possible solution:

    Profile the Windows dispatch path with startup-stage logs enabled, then remove repeated synchronous model/auth/catalog work from the hot path while preserving cached default health/status behavior.

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

    No. The stage names and slow thresholds are source-backed on current main, but I did not establish a high-confidence Windows current-main reproduction from only openclaw gateway restart and the provided measurements.

    Is this the best way to solve the issue?

    Unclear. There is no proposed patch; the likely maintainable direction is a targeted performance fix in embedded model/auth resolution plus verification that default health/status remain cached and fast.

    Acceptance criteria:

    • Windows 10 live reproduction with OPENCLAW_GATEWAY_STARTUP_TRACE=1 and embedded-run stage warnings captured
    • Targeted tests around src/agents/pi-embedded-runner/run.ts, src/agents/pi-embedded-runner/model.ts, and src/gateway/server-methods/health.ts once a root cause is isolated
    • Run the changed gate appropriate to touched agent/gateway files after any fix

    What I checked:

    • Reporter timing data: The issue reports Windows 10 with OpenClaw 2026.5.3-1, model-resolution at 11852-14091ms, auth at 7779-10882ms, health at 10.5s, status at 24s, one CPU-saturated thread, and eventLoopDelayMaxMs up to 45s.
    • Embedded run stage source: Current main records the same model-resolution and auth startup stages around dynamic model resolution, optional models.json generation, auth-store/profile ordering, and initializeAuthProfile. (src/agents/pi-embedded-runner/run.ts:496, a373468d8252)
    • Stage warning threshold: The embedded-run stage tracker warns at 10000ms total or 5000ms for one stage, so the reported stage durations exceed current code's own slow-stage thresholds. (src/agents/pi-embedded-runner/run/attempt-stage-timing.ts:17, a373468d8252)
    • Health cache and probe behavior: The gateway health method can return a fresh cached snapshot for non-probe requests, but explicit probe requests force refreshHealthSnapshot; this keeps slow live health probes relevant rather than obsolete. (src/gateway/server-methods/health.ts:85, a373468d8252)
    • CLI docs contract: Docs say default health can use a cached snapshot and default status stays on the fast read-only path, so 10s health and 24s status are not expected behavior. Public docs: docs/cli/status.md. (docs/cli/status.md:10, a373468d8252)
    • DeepSeek static provider surface: DeepSeek is a bundled provider plugin with a static model catalog and DEEPSEEK_API_KEY auth, so this should not need broad provider discovery for the named model. (extensions/deepseek/openclaw.plugin.json:22, a373468d8252)

    Likely related people:

    • steipete: Recent current-main commits touch the pi embedded runner dispatch path after the latest release. (role: recent maintainer; confidence: medium; commits: 7168896fdfed, 5dfaed184608, ed4b223cf252; files: src/agents/pi-embedded-runner/run.ts)
    • Eduardo Piva: Recent work wired and validated post-compaction guard behavior in the same embedded-runner dispatch area shortly before this report. (role: adjacent owner; confidence: medium; commits: 2a702f927fb5, 4c4825679b69; files: src/agents/pi-embedded-runner/run.ts)
    • Vincent Koc: Local history for the health/status and auth/model files resolves through the current release-refresh commit in this checkout; routing confidence is lower because deeper blame history was unavailable locally. (role: current-file history owner; confidence: low; commits: a491090b4867; files: src/gateway/server-methods/health.ts, src/commands/health.ts, src/commands/status-runtime-shared.ts)

    Remaining risk / open question:

    • No Windows 10 live reproduction was run, so the exact source of the CPU-bound stall is not isolated.
    • The issue gives strong measurements but minimal reproduction steps and no redacted logs or config, especially for the claimed 0-plugin setup while DeepSeek is a bundled provider plugin.

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

  2. scoootscooob commented on May 5, 2026

    @scoootscooob
    Member

    Closing this out based on a follow-up local repro/audit.

    I reproduced the gateway/control-plane symptom on macOS against the reported release (openclaw@2026.5.3-1, 2eae30e): external /healthz and /readyz took about 29.5s even though the gateway logged itself ready much earlier. The macOS repro did not reproduce the exact slow model-resolution / auth stage numbers with OpenRouter, but it did reproduce the important infra failure mode: synchronous provider discovery/plugin loading can starve the event loop after readiness, so health/status/websocket control traffic is not serviced reliably.

    Current 5.4 behavior is materially improved in the same local harness: health/ready were about 1.8-2.1s and embedded startup stages were sub-second (model-resolution hundreds of ms, auth about 100ms). The likely relevant fixes after 2eae30e are the native plugin-load path changes, especially avoiding JIT/source-loader work for compiled plugin modules and duplicate fallback loads.

    One nuance: broad model/provider discovery is still legitimate for explicit catalog/setup flows like /models --all, onboarding, doctor/status, and self-hosted provider scans. So the follow-up hardening should be scoped to keeping agent-run startup and gateway control-plane readiness responsive, not globally disabling broad discovery.

    Given this appears fixed or substantially mitigated after the reported release, I am closing this issue. If the same 20s+ dispatch/control-plane stall reproduces on current main or a newer release with startup trace logs, please reopen or file a fresh issue with the redacted trace.

  3. steipete commented on May 5, 2026

    @steipete
    Contributor

    Measured current beta on a Windows box.

    Environment:

    • Windows box: local Parallels Windows 11 guest (Microsoft Windows NT 10.0.26100)
    • Node: v24.14.0
    • npm: 11.9.0
    • OpenClaw: openclaw@beta -> 2026.5.4-beta.2 (e0002c4)
    • Install shape: temp npm prefix + isolated OPENCLAW_HOME/OPENCLAW_STATE_DIR; gateway on isolated port 19776

    Measured:

    • npm install --prefix <temp> openclaw@beta --no-audit --no-fund: 24.0s
    • Gateway startup: listening in about 2.6s, ready in about 4.3s
    • openclaw health --timeout 2500 --json warm runs:
      • wall: 3.21s, 2.86s, 2.95s
      • gateway durationMs: 245ms, 247ms, 233ms
    • openclaw status --timeout 2500 --json warm runs:
      • wall: 4.45s, 4.24s, 4.24s
    • Local DeepSeek agent startup with synthetic API key:
      • startup total to attempt-dispatch: 3473ms
      • runtime-plugins: 882ms
      • model-resolution: 526ms
      • auth: 2060ms
      • attempt-dispatch: 3ms
      • provider call then failed as expected with 401 after 827ms

    Not reproduced on latest beta in this run: the original health ~10.5s, status ~24s, model-resolution 11-14s, or auth 7-10s timings.

    One related observation: shortly after gateway startup, there was a transient liveness warning with eventLoopDelayMaxMs=2183.1; recent phases included sidecars.session-locks:2202ms and sidecars.model-prewarm:4002ms. That is still far below the reported eventLoopDelayMaxMs up to ~45s.

    Caveat: I did not pass a real DeepSeek key into the Windows VM command line, so the agent measurement covers startup/model/auth stages and expected invalid-key failure, not successful live DeepSeek dispatch latency.

  4. locked as resolved and limited conversation to collaborators on May 7, 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

    bugSomething isn't workingregressionBehavior that previously worked and now fails

    Type

    No type

    Fields

    Priority

    None yet

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions