vault: update Trading Agents with WebSocket fix, sessions_spawn solution, and final verification

This commit is contained in:
Yaojia Wang
2026-03-21 16:57:25 +01:00
parent de0a5f7fa7
commit 605ca8e16c
3 changed files with 226 additions and 45 deletions

View File

@@ -409,56 +409,122 @@ with open("/home/yiukai/.openclaw/openclaw.json", "w") as f:
---
## 八、已知问题
## 八、Gateway WebSocket 修复(关键补丁)
### 重启时的 Warning
### 问题
| Warning | 影响 | 处理 |
|---------|------|------|
| `google-antigravity-auth` 插件已移除 | 无 | 可从 config 中删除该条目 |
| Telegram groupPolicy allowlist 但无 allowFrom | Telegram 群组消息被丢弃 | 非本次范围,已记录在 [[OpenClaw 部署配置分析]] |
| Security audit: 12 critical | groupPolicy=open 风险 | 已有 guild-level channel allowlist 限制,后续可收紧 |
所有内部 RPCsessions_send/spawn、gateway call、status --deep超时原因
1. `bind: "lan"``127.0.0.1:18789` 连不通
2. v2026.3.13 的 WebSocket handshake timeout 只有 3 秒
### 辩论 Bot 的 requireMention 设置
### 修复 1Systemd 环境变量
所有 4 个新 bot 都设置了 `requireMention: true`,这意味着
- 用户在 Discord 直接说话 **不会** 触发辩论 bot
- 只有 invest-analyst 通过 `sessions_send` A2A 协议才能触发
- 这是正确的行为——辩论 bot 不应该自行响应用户消息
`~/.config/systemd/user/openclaw-gateway.service``[Service]` 中添加
```ini
Environment=OPENCLAW_GATEWAY_URL=ws://192.168.68.108:18789
Environment=OPENCLAW_ALLOW_INSECURE_PRIVATE_WS=1
```
```bash
systemctl --user daemon-reload
```
### 修复 2Patch handshake timeout
文件:`~/.nvm/versions/node/v24.13.1/lib/node_modules/openclaw/dist/gateway-cli-CuZs0RlJ.js`(和 `Ol-vpIk7.js`
```javascript
// 第 7588 行3e3 → 10e3
const DEFAULT_HANDSHAKE_TIMEOUT_MS = 10e3;
```
### 修复 3Patch scope grant
同一文件,第 22605 行:
```javascript
// 原始
if (!device && (!isControlUi || decision.kind !== "allow")) clearUnboundScopes();
// 改为
if (!device && (!isControlUi || decision.kind !== "allow")) { clearUnboundScopes(); } else if (!device && decision.kind === "allow") { scopes = ["operator.read"]; connectParams.scopes = scopes; }
```
> 来源:[PR #47388](https://github.com/openclaw/openclaw/pull/47388)、[PR #48950](https://github.com/openclaw/openclaw/pull/48950)
> **注意**`npm update openclaw` 后 patch 会被覆盖,需要重新打
### 修复 4辩论 Agent Discord 配置
辩论 agent 的 Discord 已完全禁用(不在频道输出):
```json
"invest-bull": { "enabled": false, "groupPolicy": "disabled" }
```
invest-analyst 通过 `sessions_spawn`(非 sessions_send在后台调用辩论 agent。
### 修复 5subagents allowAgents
invest-analyst 需要允许 spawn 辩论 agent
```json
{
"id": "invest-analyst",
"subagents": {
"allowAgents": ["invest-bull", "invest-bear", "invest-hawk", "invest-dove"]
}
}
```
---
## 九、测试步骤
## 九、其他已知问题
### 1. 单个分析 Skill
| 问题 | 影响 | 处理 |
|------|------|------|
| Telegram groupPolicy allowlist 无 allowFrom | 群组消息被丢弃 | 非本次范围 |
| `google-antigravity-auth` 插件 | 已删除 | ✅ |
| openbb-invest-api 偶尔 503 | K8s pod 可能重启 | 检查 pod 状态 |
---
## 十、测试步骤
### 1. 快速分析
在 Stock Guild Discord 中对 invest-analyst 说:
```
/market-analysis NVDA
帮我看看 AAPL 的行情
```
期望:返回结构化技术分析报告
期望:invest-analyst 直接用 invest-api skill 回答
### 2. 辩论 Ping-Pong
### 2. 深度辩论分析
```
/trade-analyze AMZN
```
期望:
1. 收集数据curl API
2. `sessions_spawn` → invest-bullBull Case
3. `sessions_spawn` → invest-bearBear Case
4. `sessions_spawn` → invest-bullFinal Rebuttal
5. `sessions_spawn` → invest-hawk激进风控
6. `sessions_spawn` → invest-dove保守风控
7. invest-analyst 输出最终 BUY/SELL/HOLD 裁决
### 3. 验证辩论 agent 参与
在远程服务器上手动测试 A2A
```bash
openclaw agent --agent invest-analyst --message "请用 sessions_send 给 invest-bull 发送:'请基于 NVDA RSI 75, PE 45 构建看多论点'"
for a in invest-bull invest-bear invest-hawk invest-dove; do
echo "$a: $(ls ~/.openclaw/agents/$a/sessions/*.jsonl 2>/dev/null | wc -l) sessions"
done
```
期望invest-bull 回复 bull case → 自动 ping-pong 到 invest-bear。
### 3. 完整流程
在 Stock Guild Discord 中:
```
/trade-analyze AAPL
```
期望4 报告 → Bull/Bear 辩论 → Hawk/Dove 风控 → 最终 BUY/SELL/HOLD。
---
## Related
- [[Trading Agents 混合架构方案]]
- [[Trading Agents 调试与优化记录]]
- [[TradingAgents 原始架构分析]]
- [[OpenClaw 部署配置分析]]
- [[OpenClaw Stock Agent 配置详情]]