OpenViking icon indicating copy to clipboard operation
OpenViking copied to clipboard

[Question]: Web Studio Agent not available in Mode C (standalone gateway); gateway.host ignored in Mode A

Open unfall103-debug opened this issue 4 months ago • 4 comments

Issue Origin

Observed or reproduced in a real environment

Your Question

I have two related questions about OpenViking deployment modes:

  1. Mode C (separate gateway + server without --with-bot) – Web Studio shows "Please enable bot mode" and Agent chat is unavailable, even though vikingbot gateway is running independently. Is there any way to make Web Studio connect to the standalone gateway, or is this a fundamental design limitation?
  2. Mode A (all-in-one with --with-bot) – The built-in bot subprocess ignores bot.gateway.host: "0.0.0.0" in ov.conf and always binds to 127.0.0.1:18790. Is this intentional (security hardcoding)? If so, please document it; if not, can it be fixed?

Context

Environment:

· OpenViking version: v0.4.11 · OS: PVE 9.2.5 with LXC Debian 13 · Python: 3.13.5 · Deployment: bare metal, not containerized

What I have already done:

· Read the VikingBot README and Web Studio README. · Confirmed that vikingbot gateway listens on 0.0.0.0:18790 and is healthy. · Set root_api_key in Web Studio's "Connection & Identity" panel. · Tried adding --config to the server command to ensure ov.conf is loaded. · Verified that in Mode A, the subprocess is launched with --host 127.0.0.1 regardless of the config.

Relevant documentation quotes:

· Web Studio README states: "The session interface depends on the VikingBot API proxied by the OpenViking Server: GET /bot/v1/health, POST /bot/v1/chat ... Without --with-bot, /bot/v1/* returns 503." · VikingBot README describes Mode C as a valid deployment scenario but does not mention that Web Studio UI will not work in this mode.

Code Example (Optional)

Mode C (server without bot):


openviking-server --host 0.0.0.0 --port 1933 --config /root/.openviking/ov.conf


Standalone gateway (Mode C):


vikingbot gateway --config /root/.openviking/ov.conf


ov.conf gateway section:


"bot": {
  "gateway": {
    "host": "0.0.0.0",
    "port": 18790,
    "token": "Andyis23erwe3453t34t342FRG3"
  },
  "ov_server": {
    "server_url": "http://127.0.0.1:1933",
    "api_key": "ZGVmYX..."
  }
}


Mode A – observed subprocess command:


ps aux | grep vikingbot
# ... vikingbot gateway --host 127.0.0.1 --port 18790


Port binding in Mode A:


ss -tlnp | grep 18790
# LISTEN 0 2048 127.0.0.1:18790 0.0.0.0:* users:(("vikingbot",...))

Related Area

Configuration

Before Asking

unfall103-debug avatar Jul 26 '26 12:07 unfall103-debug

Re: question 2 (Mode A: built-in bot binds 127.0.0.1 and ignores `bot.gateway.host: "0.0.0.0"`) — I traced this on current `main`, and it is intentional security behavior, not a bug.

The VikingBot gateway refuses to bind a non-loopback host unless an auth token is configured, so you can't accidentally expose the bot gateway to the network without authentication. The relevant code:

  • `bot/vikingbot/config/loader.py` — `_is_loopback_host()` / `_validate_dev_boundary()` (around line 552 / 572): dev-mode OpenViking auth is only allowed when both the gateway and the OpenViking server are loopback.
  • `bot/vikingbot/cli/commands.py` — the `gateway` command rejects `host` non-loopback when no token is set (falls back to / forces loopback), and allows non-loopback when a token is set.

This is locked in by tests in `bot/tests/test_gateway_startup_security.py`:

  • `test_gateway_rejects_non_localhost_without_token` — `gateway.host="0.0.0.0"`, `token=""` → `SystemExit` (rejected).
  • `test_gateway_allows_non_localhost_with_token` — `gateway.host="0.0.0.0"`, `token="secret"` → allowed.

So the fix on your side: set `gateway.token` (a non-empty auth token) in `ov.conf`, then `gateway.host: "0.0.0.0"` is honored. Without a token the gateway intentionally stays on loopback.

You're right that this deserves a user-facing doc note (currently it's enforced + tested but not spelled out in the gateway docs). If maintainers agree, I'm happy to open a small docs PR adding a "Binding to 0.0.0.0 requires `gateway.token`" note to the bot gateway guide.

(For question 1 — Mode C standalone gateway + Web Studio showing "enable bot mode" — that's a separate architecture question about whether Web Studio can target a standalone gateway; leaving that for the maintainers who know the Web Studio/bot coupling.)

now-ing avatar Jul 27 '26 18:07 now-ing

Summary of investigation + fix

I traced both reported behaviors. Here's what I found and what I'm fixing.

Q1 — Mode C (standalone gateway + Web Studio shows "Please enable bot mode"): This is by design, not a bug. The OpenViking Server /bot/v1/* proxy is gated entirely by config.with_bot / --with-bot. Without that flag, BOT_API_URL stays None and every /bot/v1/* endpoint returns 503 with "Bot service not enabled". Web Studio depends on GET /bot/v1/health through the server proxy, so it cannot target a standalone vikingbot gateway. The VikingBot README describes Mode C as a valid gateway deployment, but it doesn't promise Web Studio works in that mode — and the current architecture couples the Web Studio bot UI to the server-managed gateway. Making this work would need a design change (e.g. a bot_api_url-style server config pointing at an external gateway), which is broader than a bug fix and should be a separate discussion.

Q2 — Mode A (built-in bot ignores bot.gateway.host: "0.0.0.0"): This is a real bug. openviking/server/bootstrap.py::_start_vikingbot_gateway() hardcodes --host 127.0.0.1 when spawning the vikingbot subprocess, so bot.gateway.host from ov.conf is silently ignored. The commenter's guess that it's "intentional security hardcoding" is understandable but wrong — the actual security guard is in vikingbot/cli/commands.py (the gateway command refuses to bind non-loopback without a token), and that guard still applies regardless of who passes --host. The hardcoding in server bootstrap is just an oversight.

Fix in PR #3637:

  • Read bot.gateway.host from the same resolved ov.conf path the server already uses (so --config, OPENVIKING_CONFIG_FILE, and the default path all work — not just the explicit flag).
  • Pass it through to the vikingbot subprocess instead of forcing 127.0.0.1.
  • Use map_bind_host_to_loopback() for the server's internal proxy URL, so wildcard bind addresses like 0.0.0.0 are translated to a connectable loopback address (the server proxies to itself locally; it shouldn't try to connect to 0.0.0.0).
  • Default stays 127.0.0.1 when bot.gateway.host is not set — no behavior change for existing deployments.
  • The vikingbot-side token-required-for-non-loopback guard remains fully enforced (verified by bot/tests/test_gateway_startup_security.py).

Tests: 20 passed (server bootstrap + focused unit tests), 4 passed (gateway security), ruff clean, git diff --check clean.

huangruiteng avatar Jul 30 '26 15:07 huangruiteng

Regarding the discussion on Mode A vs Mode C, I'd like to share a perspective from actual usage.

I've been testing OpenViking for a while, in both modes. Here's what I observed:

  1. Storage and agent are fundamentally separate domains.

Storage is storage — persistence, retrieval, vectorization. Agent is agent — conversation, tools, channels. They have different lifecycles, different scaling needs, and different audiences. Binding them together (--with-bot, Web Studio depending on server proxy) creates unnecessary constraints and limits both.

Mode C already proves they can run independently — but then Web Studio breaks. That's not a bug, it's a design choice that forces users to pick between "flexible deployment" and "usable UI".

  1. The longer they stay coupled, the harder it becomes to split later.

Codebases grow into their architecture. Tight coupling today means deeper interdependencies tomorrow, more tests to rewrite, more breaking changes for users. Splitting early, while things are still relatively clean, gives both sides room to grow at their own pace. It's easier to design for separation now than to retrofit it after the codebase has fully ossified.

2.5. For production use, separation isn't optional — it's a reliability requirement.

If this is meant to run in production, it will likely be distributed across multiple machines — maybe even a cluster. In that kind of setup, you need components that can fail independently. Coupled deployment means a single failure takes down everything. That's a hard sell for anyone running serious workloads.

I'm currently running this across PVE LXC containers in a distributed setup. If one component fails, the rest keep running. That's the kind of resilience you need in production. Separation isn't just about cleaner design — it's about not having a single point of failure.

  1. There's already a working example of this approach.

Take a look at Qualixar's ecosystem:

· superlocalmemory: standalone memory backend · slm-mcp-hub: standalone MCP gateway · agentassert: standalone testing tool · qualixar-os: standalone agent OS

Each tool is independent, installable on its own, and composable via MCP. The ecosystem is thriving because each component focuses on doing one thing well, rather than being bundled into a single monolith.

  1. The interface is already there — MCP.

MCP is the public, standard interface that connects memory systems, agents, and tools. It's already built by the community. The right move is to treat it like Lego: Lego doesn't sell finished robots — it sells blocks. You buy blocks, you build whatever you want. That flexibility is the strength.

You don't need to build the whole robot for everyone. Build the blocks — VikingBot as a standalone agent block, Viking Server as a standalone memory block — and let users compose them however they want. The MCP interface is the connector. The less you bundle, the more use cases you unlock.

What if Viking went this way?

· VikingBot as a standalone agent framework (with its own MCP interface) · Viking Server as a standalone memory backend (with its own MCP interface) · Both can talk to each other via MCP, but neither depends on the other · Web Studio can connect to either — or to any other agent/memory system

You have unique advantages — ByteDance platform, Douyin integration potential. VikingBot could be the agent that connects to those platforms. Viking Server could be the memory backend that any agent can use. They'd be stronger as independent products than as a bundled couple.

I'm currently using SLM + MCP Hub + OpenClaw in this decoupled way, and it works much better for my use case.

Just my 2 cents from someone who's spent time actually running both modes. Thanks for the work so far — just hoping this feedback helps shape future direction.

unfall103-debug avatar Jul 30 '26 16:07 unfall103-debug

Thanks for the thoughtful feedback and for sharing your production experience. We agree that storage and Agent runtimes have different lifecycles, and independent deployment is valuable.

OpenViking Server and VikingBot already support separate deployment. --with-bot is an all-in-one convenience mode. Web Studio belongs to OpenViking Server and remains available without Bot; only Agent chat requires the Server-managed Bot API.

Supporting Studio with an external Gateway is a valuable direction, but it would be a separate feature rather than a bug in the current behavior. We’d be happy to discuss it further in a dedicated RFC. Thanks again for the suggestion.

yeshion23333 avatar Jul 31 '26 09:07 yeshion23333