Skip to content

fix: show correct guidance when openclaw is not installed locally#47

Merged
Keith-CY merged 1 commit intodevelopfrom
fix/local-openclaw-not-installed-guidance
Mar 3, 2026
Merged

fix: show correct guidance when openclaw is not installed locally#47
Keith-CY merged 1 commit intodevelopfrom
fix/local-openclaw-not-installed-guidance

Conversation

@dev01lay2
Copy link
Copy Markdown
Collaborator

Summary

Fixes #46 — 当本地未安装 OpenClaw CLI 时,「小龙虾建议」错误地显示 REGISTRY_CORRUPT 诊断。

Root Cause

explain_operation_error() 对 local transport 的 "openclaw binary missing" 错误没有 fast path。错误被送到 zeroclaw LLM 做诊断,但 zeroclaw 本身也依赖 openclaw 二进制,导致产生错误的诊断(hallucinated REGISTRY_CORRUPT)。

Changes

src-tauri/src/agent_fallback.rs

  • explain_operation_error() 中为 local transport + openclaw missing 添加 fast path,跳过 LLM 调用
  • 新增 local_openclaw_not_installed_guidance() 函数,返回正确的引导信息:
    • 提示「本机未安装 OpenClaw CLI」
    • 建议安装(附文档链接)或直接使用 SSH 远程实例
  • 添加单元测试

src/lib/guidance.ts

  • isAlreadyExplainedGuidanceError() 中识别新的引导消息,防止重复弹窗

Before / After

Before: 小龙虾建议显示 "REGISTRY_CORRUPT: ~/.openclaw/openclaw.json contains JSON5 syntax error"(错误且不可操作)

After: 小龙虾建议显示 "本机未安装 OpenClaw CLI",提供安装文档链接和远程实例替代方案(正确且可操作)

When openclaw CLI is not installed on the local machine, the guidance
system (小龙虾建议) was sending the error to zeroclaw for diagnosis.
Since zeroclaw itself requires the openclaw binary, it would either
fail silently or hallucinate a wrong diagnosis (e.g. REGISTRY_CORRUPT
about ~/.openclaw/openclaw.json).

Fix: detect 'openclaw binary missing' errors for local transport early
in explain_operation_error() and return deterministic guidance that
correctly tells the user openclaw is not installed, with actionable
steps (install docs link, or skip local and use SSH remote instead).

Changes:
- agent_fallback.rs: add fast-path in explain_operation_error for local
  transport + openclaw missing; add local_openclaw_not_installed_guidance
  function with clear install/remote-alternative guidance
- guidance.ts: recognize the new guidance message in
  isAlreadyExplainedGuidanceError to prevent double-reporting

Closes #46
Copy link
Copy Markdown

@chatgpt-codex-connector chatgpt-codex-connector bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: ae6180e93c

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

],
structured_actions: vec![GuidanceAction {
label: "查看安装文档".to_string(),
action_type: "link".to_string(),
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Use supported actionType for install-doc CTA

This guidance now emits action_type: "link", but the frontend only supports "inline_fix" | "doctor_handoff" for GuidanceAction (src/lib/types.ts:244) and GuidanceCard routes any non-inline_fix action to doctor handoff (src/components/GuidanceCard.tsx:64-77). In the local-openclaw-missing path, the button labeled “查看安装文档” will therefore open Doctor instead of the docs URL, so users still miss the intended installation guidance.

Useful? React with 👍 / 👎.

Copy link
Copy Markdown
Collaborator

@Keith-CY Keith-CY left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM — fast-path guidance for missing local OpenClaw binary is correct and avoids zeroclaw misdiagnosis. No blocking issues found. CI already passes.

@Keith-CY Keith-CY merged commit 2121eaa into develop Mar 3, 2026
3 checks passed
dev01lay2 added a commit that referenced this pull request Mar 3, 2026
Co-authored-by: dev01lay2 <dev01lay2@users.noreply.github.com>
Closes #46
@Keith-CY Keith-CY deleted the fix/local-openclaw-not-installed-guidance branch March 5, 2026 08:36
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