bot/docs/vikingbot-phase2-feedback-validation-with-openviking-server.md
Author: OpenViking Team Status: Draft Date: 2026-04-30
本文用于验证 Vikingbot feedback observability Phase 2 当前已经进入实现状态的显式反馈链路,重点覆盖:
POST /bot/v1/feedback 可通过 OpenViking Server 代理路径访问response_id 关联到历史 assistant messagemetadata.feedback_eventsfeedback_submitted 事件feedback_submitted 不会泄漏到用户可见 channel本文优先采用 openviking-server --with-bot 的真实代理路径进行验证,而不是直接把 vikingbot gateway 端口当作主验证入口。
本文适用于以下启动方式:
openviking-server --with-bot
在这种模式下:
/bot/v1因此本文默认验证地址形如:
http://127.0.0.1:<server-port>/bot/v1本文不把 http://127.0.0.1:18790 视为主验证入口。
截至 2026-04-30,本轮已完成的验证分为三类。
已通过如下定向测试:
./.venv/bin/python -m pytest -o addopts='' bot/tests/test_openapi_auth.py -k feedback
结果:3 passed
对应验证点:
/bot/v1/feedback 时,返回 accepted=trueOutboundEventType.FEEDBACK_SUBMITTEDfeedback_events[0]response_id 提交反馈时,返回 404 Response not found/feedback 会重新加载 session,避免误报 Response not found已通过 openviking-server --with-bot 验证代理健康检查:
curl -sS http://127.0.0.1:30300/bot/v1/health
返回结果表明:
/bot/v1--with-bot 启动路径在当前环境可用/chat -> /feedback 闭环验证本轮已经通过 openviking-server --with-bot --config ov_conf/ov.conf 完成真实代理路径闭环验证。
前置条件:
OPENVIKING_CLI_CONFIG_FILE=ov_conf/ovcli.conf openviking-server --with-bot --config ov_conf/ov.conf
验证结果:
POST /bot/v1/chat 能返回真实 response_idPOST /bot/v1/feedback 能通过 OpenViking Server 代理路径成功提交有效反馈response_id 提交反馈时,OpenViking Server 返回统一错误包裹,其中 message 为 {"detail":"Response not found"}./data/bot/sessions/cli__default__phase2-feedback-session-3.jsonl 的 metadata 已实际出现 feedback_events本轮真实验证样例:
/chat 返回 response_id=71283018f5e1416ab5f22b11eccd6176/feedback 返回:{
"accepted": true,
"response_id": "71283018f5e1416ab5f22b11eccd6176",
"session_id": "phase2-feedback-session-3",
"feedback_type": "thumb_up",
"feedback_delay_sec": 9.228,
"timestamp": "2026-04-30T11:32:43.355564"
}
{
"metadata": {
"feedback_events": [
{
"response_id": "71283018f5e1416ab5f22b11eccd6176",
"feedback_type": "thumb_up",
"feedback_text": "helpful",
"feedback_delay_sec": 9.228
}
]
}
}
本机全局 ~/.openviking/ovcli.conf 包含非法字段 url44:
ValueError: Invalid CLI config in /home/yangshunyao/.openviking/ovcli.conf:
Unknown config field 'ovcli.url44' (did you mean 'ovcli.url'?)
解决方式不是修改用户全局配置,而是在启动 openviking-server --with-bot 时显式传入 repo 内的 colocated CLI 配置:
OPENVIKING_CLI_CONFIG_FILE=ov_conf/ovcli.conf openviking-server --with-bot --config ov_conf/ov.conf
这样可以保证 bot 子进程以及 bot 内部 OpenViking client 都读取 ov_conf/ovcli.conf。
/feedback虽然 vikingbot gateway 已实现 POST /bot/v1/feedback,但 OpenViking Server 的 openviking/server/routers/bot.py 起初只代理:
/health/chat/chat/stream因此通过 http://127.0.0.1:30300/bot/v1/feedback 访问时,只会得到 OpenViking Server 自己的 404。
本轮已补齐代理层 /feedback 转发,并增加了对应回归测试。
真实闭环验证中还发现一个仅在运行时更容易触发的问题:
SessionManagerSessionManager/feedback 请求先把空 session 缓存进 OpenAPIChannel这会导致真实路径上错误返回 Response not found。
本轮已在 /feedback handler 中补充“一次磁盘重载重试”,并增加定向回归测试覆盖该场景。
OPENVIKING_CLI_CONFIG_FILE=ov_conf/ovcli.conf openviking-server --with-bot --config ov_conf/ov.conf
预期日志至少包含类似内容:
Bot API proxy enabled, forwarding to http://127.0.0.1:18790
Starting vikingbot gateway...
Vikingbot gateway started (PID: ...)
OpenViking HTTP Server is running on 127.0.0.1:30300
curl -sS http://127.0.0.1:30300/bot/v1/health
预期返回 HTTP 200。
在使用 repo 内 colocated ovcli.conf 启动后,发送:
curl -sS -X POST "http://127.0.0.1:30300/bot/v1/chat" \
-H "Content-Type: application/json" \
-d '{
"session_id": "phase2-feedback-session",
"user_id": "phase2-feedback-user",
"message": "请简单回复一句:用于验证 feedback"
}'
预期返回中至少包含:
{
"session_id": "phase2-feedback-session",
"response_id": "...",
"message": "..."
}
拿到上一步的 response_id 后,发送:
curl -sS -X POST "http://127.0.0.1:30300/bot/v1/feedback" \
-H "Content-Type: application/json" \
-d '{
"session_id": "phase2-feedback-session",
"response_id": "<response_id>",
"feedback_type": "thumb_up",
"feedback_text": "helpful"
}'
预期返回类似:
{
"accepted": true,
"response_id": "<response_id>",
"session_id": "phase2-feedback-session",
"feedback_type": "thumb_up",
"feedback_delay_sec": 1.234,
"timestamp": "..."
}
response_id 返回 404curl -sS -X POST "http://127.0.0.1:30300/bot/v1/feedback" \
-H "Content-Type: application/json" \
-d '{
"session_id": "phase2-feedback-session",
"response_id": "missing-response",
"feedback_type": "thumb_down"
}'
bot gateway 侧预期返回 HTTP 404,OpenViking Server 当前会包一层统一错误格式,典型返回为:
{
"status": "error",
"error": {
"code": "NOT_FOUND",
"message": "{\"detail\":\"Response not found\"}"
}
}
默认情况下,session 文件位于:
{storage.workspace}/bot/sessions
例如当前本地配置对应:
./data/bot/sessions
找到对应 session 文件后,检查首行 metadata,预期包含:
{
"metadata": {
"feedback_events": [
{
"response_id": "<response_id>",
"feedback_type": "thumb_up",
"feedback_text": "helpful"
}
]
}
}
当前实现约束是:
channel_key 分发,而不是按 event_type 分发feedback_submitted 仅作为 analytics-only 事件存在因此应确认:
/feedback 返回体中没有额外暴露 feedback_submitted 事件流/bot/v1/health 不通优先检查:
openviking-server --with-botov.conf 中的 server.port 一致18790 是否被旧的 vikingbot 进程占用/chat 失败但 /health 正常优先检查 bot 日志文件,例如:
{storage.workspace}/bot/logs/vikingbot.log
本轮实际遇到的排查示例是:
Invalid CLI config in /home/yangshunyao/.openviking/ovcli.conf
Unknown config field 'ovcli.url44'
这类问题会阻塞真实 agent 处理,但不代表 /feedback 的接口实现本身有问题。
/chat 成功但 /feedback 直接返回框架 404优先检查 OpenViking Server 代理层是否真的暴露了 /bot/v1/feedback。
如果日志里根本没有 bot gateway 收到 POST /bot/v1/feedback,而 HTTP 返回是通用 404,则通常不是 bot gateway 本身的问题,而是 server proxy 没有转发该路由。
/feedback 命中 bot gateway 但仍返回 Response not found优先检查:
response_id 是否确实来自同一 session_id 的 assistant responsecli__default__<session>.jsonl截至当前,Phase 2 应使用如下口径描述:
/bot/v1/feedback 已实现openviking-server --with-bot 代理健康路径已验证可用/chat -> /feedback 闭环已在当前环境完成,并确认 session JSONL 会写入 metadata.feedback_events/bot/v1/feedback 代理路由response_outcome_evaluated 仍然不在 Phase 2 范围内