Skip to content

Self-evolving Context Database for AI Agents. Unify Agent Memory, Knowledge RAG and Skills.

fix(openwebui): parse bracketed IPv6 bind addresses (#6106)

LIc1d3ad90bf6d
diff --git a/examples/openwebui-plugin/README.md b/examples/openwebui-plugin/README.md
index 5f64f2fd9..7c48a58bc 100644
--- a/examples/openwebui-plugin/README.md
+++ b/examples/openwebui-plugin/README.md
@@ -74,7 +74,7 @@ All configuration is via environment variables:
| `OV_ACCOUNT` | `default` | Tenant — sent as `X-OpenViking-Account` |
| `OV_USER` | `default` | User — sent as `X-OpenViking-User` |
| `OV_AGENT` | `default` | Actor peer ID — sent as `X-OpenViking-Actor-Peer` |
-| `OV_BIND` | `0.0.0.0:8765` | Host:port the tool server binds to |
+| `OV_BIND` | `0.0.0.0:8765` | Host:port the tool server binds to; bracket IPv6 addresses, e.g. `[::1]:8765` |
| `OV_TIMEOUT` | `30` | HTTP timeout in seconds when calling OpenViking |
There is no config file. This is intentional — make the deployment unit one
diff --git a/examples/openwebui-plugin/openviking_openwebui/config.py b/examples/openwebui-plugin/openviking_openwebui/config.py
index 8940214ae..abbf51d31 100644
--- a/examples/openwebui-plugin/openviking_openwebui/config.py
+++ b/examples/openwebui-plugin/openviking_openwebui/config.py
@@ -31,14 +31,22 @@ class Settings:
bind: str
timeout_seconds: float
+ def _split_bind(self) -> tuple[str, str]:
+ if self.bind.startswith("["):
+ host, closing, suffix = self.bind[1:].partition("]")
+ if closing and ":" in host and (not suffix or suffix.startswith(":")):
+ return host, suffix[1:]
+ host, _, port = self.bind.partition(":")
+ return host, port
+
@property
def bind_host(self) -> str:
- host, _, _ = self.bind.partition(":")
+ host, _ = self._split_bind()
return host or "0.0.0.0"
@property
def bind_port(self) -> int:
- _, _, port = self.bind.partition(":")
+ _, port = self._split_bind()
try:
return int(port) if port else 8765
except ValueError:
diff --git a/examples/openwebui-plugin/tests/test_config.py b/examples/openwebui-plugin/tests/test_config.py
new file mode 100644
index 000000000..74e30bfac
--- /dev/null
+++ b/examples/openwebui-plugin/tests/test_config.py
@@ -0,0 +1,46 @@
+# Copyright (c) 2026 Beijing Volcano Engine Technology Co., Ltd.
+# SPDX-License-Identifier: AGPL-3.0
+"""Environment configuration and listener address regression tests."""
+
+from __future__ import annotations
+
+import pytest
+from openviking_openwebui.config import load_settings
+
+
+ "bind, host, port",
+ [
+ ("[::1]:18765", "::1", 18765),
+ ("[::]:18765", "::", 18765),
+ ("[2001:db8::1]:18765", "2001:db8::1", 18765),
+ ("[::1]", "::1", 8765),
+ ("[::1]:", "::1", 8765),
+ ("[::1]:invalid", "::1", 8765),
+ ("[::ffff:127.0.0.1]:18765", "::ffff:127.0.0.1", 18765),
+ ("127.0.0.1:18765", "127.0.0.1", 18765),
+ ("0.0.0.0:18765", "0.0.0.0", 18765),
+ ("localhost:18765", "localhost", 18765),
+ ("localhost", "localhost", 8765),
+ ("localhost:", "localhost", 8765),
+ ("localhost:invalid", "localhost", 8765),
+ (":18765", "0.0.0.0", 18765),
+ ("[::1", "[", 8765),
+ ("[::1]junk", "[", 8765),
+ ],
+)
+def test_load_settings_parses_bind(monkeypatch, bind, host, port):
+ monkeypatch.setenv("OV_BIND", bind)
+
+ settings = load_settings()
+
+ assert settings.bind_host == host
+ assert settings.bind_port == port
+
+
+def test_load_settings_default_bind(monkeypatch):
+ monkeypatch.delenv("OV_BIND", raising=False)
+
+ settings = load_settings()
+
+ assert (settings.bind_host, settings.bind_port) == ("0.0.0.0", 8765)