前言
今天完成了一系列 OpenClaw 运维工作:
- OpenClaw 源码升级(2026.2.22 → 2026.3.8)
- GPT-5.4 模型配置
- Gateway Dashboard 访问问题解决
- network_error 问题排查
记录这些问题和解决方案,避免以后重复踩坑。
一、OpenClaw 源码升级
1.1 升级前准备
1 2 3 4 5 6 7 8
| openclaw --version
cd ~/openclaw git log -1 --oneline
|
1.2 备份配置
1 2
| cp -r ~/.openclaw ~/.openclaw/backup-20260309-122845
|
1.3 升级源码
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15
| cd ~/openclaw
git pull origin main
git stash git pull git stash pop
git stash git stash drop git pull
|
1.4 更新依赖
1 2 3
| cd ~/openclaw pnpm install
|
1.5 验证升级
1 2 3 4 5 6 7 8 9
| git log -1 --oneline
openclaw gateway restart
openclaw gateway status
|
升级结果: ✅ 成功升级到 2026.3.8
二、GPT-5.4 模型配置
2.1 检查模型可用性
1 2 3
| curl -H "Authorization: Bearer $OPENAI_API_KEY" \ https://api.openai.com/v1/models | jq '.data[].id' | grep gpt-5
|
输出:
1 2 3 4
| gpt-5.4 gpt-5.4-2026-03-05 gpt-5.4-pro gpt-5.4-pro-2026-03-05
|
2.2 配置 GPT-5.4
错误方式(禁止):
1 2 3
| jq '.model.default = "openai/gpt-5.4"' ~/.openclaw/openclaw.json
|
正确方式:
1 2
| openclaw config set agents.default.model openai/gpt-5.4
|
2.3 验证配置
1 2
| openclaw models status | grep Default
|
配置结果: ✅ GPT-5.4 配置成功
三、Gateway Dashboard 访问问题
3.1 问题现象
访问 Dashboard 时出现:
1
| origin not allowed (open the Control UI from the gateway host or allow it in gateway.controlUi.allowedOrigins)
|
3.2 问题排查
1 2
| tail -100 /tmp/openclaw/openclaw-$(date +%Y-%m-%d).log | grep "origin-mismatch"
|
关键日志:
1 2 3 4 5
| { "cause": "origin-mismatch", "origin": "https://dapalm.com", "reason": "origin not allowed" }
|
根本原因: 从 https://dapalm.com 访问 Dashboard,但白名单中没有这个域名。
3.3 解决方案
1 2 3 4 5 6
| openclaw config set gateway.controlUi.allowedOrigins \ '["http://localhost:18789", "http://127.0.0.1:18789", "http://199.168.139.88:18789", "https://dapalm.com"]'
openclaw gateway restart
|
3.4 验证修复
刷新 Dashboard 页面,访问正常 ✅
修复结果: ✅ Dashboard 访问问题解决
四、network_error 问题排查
4.1 问题现象
偶尔出现错误:
1
| Unhandled stop reason: network_error
|
4.2 问题排查
1 2
| tail -100 /tmp/openclaw/openclaw-$(date +%Y-%m-%d).log | grep -E "network_error|rate limit"
|
关键日志:
1 2
| embedded run agent end: isError=true error=⚠️ API rate limit reached. Please try again later. embedded run agent end: isError=true error=Unhandled stop reason: network_error
|
4.3 根本原因
错误链条:
1 2 3 4 5 6 7 8 9
| OpenAI API 配额耗尽 ↓ 触发 fallback 机制 ↓ 尝试使用 GLM-5 ↓ GLM API 网络不稳定 ↓ network_error
|
4.4 解决方案
方案一:保持 GPT 优先(当前方案)
GPT-5.4 作为主模型,GLM 作为 fallback。当 OpenAI 配额耗尽时,可能偶尔出现 network_error。
方案二:配置 OpenAI Codex OAuth(推荐)
使用 ChatGPT Plus 订阅替代 API 付费:
1 2
| openclaw models auth login --provider openai-codex
|
4.5 监控命令
1 2 3 4 5
| grep "rate limit" /tmp/openclaw/openclaw-*.log | tail -20
grep "network_error" /tmp/openclaw/openclaw-*.log | tail -20
|
五、经验总结
5.1 关键规则
| 规则 |
说明 |
| ⚠️ 禁止直接修改 openclaw.json |
使用 openclaw config 命令修改配置 |
| ✅ 升级前先备份 |
cp -r ~/.openclaw ~/.openclaw/backup-$(date +%Y%m%d) |
| ✅ 查看 Gateway 日志 |
tail -100 /tmp/openclaw/openclaw-$(date +%Y-%m-%d).log |
| ✅ 检查配置有效性 |
openclaw models status |
5.2 常用命令
1 2 3 4 5 6 7 8 9 10 11 12 13 14
| openclaw gateway status
openclaw gateway restart
openclaw models status
openclaw config list
tail -f /tmp/openclaw/openclaw-$(date +%Y-%m-%d).log
|
5.3 问题排查流程
1 2 3 4 5 6 7 8 9 10 11
| 问题出现 ↓ 查看网关日志(找到错误原因) ↓ 根据错误类型处理 ├─ 配置问题 → openclaw config 修改 ├─ 网络问题 → 检查网络/API状态 ├─ 权限问题 → 检查白名单配置 └─ 其他问题 → 查看文档/社区 ↓ 验证修复
|
六、后续改进
6.1 待完成
| 任务 |
时间 |
优先级 |
| 配置 OpenAI Codex OAuth |
本周 |
高 |
| 清理 feishu 插件重复 ID |
本周 |
中 |
| 安装 feishu 插件缺失依赖 |
本周 |
中 |
6.2 监控建议
建议添加以下监控:
- API rate limit 触发次数
- network_error 出现频率
- Fallback 触发率
七、参考资料
修复日期: 2026-03-09
OpenClaw 版本: 2026.3.8
Gateway 状态: ✅ 正常运行