Skip to content

openclaw config commands cause gateway to hang at 98% CPU #85002

Closed as not planned

Description

@wuleiyuan

Bug Description

Any openclaw config CLI command causes the gateway process to hang at ~98% CPU, blocking all operations. This affects both cold-start and when running the command during normal operation.

Steps to Reproduce

  1. Run any openclaw config command, e.g.:
    • openclaw config list
    • openclaw config
    • openclaw gateway status
  2. Observe gateway process jumps to 98% CPU and stays there
  3. All OpenClaw operations are blocked

Expected Behavior

The CLI command should return results within seconds, gateway should remain responsive.

Actual Behavior

Gateway hangs at "loading configuration..." phase at 98% CPU. The hang is observed in logs:

{\"subsystem\":\"gateway\"}{\"1\":\"loading configuration…\"}

Environment

  • OpenClaw: 2026.5.19 (a185ca2)
  • Node.js: 25.3.0
  • Platform: macOS (darwin ARM64)
  • Gateway port: 18080

Workaround

Edit ~/.openclaw/openclaw.json directly instead of using openclaw config CLI commands.

Additional Context

Gateway cold boot also shows ~60s of high CPU at "loading configuration…" — may be related root cause.

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, 7:29 PM ET / 23:29 UTC.

    Summary
    Keep open: current main still routes the reported config and gateway-status surfaces through configuration snapshot, validation, and plugin metadata paths, and I did not find a merged canonical fix or current-main proof that the high-CPU hang is gone.

    Reproducibility: no. The report gives clear 2026.5.19 macOS steps and a matching loading configuration… log phase, but this review did not establish the high-CPU hang on current main.

    Ways to help us reproduce this

    • Add a screenshot or short recording showing the behavior.
    • Add expected vs actual behavior.

    Next step
    Needs maintainer or live-lab profiling before repair because the source path is clear but the exact high-CPU loop is not proven.

    Review details

    Best possible solution:

    Profile the reported commands on current main or the latest package in a matching macOS setup, then patch the measured config snapshot, plugin metadata, or gateway-status hotspot without weakening config validation.

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

    No. The report gives clear 2026.5.19 macOS steps and a matching loading configuration… log phase, but this review did not establish the high-CPU hang on current main.

    Is this the best way to solve the issue?

    Unclear. There is no patch yet, and the safest fix should follow a live profile rather than guessing between config IO, plugin metadata scanning, shell env fallback, or macOS service context.

    AGENTS.md: found and applied where relevant.

    Remaining risk / open question:

    • No current-main macOS/Node 25 live reproduction or CPU profile is attached, so the exact high-CPU loop remains unproven.
    • Recent adjacent performance and config fixes may reduce related startup cost, but the inspected source still leaves the reported config/status paths active and does not prove this symptom fixed.

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

    Label changes

    Label changes:

    • add maturity:stable: The affected Gateway runtime and CLI surfaces are M4 Stable in qa/maturity-scores.yaml.
    • add issue-rating: 🦪 silver shellfish: Current issue advisory state selects this label.
    • add clawsweeper:needs-info: Current issue advisory state selects this label.
    • remove clawsweeper:needs-live-repro: Current issue advisory state no longer selects this label.
    • remove issue-rating: 🐚 platinum hermit: Current issue advisory state no longer selects this label.

    Label justifications:

    • P1: The report describes a gateway/config workflow that can saturate CPU and block all OpenClaw operations.
    • impact:crash-loop: The issue is about gateway process availability: a hang or sustained CPU saturation during configuration loading.
    • maturity:stable: The affected Gateway runtime and CLI surfaces are M4 Stable in qa/maturity-scores.yaml.
    Evidence reviewed

    Acceptance criteria:

    • Profile openclaw config get gateway.port, openclaw config validate, and openclaw gateway status on current main or the latest package in a matching macOS setup.
    • After a root cause is identified, run focused tests for src/cli/config-cli.test.ts, src/cli/daemon-cli/status.gather.test.ts, src/gateway/server-startup-config.recovery.test.ts, and plugin metadata snapshot coverage as applicable.

    What I checked:

    • Live issue state: Live GitHub still shows this issue open with P1, needs-live-repro, needs-maintainer-review, no-new-fix-pr, and impact:crash-loop labels; no closing PR is linked in the hydrated discussion.
    • Repository policy applied: Root policy requires source, tests/current behavior proof for fix/triage answers and treats config loading/startup behavior as compatibility-sensitive review surface. (AGENTS.md:12, 3811001d2783)
    • Gateway scoped policy applied: Gateway scoped policy calls startup and gateway paths hot paths and warns against broad plugin/runtime materialization when static descriptors are enough. (src/gateway/AGENTS.md:1, 3811001d2783)
    • Config CLI still reads snapshots: config get calls loadValidConfig, while config validate calls readConfigFileSnapshot, so the reported CLI commands still exercise config snapshot IO on current main. (src/cli/config-cli.ts:2429, 3811001d2783)
    • Config validation still uses plugin metadata: Config snapshot reads build a validation plugin metadata loader and pass it into validateConfigObjectWithPlugins, keeping the suspected plugin metadata/config validation path relevant. (src/config/io.ts:1987, 3811001d2783)
    • Gateway startup still matches reported log phase: Gateway startup logs loading configuration… immediately before readGatewayStartupConfigWithShellEnv, matching the phase named in the report. (src/cli/gateway-cli/run.ts:642, 3811001d2783)

    Likely related people:

    • vincentkoc: Recent commits touched config IO validation metadata loading and plugin metadata snapshot internals central to the suspected path. (role: recent config and plugin metadata contributor; confidence: high; commits: 523e98a47a24, cba9c0209536, 6daabd23f821; files: src/config/io.ts, src/plugins/plugin-metadata-snapshot.ts)
    • openperf: Recent gateway startup/config selection work touched the startup configuration path that runs after the reported loading configuration… log. (role: recent gateway startup contributor; confidence: medium; commits: df521a645977; files: src/cli/gateway-cli/run.ts, src/config/io.ts)
    • obuchowski: Authored the recent plugin metadata rescan-storm fix for repeated full manifest scans, adjacent to the config validation metadata path. (role: adjacent plugin metadata performance contributor; confidence: medium; commits: 16ea3f272fe5; files: src/plugins/plugin-metadata-snapshot.ts, src/plugins/plugin-metadata-snapshot.memo.test.ts)
    • steipete: Recent work touched suspicious gateway startup config recovery, plugin install index persistence, and daemon status docs/paths adjacent to this issue. (role: recent gateway/config recovery contributor; confidence: medium; commits: c8d21fe7f05b, 5443baa8527e, 8946648ace20; files: src/cli/gateway-cli/run.ts, src/config/io.ts, src/cli/daemon-cli/status.gather.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. added
    P1High-priority user-facing bug, regression, or broken workflow.
    impact:crash-loopCrash, hang, restart loop, or process-level availability failure.
    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: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.
    on May 21, 2026
  3. JulyanXu commented on May 22, 2026

    @JulyanXu
    Contributor

    High-impact issue — gateway CPU saturation from config commands blocks all operations.

    Observation: The hang occurs at "loading configuration…" with 98% CPU, which points to a tight loop or infinite recursion in the config loading path, not a blocking I/O wait.

    Possible root causes:

    1. Circular config reference — If the config file contains a circular reference (e.g., an extends or $ref that loops back), the loader could spin. The 60s cold-boot delay is also consistent with this — the loader eventually times out or resolves the cycle.

    2. Large config file parsing — If openclaw.json has grown very large (many agents, cron jobs, channel bindings), the JSON parsing + schema validation could be CPU-intensive. But 98% sustained CPU suggests something worse than just large-file parsing.

    3. Hot-reload loop — If the gateway watches the config file and the config CLI command triggers a file change that causes a reload that triggers another change, this would create an infinite reload loop.

    Diagnosis steps for the reporter:

    # Check config file size
    wc -c ~/.openclaw/openclaw.json
    
    # Check for duplicate/circular extends
    jq '.extends // [] | length' ~/.openclaw/openclaw.json
    
    # Profile the gateway during the hang
    node --prof $(which openclaw) config list
    # Then analyze with node --prof-process isolate-*.log

    If the config file is very large (>1MB), the issue may be schema validation overhead. If it contains circular references, the loader needs cycle detection.

    The workaround of editing the file directly confirms the config loading/parsing path is the bottleneck, not the actual config values.

  4. added
    maturity:stableBroken existing behavior primarily owned by an M4/M5 scorecard surface.
    issue-rating: 🦪 silver shellfishThin issue quality; more reproduction proof or environment detail is needed.
    clawsweeper:needs-infoClawSweeper needs more reporter information before it can verify this issue.
    and removed
    clawsweeper:needs-live-reproClawSweeper needs live local, crabbox, or manual validation to confirm this issue.
    issue-rating: 🐚 platinum hermitGood issue quality with a plausible reproduction path needing some confirmation.
    on Jun 30, 2026
  5. 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.

  6. 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.

  7. 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.clawsweeper:needs-infoClawSweeper needs more reporter information before it can verify this issue.clawsweeper:needs-maintainer-reviewClawSweeper marked this issue as needing maintainer review before automation.clawsweeper:no-new-fix-prClawSweeper does not recommend queueing a new automated fix PR for this issue.impact:crash-loopCrash, hang, restart loop, or process-level availability failure.issue-rating: 🦪 silver shellfishThin issue quality; more reproduction proof or environment detail is needed.maturity:stableBroken existing behavior primarily owned by an M4/M5 scorecard surface.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