Skip to content

feat(bot): add unified VikingBot gateway routing and OpenViking auth#3119

Merged
chenjw merged 6 commits into
mainfrom
doc/update_bot_doc
Jul 10, 2026
Merged

feat(bot): add unified VikingBot gateway routing and OpenViking auth#3119
chenjw merged 6 commits into
mainfrom
doc/update_bot_doc

Conversation

@yeshion23333

@yeshion23333 yeshion23333 commented Jul 10, 2026

Copy link
Copy Markdown
Collaborator

English

Summary

This PR makes VikingBot Gateway a first-class OpenViking CLI endpoint while preserving the existing openviking-server --with-bot path.

  • Keep ov chat -> OpenViking server -> /bot/v1 -> VikingBot Gateway.
  • Add direct Gateway chat and /api/v1/* proxying for ov list, search, session, and other CLI commands.
  • Separate Gateway entry authentication from OpenViking user authentication.
  • Propagate OpenViking credentials as request-scoped identity instead of process-wide Bot state.

Related RFC: Discussion #3042

Routing

VikingBot Gateway routing: preserved and added paths

Modes

Mode Authentication Behavior
openviking-server --with-bot OpenViking authenticates the caller Preserves the server /bot/v1 route and injects request-scoped identity
Gateway with OpenViking Gateway token when public, plus caller OpenViking credentials Supports chat and proxies other CLI APIs
Local standalone Gateway No token required Chat only; OpenViking APIs return a clear 503
Public standalone Gateway Gateway token required Chat only; OpenViking APIs remain unavailable

Key changes

  • Derives explicit, inherited, and standalone upstream states internally; no new source or target config fields.
  • Validates upstream availability and auth_mode at startup, then rechecks it per request and fails closed on mode changes.
  • Requires bot.gateway.token only for non-localhost Gateway listeners. The CLI sends it only after a marked Gateway challenge and never forwards it upstream.
  • Keeps API key, account, user, actor, tools, hooks, subagents, and sessions request-scoped.
  • Isolates sessions by authenticated OpenViking principal.
  • Improves localized ov chat output and actionable errors for missing identity, missing keys, standalone proxy, and dev-mode boundaries.

Verification

  • Rust CLI: 416 tests passed.
  • VikingBot auth/config/bootstrap: 103 tests passed.
  • Functional coverage includes the preserved --with-bot route, direct Gateway chat, API proxying, standalone mode, public Gateway token checks, and dev / api_key / trusted authentication.

中文

概述

本 PR 在保留 openviking-server --with-bot 旧链路的基础上,将 VikingBot Gateway 扩展为 OpenViking CLI 的统一入口。

  • 保留 ov chat -> OpenViking server -> /bot/v1 -> VikingBot Gateway
  • 新增 CLI 直连 Gateway 对话,以及 /api/v1/* 代理,支持 ov listsearchsession 等命令。
  • 分离 Gateway 入口鉴权与 OpenViking 用户鉴权。
  • OpenViking 凭据按请求传递,不再作为 Bot 进程级共享身份。

关联 RFC:Discussion #3042

调用链路

VikingBot Gateway 调用链路:保留链路与新增链路

使用模式

模式 鉴权 行为
openviking-server --with-bot OpenViking 鉴权调用方 保留 server /bot/v1,注入 request-scoped 身份
Gateway 使用 OpenViking 公网 Gateway token + 调用方 OpenViking 凭据 支持对话并代理其他 CLI API
本地 standalone Gateway 无需 token 仅支持对话;OpenViking API 返回明确的 503
公网 standalone Gateway 必须配置 Gateway token 仅支持对话;OpenViking API 不可用

主要改动

  • 在内部派生 explicitinheritedstandalone 状态,不新增 sourcetarget 配置。
  • 启动时校验 upstream 与 auth_mode,请求时实时复核;模式变化时 fail closed。
  • 仅非 localhost Gateway 要求 bot.gateway.token。CLI 只在收到带标识的 Gateway challenge 后发送 token,且不会转发给 OpenViking。
  • API key、account、user、actor、tools、hooks、subagent 和 session 全链路使用 request-scoped 身份。
  • 按 OpenViking 鉴权主体隔离会话。
  • 优化 ov chat 的中英文展示,以及身份缺失、Key 缺失、standalone proxy、dev 安全边界等错误提示。

验证

  • Rust CLI:416 项测试通过。
  • VikingBot 鉴权、配置与启动:103 项测试通过。
  • 功能覆盖旧 --with-bot 链路、Gateway 直连对话、API proxy、standalone、公网 Gateway token,以及 dev / api_key / trusted 三种鉴权模式。

# Conflicts:
#	bot/vikingbot/config/loader.py
#	crates/ov_cli/src/error_ui.rs
@yeshion23333 yeshion23333 changed the title feat(bot): Doc/update bot doc feat(bot): add unified VikingBot gateway routing and OpenViking auth Jul 10, 2026
@yeshion23333 yeshion23333 marked this pull request as ready for review July 10, 2026 08:35
@chenjw chenjw merged commit cbfb387 into main Jul 10, 2026
12 checks passed
@chenjw chenjw deleted the doc/update_bot_doc branch July 10, 2026 09:45
@github-project-automation github-project-automation Bot moved this from Backlog to Done in OpenViking project Jul 10, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

2 participants