健康检查(CLI)
用于验证频道连接性的快速指南,无需猜测。
快速检查
- openclaw status — 本地摘要:网关可达性/模式、更新提示、已链接频道的认证有效期、会话 + 最近活动。
- openclaw status --all — 完整的本地诊断(只读、彩色、可安全粘贴用于调试)。
- openclaw status --deep — 还探测正在运行的 Gateway(支持的情况下进行每频道探测)。
- openclaw health --json — 向正在运行的 Gateway 请求完整的健康快照(仅 WS;无直接 Baileys socket)。
- 在 WhatsApp/WebChat 中发送 /status 作为独立消息,以获得状态回复而不调用 agent。
- 日志:tail /tmp/openclaw/openclaw-*.log 并过滤 web-heartbeat、web-reconnect、web-auto-reply、web-inbound。
深度诊断
- 磁盘上的凭证:ls -l ~/.openclaw/credentials/whatsapp/<accountId>/creds.json(mtime 应该是最近的)。
- 会话存储:ls -l ~/.openclaw/agents/<agentId>/sessions/sessions.json(路径可在配置中覆盖)。计数和最近的接收者通过 status 显示。
- 重新链接流程:当日志中出现状态码 409–515 或 loggedOut 时,运行 openclaw channels logout && openclaw channels login --verbose。(注意:QR 登录流程在配对后会为状态 515 自动重启一次。)
当出现故障时
- logged out 或状态 409–515 → 使用 openclaw channels logout 然后 openclaw channels login 重新链接。
- Gateway 无法访问 → 启动它:openclaw gateway --port 18789(如果端口忙碌,使用 --force)。
- 无入站消息 → 确认链接的手机在线且发送者被允许(channels.whatsapp.allowFrom);对于群组聊天,确保白名单 + 提及规则匹配(channels.whatsapp.groups、agents.list[].groupChat.mentionPatterns)。
专用的 "health" 命令
openclaw health --json 向正在运行的 Gateway 请求其健康快照(CLI 不直接使用频道 socket)。它报告可用时已链接的凭证/认证有效期、每频道探测摘要、会话存储摘要和探测持续时间。如果 Gateway 无法访问或探测失败/超时,则返回非零退出码。使用 --timeout <ms> 覆盖默认的 10s 超时。