Skip to content

fix: stabilize OpenClaw CLI insight context#50

Draft
akaDRJ wants to merge 1 commit intoTianyiDataScience:mainfrom
akaDRJ:fix/openclaw-cli-context
Draft

fix: stabilize OpenClaw CLI insight context#50
akaDRJ wants to merge 1 commit intoTianyiDataScience:mainfrom
akaDRJ:fix/openclaw-cli-context

Conversation

@akaDRJ
Copy link
Copy Markdown

@akaDRJ akaDRJ commented Mar 20, 2026

Summary

This fixes a false-negative connection-health path in the control center when invoking openclaw CLI commands from the dashboard runtime.

What changed

  • run OpenClaw CLI calls from the OpenClaw workspace root instead of the repo cwd
  • strip npm_* / INIT_CWD pollution from child-process env before invoking openclaw
  • avoid injecting OPENCLAW_* overrides that can break plugin/config resolution on real installs
  • raise CLI insight timeouts to better match slower local runtimes
  • make expired insight caches await a fresh value instead of immediately serving stale blocked state
  • add regression tests for workspace-root resolution and CLI env sanitization

Why

On a real OpenClaw installation, the Settings → Connection health card could incorrectly show:

  • Gateway is not reachable
  • openclaw.json is missing or invalid
  • Runtime status is still loading

…even though the local OpenClaw runtime was healthy.

The root causes were a mix of:

  • invoking openclaw from the wrong cwd
  • inheriting npm runner env pollution
  • stale cache behavior returning outdated blocked summaries on the first refresh after expiry
  • timeout budgets that were too aggressive for slower local CLI responses

Validation

  • npm test106/106 pass
  • verified Settings → Connection health renders healthy Gateway / Config / Runtime on a real local install
  • verified LAN-access local config separately (UI_BIND_ADDRESS=0.0.0.0) without including that local-only change in this PR

@TianyiDataScience
Copy link
Copy Markdown
Owner

谢谢你先把这条 draft 放出来,方向我认同。

我这边先记下来了,不过因为它现在还是 draft,我就先不急着动 merge。等你基于最新 main rebase 完、切成 ready for review 之后,我再按最新主干一起看。

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants