Skip to content

[Bug]: Native Moonshot Discord runs spend ~30s in model-resolution before dispatch #84783

Closed as not planned

Description

@resYuto

Bug type

Behavior bug (incorrect output/state without crash)

Beta release blocker

No

Summary

Discord channel input shows typing for ~30s before model starts.

Steps to reproduce

  1. Start OpenClaw with moonshot without "openai-compatible" endpoint config.
  2. Talk to OepnClaw on Discord.

Expected behavior

Show typing indicator in few seconds.

Actual behavior

Show typing indicator after 10~30s

OpenClaw version

2026.5.19 (also reproduced on 2026.5.18)

Operating system

Ubuntu 24.04 / linux 6.8.0-117-generic x64

Install method

npm global

Model

moonshot/kimi-k2.6 native Moonshot provider

Provider / routing chain

openclaw -> moonshot

Additional provider/model setup details

No response

Logs, screenshots, and evidence

actual log

{"0":"{\"subsystem\":\"agent/embedded\"}","1":"[trace:embedded-run] startup stages: runId=10fe5fe6-d988-4cca-ae7b-27b393dbd594 sessionId=7761c6fb-1c9e-4d9e-bf01-eb26e55cc079 phase=attempt-dispatch totalMs=33703 stages=workspace:0ms@0ms,runtime-plugins:17ms@17ms,hooks:0ms@17ms,model-resolution:33681ms@33698ms,auth:1ms@33699ms,context-engine:1ms@33700ms,attempt-workspace:2ms@33702ms,attempt-prompt:0ms@33702ms,attempt-runtime-plan:1ms@33703ms,attempt-dispatch:0ms@33703ms","_meta":{"runtime":"node","runtimeVersion":"24.15.0","hostname":"unknown","name":"{\"subsystem\":\"agent/embedded\"}","parentNames":["openclaw"],"date":"2026-05-21T03:01:30.073Z","logLevelId":4,"logLevelName":"WARN","path":{"fullFilePath":"file:///home/openclaw/.npm-global/lib/node_modules/openclaw/dist/subsystem-C-H8Q21Y.js:178:14","fileName":"subsystem-C-H8Q21Y.js","fileNameWithLine":"subsystem-C-H8Q21Y.js:178","fileColumn":"14","fileLine":"178","filePath":".npm-global/lib/node_modules/openclaw/dist/subsystem-C-H8Q21Y.js","filePathWithLine":".npm-global/lib/node_modules/openclaw/dist/subsystem-C-H8Q21Y.js:178","method":"logToFile"}},"time":"2026-05-21T12:01:30.073+09:00","hostname":"microserver","message":"[trace:embedded-run] startup stages: runId=10fe5fe6-d988-4cca-ae7b-27b393dbd594 sessionId=7761c6fb-1c9e-4d9e-bf01-eb26e55cc079 phase=attempt-dispatch totalMs=33703 stages=workspace:0ms@0ms,runtime-plugins:17ms@17ms,hooks:0ms@17ms,model-resolution:33681ms@33698ms,auth:1ms@33699ms,context-engine:1ms@33700ms,attempt-workspace:2ms@33702ms,attempt-prompt:0ms@33702ms,attempt-runtime-plan:1ms@33703ms,attempt-dispatch:0ms@33703ms"}


---


openclaw@microserver:~$ openclaw models status

🦞 OpenClaw 2026.5.19 (a185ca2) — One CLI to rule them all, and one more restart because you changed the port.

Config        : ~/.openclaw/openclaw.json
Agent dir     : ~/.openclaw/agents/main/agent
Default       : moonshot/kimi-k2.6
Fallbacks (4) : google/gemini-3.1-pro-preview, google/gemini-flash-latest, google/gemini-flash-lite-latest, openai/gpt-5.3-codex
Image model   : -
Image fallbacks (0): -
Aliases (3)   : gemini -> google/gemini-3.1-pro-preview, Kimi -> moonshot/kimi-k2.6, GPT -> openai/gpt-5.3-codex
Configured models (5): google/gemini-3.1-pro-preview, google/gemini-flash-latest, google/gemini-flash-lite-latest, moonshot/kimi-k2.6, openai/gpt-5.3-codex

Auth overview
Auth store    : ~/.openclaw/agents/main/agent/auth-profiles.json
Shell env     : on
Providers w/ OAuth/tokens (0): -
- elevenlabs effective=env:[REDACTED] | env=[REDACTED] | source=env: ELEVENLABS_API_KEY
- google effective=env:[REDACTED] | env=[REDACTED] | source=env: GEMINI_API_KEY
- moonshot effective=profiles:~/.openclaw/agents/main/agent/auth-profiles.json | profiles=1 (oauth=0, token=0, api_key=1) | moonshot:default=[REDACTED] | env=[REDACTED] | source=env: MOONSHOT_API_KEY
- openai effective=env:[REDACTED] | env=[REDACTED] | source=env: OPENAI_API_KEY
- openai-codex effective=synthetic:codex-app-server | synthetic=plugin-owned | source=codex-app-server

Runtime auth
- openai via codex uses openai-codex effective=synthetic:codex-app-server | status=usable

OAuth/token status
- none
openclaw@microserver:~$ openclaw status --all

🦞 OpenClaw 2026.5.19 (a185ca2) — I'm not saying your workflow is chaotic... I'm just bringing a linter and a helmet.

│
12:19:00 [plugins] [memory-lancedb-pro] memory_recall queries the plugin store (LanceDB), not MEMORY.md.
  - Plugin memory (LanceDB) = primary recall source for semantic search
  - MEMORY.md / memory/YYYY-MM-DD.md = startup context / journal only
  - Use memory_store or auto-capture for recallable memories.

OpenClaw status --all

Overview
┌────────────────────┬────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┐
│ Item               │ Value                                                                                                                          │
├────────────────────┼────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┤
│ Version            │ 2026.5.19                                                                                                                      │
│ OS                 │ linux 6.8.0-117-generic (x64)                                                                                                  │
│ Node               │ 24.15.0                                                                                                                        │
│ Config             │ ~/.openclaw/openclaw.json                                                                                                      │
│ Dashboard          │ http://127.0.0.1:18789/                                                                                                        │
│ Tailscale exposure │ serve · unknown · microserver.taildc77f.ts.net · https://microserver.taildc77f.ts.net                                          │
│ Channel            │ stable (default)                                                                                                               │
│ Update             │ pnpm · up to date · npm latest 2026.5.19                                                                                       │
│ Gateway            │ local · ws://127.0.0.1:18789 (local loopback) · reachable 205ms · auth token · microserver (192.168.11.4) app 2026.5.19 linux  │
│                    │ 6.8.0-117-generic                                                                                                              │
│ Security           │ Run: openclaw security audit --deep                                                                                            │
│ Gateway self       │ unknown                                                                                                                        │
│ Gateway service    │ systemd user installed · enabled · running (pid 42034, state active)                                                           │
│ Node service       │ systemd user not installed                                                                                                     │
│ Agents             │ 3 total · 0 bootstrapping · 0 active · 6 sessions                                                                              │
│ Secrets            │ none                                                                                                                           │
└────────────────────┴────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┘

Channels
┌──────────┬─────────┬────────┬───────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┐
│ Channel  │ Enabled │ State  │ Detail                                                                                                                │
├──────────┼─────────┼────────┼───────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┤
│ Discord  │ ON      │ OK     │ token config (sha256:488d4a30 · len 72) · accounts 1/1                                                                │
└──────────┴─────────┴────────┴───────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┘

Discord accounts
┌──────────┬──────────┬───────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┐
│ Account  │ Status   │ Notes                                                                                                                         │
├──────────┼──────────┼───────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┤
│ default  │ OK       │ token:config · credential available in gateway runtime                                                                        │
└──────────┴──────────┴───────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┘

Agents
┌─────────────────┬────────────────┬──────────┬──────────┬────────────────────────────────────────────────────────────────────────────────────────────┐
│ Agent           │ Bootstrap file │ Sessions │ Active   │ Store                                                                                      │
├─────────────────┼────────────────┼──────────┼──────────┼────────────────────────────────────────────────────────────────────────────────────────────┤
│ main            │ ABSENT         │        5 │ 17m ago  │ ~/.openclaw/agents/main/sessions/sessions.json                                             │
│ auto-researcher │ ABSENT         │        0 │ unknown  │ ~/.openclaw/agents/auto-researcher/sessions/sessions.json                                  │
│ public          │ ABSENT         │        1 │ 10d ago  │ ~/.openclaw/agents/public/sessions/sessions.json                                           │
└─────────────────┴────────────────┴──────────┴──────────┴────────────────────────────────────────────────────────────────────────────────────────────┘

Diagnosis (read-only)

Gateway connection details:
  Gateway target: ws://127.0.0.1:18789
  Source: local loopback
  Config: /home/openclaw/.openclaw/openclaw.json
  Bind: loopback

✓ Config: /home/openclaw/.openclaw/openclaw.json
✓ Secret diagnostics (0)
✓ Restart sentinel: none
✓ Port 18789
  Detected OpenClaw Gateway listener on the configured port.
! Tailscale exposure: serve · daemon unknown · microserver.taildc77f.ts.net
  https: https://microserver.taildc77f.ts.net
✓ Skills: 24 eligible · 0 missing · /home/openclaw/.openclaw/workspace
✓ Plugin compatibility (none)

Gateway restart attempts (tail): /home/openclaw/.openclaw/logs/gateway-restart.log
  [2026-05-20T16:06:48Z] openclaw restart attempt source=update target=openclaw-gateway.service
  [2026-05-20T16:06:48Z] openclaw restart done source=update
  [2026-05-21T02:12:41Z] openclaw restart attempt source=update target=openclaw-gateway.service
  [2026-05-21T02:12:45Z] openclaw restart done source=update
✓ Channel issues (none)

Pasteable debug report. Auth tokens redacted.
Troubleshooting: https://docs.openclaw.ai/troubleshooting

◇
openclaw@microserver:~$ openclaw config get agents.defaults.model

🦞 OpenClaw 2026.5.19 (a185ca2) — I'm not magic—I'm just extremely persistent with retries and coping strategies.

{
  "primary": "moonshot/kimi-k2.6",
  "fallbacks": [
    "google/gemini-3.1-pro-preview",
    "google/gemini-flash-latest",
    "google/gemini-flash-lite-latest",
    "openai/gpt-5.3-codex"
  ]
}
openclaw@microserver:~$ openclaw config get models.providers.moonshot

🦞 OpenClaw 2026.5.19 (a185ca2) — Greetings, Professor Falken

Config path not found: models.providers.moonshot. Run openclaw config validate to inspect config shape.

Impact and severity

No response

Additional information

No response

Activity

  1. clawsweeper commented on May 21, 2026

    @clawsweeper
    Contributor

    Codex review: keeping this open for maintainer follow-up; there is still a little grit to resolve. Reviewed June 30, 2026, 10:00 PM ET / 02:00 UTC.

    Summary
    Keep this open: current main still leaves native OpenClaw provider runs on the broad discovery path after the lean dynamic pass misses, while the merged static-catalog fix only covers plugin-harness transport. The issue has concrete reporter logs, a second native-provider reproduction, and the direct native fast-path PRs are closed unmerged.

    Reproducibility: yes. at source level: current main still sends native providers through broad discovery after the lean dynamic pass misses. No live Moonshot or Google Discord/TUI repro was run in this read-only review.

    Next step
    Prior fix attempts show the code shape is clear, but provider precedence and live dispatch proof require maintainer review before another autonomous fix PR.

    Review details

    Best possible solution:

    Land a maintainer-approved provider-agnostic native-provider fast path that avoids broad discovery for exact static-catalog model refs without bypassing provider-owned auth/runtime metadata, with redacted before/after dispatch timing proof.

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

    Yes at source level: current main still sends native providers through broad discovery after the lean dynamic pass misses. No live Moonshot or Google Discord/TUI repro was run in this read-only review.

    Is this the best way to solve the issue?

    Unclear as an implementation: a provider-agnostic fast path is needed, but prior repair review showed static-catalog precedence can change provider/auth routing unless maintainers accept or gate it.

    AGENTS.md: found and applied where relevant.

    Remaining risk / open question:

    • No live Moonshot or Google Discord/TUI repro was run in this read-only review; the current-main reproduction is source-backed and supported by reporter logs.
    • The unresolved design risk is provider precedence: a static-catalog fast path must not bypass provider dynamic hooks that own auth, transport, or runtime metadata unless maintainers explicitly accept or gate that behavior.

    Codex review notes: model internal, reasoning high; reviewed against d9aedc32a131.

    Label changes

    Label changes:

    • remove clawsweeper:fix-shape-clear: Current issue advisory state no longer selects this label.

    Label justifications:

    • P1: The issue reports real first-turn native-provider dispatch delays of 10-75 seconds before the model starts.
    • impact:auth-provider: The affected surface is provider/model resolution and routing before embedded agent dispatch.
    Evidence reviewed

    Acceptance criteria:

    • node scripts/run-vitest.mjs src/agents/embedded-agent-runner/model.test.ts src/agents/embedded-agent-runner.e2e.test.ts
    • Add or run a focused regression proving native Moonshot/Google skip-discovery resolution avoids ensureOpenClawModelsJson for exact bundled static-catalog models when the safe fast path applies.
    • Collect redacted before/after Discord or TUI embedded-run startup-stages logs showing model-resolution latency improves without inline models.providers metadata.

    What I checked:

    • AGENTS policy applied: Root AGENTS.md was read fully; its hot-path guidance says provider/model/channel facts should be carried forward instead of rediscovered through broad loaders. (AGENTS.md:99, 7ceaf0ece350)
    • Current main native fast path still gates static catalog fallback to plugin harnesses: On origin/main d9aedc3, runEmbeddedAgent calls resolveModelAsync with skipAgentDiscovery, but allowBundledStaticCatalogFallback and preferBundledStaticCatalogTransport are set from pluginHarnessOwnsTransport; native providers still miss that lean static-catalog path. (src/agents/embedded-agent-runner/run.ts:1091, d9aedc32a131)
    • Current resolver only uses bundled static catalogs when explicitly opted in: resolveModelAsync returns no static-catalog model unless allowBundledStaticCatalogFallback is true, and the current ordering runs the dynamic attempt before the opt-in static fallback. (src/agents/embedded-agent-runner/model.ts:1718, d9aedc32a131)
    • Focused tests show the missing capability exists but remains opt-in: Current tests prove Google static catalog rows resolve while skipping agent discovery when the caller opts in, and also prove static catalog rows are not used without that opt-in. (src/agents/embedded-agent-runner/model.test.ts:585, d9aedc32a131)
    • Merged sibling fix is plugin-harness-only: The e2e regression on current main asserts the static-catalog one-pass behavior only for agentHarnessId codex, with allowBundledStaticCatalogFallback true and ensureOpenClawModelsJson not called. (src/agents/embedded-agent-runner.e2e.test.ts:705, d9aedc32a131)
    • Latest release still lacks the native fallback opt-in: v2026.6.11 has the same first-pass gate tied to pluginHarnessOwnsTransport and then calls ensureOpenClawModelsJson for the native path, so this is not fixed in the latest shipped release. (src/agents/embedded-agent-runner/run.ts:1088, e085fa1a3ffd)

    Likely related people:

    • vincentkoc: Current-main blame for the model-resolution gate and resolver fallback code points to the recent commit that carries these embedded-runner files on origin/main; live search also shows adjacent provider discovery work by the same author. (role: recent area contributor; confidence: medium; commits: 4355e719b87e; files: src/agents/embedded-agent-runner/run.ts, src/agents/embedded-agent-runner/model.ts)
    • yetval: Authored the merged plugin-harness static-catalog cold-start fix that created the adjacent, currently-working harness-only path and explicitly left the OpenClaw-native path unchanged. (role: sibling fast-path fix author; confidence: medium; commits: be2909608157; files: src/agents/embedded-agent-runner/run.ts, src/agents/embedded-agent-runner/model.ts, src/agents/embedded-agent-runner.e2e.test.ts)
    • mcaxtr: Authored the open prepared-runtime migration tracker and the current PR 2 startup metadata slice that overlaps this issue's broad-discovery root cause. (role: broader migration owner; confidence: medium; commits: c09ff42c55e9; files: src/plugins/active-runtime-registry.ts, src/plugins/provider-hook-runtime.ts, src/agents/runtime-plugins.test.ts)
    • wyf027: Opened the closed unmerged Moonshot-specific and generic native static-catalog PRs for this issue, so they have relevant implementation context even though those branches are not landing candidates. (role: prior direct repair contributor; confidence: medium; commits: 2c0efefa5257, c844e7f939bc; files: src/agents/embedded-agent-runner/run.ts, src/agents/embedded-agent-runner/model.ts, extensions/moonshot/index.ts)
    • steipete: Posted the land-ready proof for the merged plugin-harness static-catalog fix and checked Codex/upstream routing details relevant to the same resolver boundary. (role: sibling fix reviewer and land-ready reviewer; confidence: medium; commits: be2909608157; files: src/agents/embedded-agent-runner/run.ts, src/agents/embedded-agent-runner/model.ts, extensions/codex/src/app-server/thread-lifecycle.ts)
    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.
    • Maintainer-only repair and merge flows require explicit commands such as @clawsweeper autofix, @clawsweeper automerge, @clawsweeper fix ci, or @clawsweeper address review.
    • Maintainers can comment @clawsweeper explain to ask for more context, or @clawsweeper stop to stop active automation.
  2. resYuto commented on May 21, 2026

    @resYuto
    Author

    In TUI mode, same issue appeared. So I think it happen in not just Discord.

    when new session started, log said took 5secs, but actually I waited ~30secs.

    04:08:14+00:00 warn agent/embedded {"subsystem":"agent/embedded"} [trace:embedded-run] startup stages: runId=638f2b7d-484e-4a3b-95d5-89f60a8af957 sessionId=3b0ebb13-978c-40a8-b68d-e79fcb2d62a1 phase=attempt-dispatch totalMs=5716 stages=workspace:1ms@1ms,runtime-plugins:17ms@18ms,hooks:0ms@18ms,model-resolution:5284ms@5302ms,auth:412ms@5714ms,context-engine:1ms@5715ms,attempt-workspace:0ms@5715ms,attempt-prompt:0ms@5715ms,attempt-runtime-plan:1ms@5716ms,attempt-dispatch:0ms@5716ms
    
    04:10:11+00:00 warn agent/embedded {"subsystem":"agent/embedded"} [trace:embedded-run] startup stages: runId=4cc60801-1e97-471b-9d36-9b08579ff94e sessionId=3b0ebb13-978c-40a8-b68d-e79fcb2d62a1 phase=attempt-dispatch totalMs=34029 stages=workspace:0ms@0ms,runtime-plugins:17ms@17ms,hooks:0ms@17ms,model-resolution:34002ms@34019ms,auth:2ms@34021ms,context-engine:0ms@34021ms,attempt-workspace:6ms@34027ms,attempt-prompt:0ms@34027ms,attempt-runtime-plan:2ms@34029ms,attempt-dispatch:0ms@34029ms
    
    04:16:13+00:00 warn agent/embedded {"subsystem":"agent/embedded"} [trace:embedded-run] startup stages: runId=00f1fbd4-40ab-4783-a4cc-9e54bd0c32f8 sessionId=3b0ebb13-978c-40a8-b68d-e79fcb2d62a1 phase=attempt-dispatch totalMs=34764 stages=workspace:0ms@0ms,runtime-plugins:16ms@16ms,hooks:0ms@16ms,model-resolution:34744ms@34760ms,auth:2ms@34762ms,context-engine:0ms@34762ms,attempt-workspace:1ms@34763ms,attempt-prompt:0ms@34763ms,attempt-runtime-plan:1ms@34764ms,attempt-dispatch:0ms@34764ms
    
  3. resYuto commented on May 21, 2026

    @resYuto
    Author

    Workaround found

    I investigated this with Codex and found the root cause in the model-resolution path.

    What's happening

    The PI runner first tries skipPiDiscovery: true with the plugin's dynamic model hook (resolveDynamicModel). The Moonshot plugin doesn't implement this hook, so it fails. Then it falls back to ensureOpenClawModelsJson() → ModelRegistry.find() using agentDir/models.json, which is slow and causes the 10–30s delay.

    How I fixed it

    I rewrote my OpenClaw config to include explicit model data with api and baseUrl via openclaw config. This allows the model to resolve as an inline model during skipPiDiscovery, skipping the slow fallback entirely.

    Before (slow fallback path)

    // no resolution data

    After (fast inline resolution)

    "models": {
      "mode": "merge",
      "providers": {
        "moonshot": {
          "baseUrl": "https://api.moonshot.ai/v1",
          "api": "openai-completions",
          "models": [
            {
              "id": "kimi-k2.6",
              "name": "Kimi K2.6",
              "reasoning": false,
              "input": ["text", "image"],
              "cost": {
                "input": 0.95,
                "output": 4,
                "cacheRead": 0.16,
                "cacheWrite": 0
              },
              "contextWindow": 262144,
              "maxTokens": 262144
            }
          ]
        }
      }
    }

    Response time dropped from ~30s to under 2s.

    Suggested fix

    Implement resolveDynamicModel in the Moonshot plugin so native provider users don't need this workaround. Alternatively, shorten the fallback timeout or warn when a provider lacks dynamic resolution.

  4. added
    P1High-priority user-facing bug, regression, or broken workflow.
    impact:auth-providerAuth, provider routing, model choice, or SecretRef resolution may break.
    issue-rating: 🐚 platinum hermitGood issue quality with a plausible reproduction path needing some confirmation.
    clawsweeper:needs-live-reproClawSweeper needs live local, crabbox, or manual validation to confirm this issue.
    clawsweeper:linked-pr-openClawSweeper found an open linked pull request for this issue.
    clawsweeper:no-new-fix-prClawSweeper does not recommend queueing a new automated fix PR for this issue.
    clawsweeper:needs-maintainer-reviewClawSweeper marked this issue as needing maintainer review before automation.
    clawsweeper:needs-product-decisionClawSweeper marked this issue as needing a product or behavior decision.
    clawsweeper:fix-shape-clearClawSweeper found a clear likely implementation shape for this issue.
    and removed
    clawsweeper:linked-pr-openClawSweeper found an open linked pull request for this issue.
    on Jun 15, 2026
  5. gedefet commented on Jun 22, 2026

    @gedefet

    Reproduces with a second native provider (Google / Gemini), not just Moonshot — and on Windows the broad-discovery path is dramatically slower. Adding a CPU profile that pinpoints what broad discovery actually spends the time on, in case it's useful for shaping the fast-path fix.

    Environment

    • OpenClaw 2026.6.9 (also measured 2026.6.8)
    • Node v22.19.0, Windows 10.0.26200 x64, 12 cores
    • Native Google provider (plugins.entries.google.enabled = true), primary google/gemini-2.5-flash. models entries are empty ({}), i.e. no explicit models.providers.google metadata — same precondition as the Moonshot workaround.

    Symptom (embedded-run startup stages trace)

    model-resolution dominates every cold start, silently:

    version model-resolution runtime-plugins actual generation
    2026.6.8 ~70–80s (5 runs: 69/70.5/75/80/80) ~12s ~2s
    2026.6.9 ~37–43s ~7s ~2s

    Warm turns in the same session are ~6–8s. So this is purely the first-turn resolution cost, matching this issue.

    What broad discovery is actually doing (CPU profile)

    Captured with node --cpu-prof over one cold start (model-resolution = 48.9s that run). Top self-time:

    43.3s  lstat
    17.9s  existsSync
     5.0s  stat
     4.4s  internalModuleStat
     4.0s  get exports        node:internal/modules/package_json_reader
     3.5s  open
     2.4s  getPackageScopeConfig
     1.4s  realpathSync
     ...   installOpenClawPluginSdkNativeResolver  (dist/plugin-module-loader-cache-*.js)
     ...   resolveLoaderPackageRootFromModulePath  (dist/plugin-module-loader-cache-*.js)
    

    It's almost entirely ESM module-loader filesystem stat thrashing while loading the provider plugins during broad discovery — not network, not auth. Confirmed by isolation:

    • 0 remote network connections during the model-resolution window (per-PID capture); the only :443 connection appears at generation time at the very end.
    • No external CLI / subprocess spawned (full descendant process-tree capture — just the node process).

    Why it's so much worse here (Windows)

    The openclaw install is 31,209 files; stat throughput on this machine is ~0.27ms/file cold, ~0.12ms/file warm (vs ~0.01ms on a fast SSD without real-time AV). Broad discovery re-stats candidate paths hundreds of thousands of times → tens of seconds. Windows Defender real-time protection (on) amplifies every lstat/open. So the same broad-discovery path that costs ~33s for the reporter is 40–75s on Windows.

    Takeaways

    1. The native-provider → broad-discovery gate described in this issue reproduces beyond Moonshot (here: Google), reinforcing that the fix should be provider-agnostic rather than a Moonshot-owned resolver.
    2. Independent of the gate, broad discovery itself is pathologically fs-stat-heavy (the plugin-module-loader-cache appears to re-resolve/re-stat the plugin tree on every cold start). Even when discovery is unavoidable, caching those module resolutions across cold starts would help a lot, especially on Windows. Happy to open that as a separate perf issue if you'd prefer to keep this one scoped to the fast-path gate.

    I can share the raw .cpuprofile or run before/after timings against a proposed fast-path PR.

  6. openclaw-barnacle commented on Jul 15, 2026

    @openclaw-barnacle

    This issue has been automatically marked as stale due to inactivity.
    Please add updates or it will be closed.

  7. openclaw-barnacle commented on Jul 22, 2026

    @openclaw-barnacle

    Closing due to inactivity.
    If this is still an issue, please retry on the latest OpenClaw release and share updated details.
    If you are absolutely sure it still happens on the latest release, open a new issue with fresh steps to reproduce.

  8. locked as resolved and limited conversation to collaborators on Sep 18, 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

    P1High-priority user-facing bug, regression, or broken workflow.bugSomething isn't workingbug:behaviorIncorrect behavior without a crashclawsweeper:needs-live-reproClawSweeper needs live local, crabbox, or manual validation to confirm this issue.clawsweeper:needs-maintainer-reviewClawSweeper marked this issue as needing maintainer review before automation.clawsweeper:needs-product-decisionClawSweeper marked this issue as needing a product or behavior decision.clawsweeper:no-new-fix-prClawSweeper does not recommend queueing a new automated fix PR for this issue.impact:auth-providerAuth, provider routing, model choice, or SecretRef resolution may break.issue-rating: 🐚 platinum hermitGood issue quality with a plausible reproduction path needing some confirmation.staleMarked as stale due to inactivity

    Type

    No type

    Fields

    Priority

    None yet

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions