docs(advisor): stable install + restart script replaces /tmp nohup runbook

The advisor now installs to ~/bin/xce-advisor (survives /tmp cleanup and
reboots) and is managed by ~/bin/advisor-restart.sh: --check (status +
last log line), --stop, bare start (reads /tmp/advisor_apikey_v2, warns
if the apiserver is unreachable, self-checks liveness ~10s after launch,
refuses to double-start). Handbook pre-flight step 3, the pitfall table
row, and the design doc deployment line now reference the script instead
of a hand-rolled env nohup command.

Co-Authored-By: Claude Code <noreply@anthropic.com>
This commit is contained in:
lei.chen 2026-10-20 02:26:17 +00:00
parent 42804166d8
commit 2808742288
2 changed files with 9 additions and 13 deletions

View file

@ -19,8 +19,7 @@ curl -s -H "Authorization: Bearer $KEY" http://172.31.1.30:8080/xce/v1/hosts \
# 期望:t1 OK / t2 OK / t3 OK
# 3. advisor 存活且在扫描(60s 一轮)
ps aux | grep [x]ce-advisor | wc -l # ≥1
tail -2 /opt/xce/logs/advisor.log # 期望 "scan clean (0 pend, 0 run, 3 nodes)"
~/bin/advisor-restart.sh --check # 期望 RUNNING + "scan clean" 尾行
# 4. LLM 路由可用(用例 2 需要;不通则 advisor 自动降级 echo,演示仍可做但亮点变少)
curl -s -m 10 http://127.0.0.1:6789/v1/models -H "Authorization: Bearer sk-litellm-router" | head -c 120
@ -29,17 +28,12 @@ curl -s -m 10 http://127.0.0.1:6789/v1/models -H "Authorization: Bearer sk-litel
curl -s -H "Authorization: Bearer $KEY" "http://172.31.1.30:8080/xce/v1/jobs?limit=1" | head -c 80
```
advisor 启动命令(若未运行):
advisor 管理命令(`~/bin/advisor-restart.sh`,二进制在 `~/bin/xce-advisor`):
```bash
env XCE_API_URL=http://172.31.1.30:8080 \
XCE_API_KEY=$(cat /tmp/advisor_apikey_v2) \
ADVISOR_LLM_BASE_URL=http://127.0.0.1:6789/v1 \
ADVISOR_LLM_API_KEY=sk-litellm-router \
ADVISOR_LLM_MODEL=glm-5-3-flash \
ADVISOR_INTERVAL=60s \
ADVISOR_LOG=/opt/xce/logs/advisor-decisions.jsonl \
nohup setsid /tmp/xce-advisor-new run >> /opt/xce/logs/advisor.log 2>&1 &
~/bin/advisor-restart.sh --check # 状态 + 最新日志一行
~/bin/advisor-restart.sh --stop # 停止
~/bin/advisor-restart.sh # 启动(读 /tmp/advisor_apikey_v2,起 5 秒后自检活性)
```
---
@ -171,7 +165,7 @@ EOF
| glm 路由超时(偶发) | 用例 2 降级为 echo(degraded=true) | 顺势讲兜底设计;或演示前 `curl /v1/models` 预检 |
| SSE 监听用 `curl -m 180` 会在 5min 阈值前断 | 以为推送没到 | 监听窗口用 `-m 600` 以上,或用 MCP 工具事后查 |
| stall 阈值 5 分钟 | 用例 1 有 5-6 分钟干等 | 先讲架构图/MCP 工具填这段时间;或把演示作业提前 5 分钟提交 |
| advisor 进程死了 | 一切不输出 | 用前置检查第 3 步确认;重启命令见上 |
| advisor 进程死了 | 一切不输出 | `~/bin/advisor-restart.sh --check` 确认;`~/bin/advisor-restart.sh` 一键拉起(自检活性) |
## 演示后清场清单

View file

@ -40,7 +40,9 @@
- 代码位置:`src/frontend/advisor/`,独立 Go module(`replace schedulerclient`),
`CGO_ENABLED=0`,不进 meson(与 mcp-server 一致,`go build` 直出)。
- 部署:t1 上以 `XCE_API_KEY`(advisor_agent 角色)运行 `advisor run`。
- 部署:t1 上以 `XCE_API_KEY`(advisor_agent 角色)运行 `advisor run`;
二进制安装于 `~/bin/xce-advisor`,用 `~/bin/advisor-restart.sh`
(check/stop/start + 活性自检)管理。
- 出口(P1):决策日志是存档底账;push 是尽力而为的广播(失败只记日志,
永不影响观察循环),目标 = 同一 apiserver 的
`POST /xce/v1/advisor/findings`(`advisor:report` 权限),服务端原样