Files
mnote/bugs/old/07-ai/done/7-1-page-ai-provider-hermes-old-run-502-v1.md
T
Agent Board b798f628ee chore: land tree view-state, vault, Pi module split, and repo hygiene
Persist PageTree expand state via control-plane view-state and align
chevron/DOM with restored expansion; keep Sidex-style shallow page-tree
scan and drop the unused recursive scanner that only added cargo noise.

Add password vault workbench routes/runtime/skill/CLI, split page_ai_pi
into a module package, and retire Hermes/ACP/OpenHub recycle + root
harness evidence from the index while gitignoring recycle and local
diag dumps.

Archive superseded design/bugs docs under old/, point architecture at
ARCHITECTURE.md, and refresh smokes for Pi S1–S7, vault, and editor
regressions so the working tree can stay clean.
2026-07-21 05:13:05 +08:00

37 lines
1.9 KiB
Markdown
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
# [recycle] 7-1 [done] 页面 AI provider=hermes 仍命中旧 run route 导致 502
## 现象
- 当前 Rust 3000 页面壳里,页面 AI 默认 provider 是 `hermes`
- 发送消息时仍请求旧 `/api/ai-agent/run`
- Rust compat route 对显式 `provider=hermes` 返回 `ai_provider_bridge_unavailable`HTTP 状态为 502。
## 复现证据
- 页面壳默认 provider`rust/crates/mnote-web/src/ssr/pages/layout.rs`
- 页面 AI 发送旧 route`fetch('/api/ai-agent/run')`
- 旧 route 注册:`rust/crates/mnote-web/src/routes/mod.rs`
- 502 来源:`rust/crates/mnote-web/src/routes/compat.rs`
- 可复跑 smoke`scripts/task-hermes-page-ai-baseline-smoke.js`
## 归类
- owner`07-ai`
- 根因:页面 AI UI 仍走旧 mnote-cli / compat 主链,而默认 provider 已切到 Hermes。
- 修复方向:页面 AI 主链改为同源 `/api/hermes/client/*`,旧 `/api/ai-agent/run` 只保留 legacy guard。
## 验收
- [x] 页面 AI 打开后创建或恢复 Hermes session。
- [x] 发送消息不再请求 `/api/ai-agent/run`
- [x] 未配置 Hermes upstream 时返回稳定 `hermes_client_unconfigured`,不再出现旧 502。
- [x] 配置 Hermes upstream 后 run/event stream 由 Hermes 返回。
## 完成证据
- 代码主链:`rust/crates/mnote-web/src/ssr/pages/layout.rs` 已改为 `/api/hermes/client/sessions``/api/hermes/client/runs``/api/hermes/client/events/{run_id}`
- 合同与路由:`rust/crates/mnote-web/src/routes/hermes_client.rs` 提供同源 Hermes client proxy。
- 测试:`cd /mnt/Data1T/mnote/rust && cargo test -p mnote-web hermes_ -- --nocapture`14 passed。
- smoke`MNOTE_UI_BASE_URL=http://127.0.0.1:3000 node scripts/task-hermes-page-ai-smoke.js` 通过,并拦截旧 `/api/ai-agent/run` 证明新页面 AI 主链未调用旧 route。
- 说明:2026-05-14 已在正式 `3000` 入口复跑 Hermes 页面 AI smoke 矩阵,旧 `/api/ai-agent/run` 只保留 410 retirement guard。