fix(dashboard): handle missing OpenClaw CLI during dispatch - #290
Merged
cft0808 merged 1 commit intoApr 19, 2026
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Issue: #289 — 自动派发异常:
[WinError 2] 系统找不到指定的文件Type: Bug Fix
Severity: Medium
This PR makes dashboard auto-dispatch handle a missing OpenClaw CLI explicitly. Instead of surfacing a raw Windows
[WinError 2]message to users, the scheduler now records an actionableopenclaw-missingstatus and explains how to fix PATH /OPENCLAW_BIN.Root Cause
dashboard/server.py::dispatch_for_state()builds the auto-dispatch command with a hardcoded executable name:On Windows, if
openclawis not on PATH, or if the npm-installed CLI is exposed through anopenclaw.cmdshim that is not resolved,subprocess.run()raisesFileNotFoundError/[WinError 2]. The old dashboard path only caught the genericException, so the task scheduler displayed a non-actionable dispatch error.This is different from OpenClaw runtime failures: the process never starts.
Fix Description
Changed files:
dashboard/server.py— add_resolve_openclaw_bin()usingOPENCLAW_BINorshutil.which('openclaw')dashboard/server.py— preflight the CLI before dispatching, recordinglastDispatchStatus = openclaw-missingif it is unavailabledashboard/server.py— add a dedicatedFileNotFoundErrorfallback for invalid configured pathstests/test_dashboard_dispatch.py— add a regression test for the missing CLI pathRationale:
shutil.which()resolves Windows npm.cmdshims more reliably than passing a bare command name directlyOPENCLAW_BINgives Windows users a direct escape hatch if their shell PATH differs from the dashboard process PATHTest Results
pytest tests/test_dashboard_dispatch.py tests/test_server.pypython -m py_compile dashboard/server.py tests/test_dashboard_dispatch.pygit diff --checkDisprove Analysis
是否已有其他地方修复
edict/backend/app/workers/dispatch_worker.pyalready catchesFileNotFoundErrorand reportsopenclaw command not found, but the stdlib dashboard server still had its own legacy auto-dispatch path without the same protection. #289 maps to the dashboard scheduler message, so that path still needed a fix.影响范围
This only affects dashboard auto-dispatch when the OpenClaw CLI cannot be resolved or launched. Successful dispatch still uses the same command shape:
边界情况
openclawis available on PATH, dispatch proceeds as before.openclaw.cmd,shutil.which('openclaw')can resolve it.OPENCLAW_BIN.OPENCLAW_BINpoints to a bad path,FileNotFoundErroris still converted toopenclaw-missing.已知局限
This does not install OpenClaw automatically. It only turns a raw
[WinError 2]into an actionable dashboard error so users can fix their CLI/PATH setup.Checklist
Found during issue triage. Happy to adjust the status wording if you prefer a different dashboard label.