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): preserve pairing backend errors
cyh44adfc4e1b2f
diff --git a/tests/test_remote_access_vibe_cloud.py b/tests/test_remote_access_vibe_cloud.pyindex b8d4eade8..983d35e2c 100644--- a/tests/test_remote_access_vibe_cloud.py+++ b/tests/test_remote_access_vibe_cloud.py@@ -138,6 +138,17 @@ def test_pair_returns_structured_error_when_backend_request_fails(monkeypatch) -assert "offline" in result["detail"]+def test_pair_preserves_backend_error_response(monkeypatch) -> None:+ def fake_request(*args, **kwargs):+ raise remote_access.BackendRequestError(400, {"error": "invalid_pairing_key"})++ monkeypatch.setattr(remote_access, "_json_request", fake_request)++ result = remote_access.pair("vrp_test", "https://backend.test")++ assert result == {"ok": False, "error": "invalid_pairing_key", "status": 400}++def test_stop_ui_continues_when_remote_access_stop_fails(monkeypatch, tmp_path) -> None:monkeypatch.setenv("VIBE_REMOTE_HOME", str(tmp_path))stop_calls = []diff --git a/vibe/remote_access.py b/vibe/remote_access.pyindex 65359ae76..b7b458edd 100644--- a/vibe/remote_access.py+++ b/vibe/remote_access.py@@ -17,6 +17,7 @@ import tarfileimport tempfileimport threadingimport time+import urllib.errorimport urllib.parseimport urllib.requestfrom pathlib import Path@@ -35,6 +36,13 @@ SESSION_TTL_SECONDS = 12 * 60 * 60_CONNECTOR_LOCK = threading.RLock()+class BackendRequestError(Exception):+ def __init__(self, status: int, payload: dict[str, Any]):+ super().__init__(payload.get("detail") or payload.get("error") or f"HTTP {status}")+ self.status = status+ self.payload = payload++def _bin_dir() -> Path:return paths.get_vibe_remote_dir() / "bin"@@ -326,9 +334,31 @@ def reconcile(config: V2Config | None = None) -> dict[str, Any]:def _json_request(url: str, payload: dict[str, Any], timeout: float = 20.0) -> dict[str, Any]:data = json.dumps(payload).encode("utf-8")- request = urllib.request.Request(url, data=data, headers={"Content-Type": "application/json"}, method="POST")- with urllib.request.urlopen(request, timeout=timeout) as response:- return json.loads(response.read().decode("utf-8"))+ request = urllib.request.Request(+ url,+ data=data,+ headers={+ "Content-Type": "application/json",+ "Accept": "application/json",+ "User-Agent": "Vibe Remote/dev",+ },+ method="POST",+ )+ try:+ with urllib.request.urlopen(request, timeout=timeout) as response:+ return json.loads(response.read().decode("utf-8"))+ except urllib.error.HTTPError as exc:+ body = exc.read().decode("utf-8", "replace")+ try:+ parsed = json.loads(body) if body else {}+ except json.JSONDecodeError:+ parsed = {}+ if not isinstance(parsed, dict):+ parsed = {}+ parsed.setdefault("error", "backend_http_error")+ if body and "detail" not in parsed:+ parsed["detail"] = body+ raise BackendRequestError(exc.code, parsed) from excdef pair(pairing_key: str, backend_url: str, device_name: str = "Vibe Remote") -> dict[str, Any]:@@ -341,6 +371,8 @@ def pair(pairing_key: str, backend_url: str, device_name: str = "Vibe Remote") -f"{backend_url}/api/v1/pairing/redeem",{"pairing_key": pairing_key, "device_name": device_name, "local_version": "dev"},)+ except BackendRequestError as exc:+ return {"ok": False, **exc.payload, "status": exc.status}except Exception as exc:return {"ok": False, "error": "pairing_request_failed", "detail": str(exc)}required = ("instance_id", "client_id", "issuer", "authorization_endpoint", "token_endpoint", "jwks_uri", "public_url", "redirect_uri", "tunnel_token", "instance_secret")