feat(diagnose): detect and inform about @homebridge/ciao cmd popup bug (#250)

* feat(diagnose): detect and inform about @homebridge/ciao cmd popup bug

On Windows, OpenClaw's transitive dependency @homebridge/ciao (<=1.3.6)
calls child_process.exec('arp -a ...') every 15-30 seconds without
passing windowsHide:true, causing a cmd.exe popup to flash.

This is an upstream library bug:
- Issue: homebridge/ciao#64
- PR:    homebridge/ciao#65 (open, not merged)

ClawPanel deliberately chooses 'detect and inform' rather than silently
patching the user's node_modules. We respect the user's control over
their own machine.

Changes:
- src-tauri/src/commands/diagnose.rs: new check_ciao_windowshide_bug
  command; scans openclaw's @homebridge/ciao/lib/NetworkManager.js and
  reports whether the buggy exec pattern is present
- src-tauri/src/lib.rs: register the new command
- scripts/dev-api.js: Web-mode stub (returns affected:false since the
  bug does not manifest off-Windows)
- src/lib/tauri-api.js: add api.checkCiaoWindowsHideBug
- src/lib/ciao-bug-warning.js: new module with toast + modal flow,
  version-scoped dismiss (localStorage)
- src/locales/modules/ciaoBug.js: translations in 5 primary languages
- src/locales/index.js: register the ciaoBug module
- src/main.js: call checker 3s after splash hides

Non-Windows users see nothing; Windows users see a single warning toast
(version-dismissible) linking to three fix paths: wait for upstream,
apply patch-package, or edit NetworkManager.js manually.

* fix(diagnose): gate helper with cfg(windows), drop unneeded return

CI failures on Linux + macOS:
- openclaw_module_root was dead code when target_os != windows
  since the only caller is the #[cfg(target_os = "windows")] block
  inside check_ciao_windowshide_bug
- Explicit `return CiaoCheckResult {...};` in the non-Windows branch
  triggered clippy::needless_return

Fix:
- Add #[cfg(target_os = "windows")] to openclaw_module_root so it
  is not compiled on other platforms
- Convert the non-Windows early exit to a tail expression
This commit is contained in:
晴天
2026-04-24 19:36:20 +08:00
committed by GitHub
parent da5adc5843
commit 11cd6218dc
8 changed files with 439 additions and 1 deletions

View File

@@ -4722,6 +4722,29 @@ const handlers = {
})
},
// @homebridge/ciao windowsHide bug — Windows only. Linux/macOS stubs return false.
// See https://github.com/homebridge/ciao/issues/64 and PR #65.
check_ciao_windowshide_bug() {
const platform = process.platform
if (platform !== 'win32') {
return {
affected: false,
platform,
version: null,
networkManagerPath: null,
detail: 'Non-Windows platform — bug does not manifest here.',
}
}
// Web 模式极少跑在 Windows 上,这里提供最小桩实现保持接口一致
return {
affected: false,
platform,
version: null,
networkManagerPath: null,
detail: 'Ciao bug detection is only performed in the Tauri desktop build.',
}
},
async diagnose_gateway_connection() {
const steps = []
const ocDir = openclawDir()