Make your computer a home for your AI partner. Avibe is the local-first Agent OS: Vibey, its built-in AI partner, works out of the box, and Claude Code, Codex & OpenCode run unchanged beside it — reach them from your browser, phone, or any chat app.
Python agentagent-osaiai-agentsai-partnerchatopsclaudeclaude-codecodexdevtoolsdiscord-botlark-botllmlocal-firstlong-term-memoryopencodeslack-botvibe-codingvibeywechat
fix(remote-access): normalize host and process parsing
cyhe8966cb85077
diff --git a/tests/test_remote_access_vibe_cloud.py b/tests/test_remote_access_vibe_cloud.pyindex 5793c56e1..2cec4782d 100644--- a/tests/test_remote_access_vibe_cloud.py+++ b/tests/test_remote_access_vibe_cloud.py@@ -93,3 +93,14 @@ def test_stop_ui_continues_when_remote_access_stop_fails(monkeypatch, tmp_path)assert runtime.stop_ui() is Falseassert stop_calls == [paths.get_runtime_ui_pid_path()]+++def test_cloudflared_pid_detection_handles_quoted_paths_with_spaces(monkeypatch) -> None:+ monkeypatch.setattr(runtime, "pid_alive", lambda pid: pid == 123)+ monkeypatch.setattr(+ runtime,+ "get_process_command",+ lambda pid: '"C:\\Program Files\\Cloudflare\\cloudflared.exe" tunnel --no-autoupdate run',+ )++ assert remote_access._is_cloudflared_pid(123) is Truediff --git a/tests/test_ui_remote_access_auth.py b/tests/test_ui_remote_access_auth.pyindex 348178dc3..948fb5c2d 100644--- a/tests/test_ui_remote_access_auth.py+++ b/tests/test_ui_remote_access_auth.py@@ -40,6 +40,16 @@ def test_remote_host_redirects_to_vibe_cloud_login(monkeypatch, tmp_path):assert response.headers["Location"].startswith("https://backend.test/oauth/authorize?")+def test_remote_host_with_explicit_port_still_requires_login(monkeypatch, tmp_path):+ monkeypatch.setenv("VIBE_REMOTE_HOME", str(tmp_path))+ _save_config(tmp_path)++ response = app.test_client().get("/dashboard", base_url="https://alex.vibe.io:443", follow_redirects=False)++ assert response.status_code == 302+ assert response.headers["Location"].startswith("https://backend.test/oauth/authorize?")++def test_localhost_does_not_require_remote_access_cookie(monkeypatch, tmp_path):monkeypatch.setenv("VIBE_REMOTE_HOME", str(tmp_path))_save_config(tmp_path)diff --git a/vibe/remote_access.py b/vibe/remote_access.pyindex f006d2a52..7f89da2b3 100644--- a/vibe/remote_access.py+++ b/vibe/remote_access.py@@ -5,8 +5,10 @@ from __future__ import annotationsimport hashlibimport hmacimport json+import ntpathimport osimport platform+import shleximport secretsimport shutilimport stat@@ -155,8 +157,14 @@ def _is_cloudflared_pid(pid: int | None) -> bool:if not pid or not runtime.pid_alive(pid):return Falsecommand = runtime.get_process_command(pid) or ""- executable = command.strip().split(" ", 1)[0].strip("\"'")- return Path(executable).name.lower() in {"cloudflared", "cloudflared.exe"}+ try:+ parts = shlex.split(command.strip(), posix=False)+ except ValueError:+ parts = command.strip().split()+ executable = parts[0].strip("\"'") if parts else ""+ executable_name = Path(executable).name.lower()+ windows_name = ntpath.basename(executable).lower()+ return executable_name in {"cloudflared", "cloudflared.exe"} or windows_name in {"cloudflared", "cloudflared.exe"}def _write_state(pid: int, config: V2Config, binary: str) -> None:diff --git a/vibe/ui_server.py b/vibe/ui_server.pyindex 812eb5c90..3ae0e73a9 100644--- a/vibe/ui_server.py+++ b/vibe/ui_server.py@@ -192,20 +192,23 @@ def _load_remote_access_config() -> V2Config | None:def _is_local_request_host() -> bool:- raw_host = (request.host or "").lower()- if raw_host.startswith("[") and "]" in raw_host:- host = raw_host[1 : raw_host.index("]")]- else:- host = raw_host.split(":", 1)[0]+ host = _normalized_host(request.host)return host in {"localhost", "127.0.0.1", "::1"} or host.startswith("127.")+def _normalized_host(value: str | None) -> str:+ raw_host = (value or "").lower()+ if raw_host.startswith("[") and "]" in raw_host:+ return raw_host[1 : raw_host.index("]")]+ return raw_host.split(":", 1)[0]++def _is_remote_access_request(config: V2Config) -> bool:cloud = config.remote_access.vibe_cloudif not cloud.enabled or not cloud.public_url:return False- public_host = urlparse(cloud.public_url).netloc.lower()- return bool(public_host and request.host.lower() == public_host)+ public_host = _normalized_host(urlparse(cloud.public_url).netloc)+ return bool(public_host and _normalized_host(request.host) == public_host)def _remote_auth_exempt_path() -> bool: