Skip to content

armgit / avibe

Public Imported from GitHub
0

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.

Revert "fix(cli): gate bare vibe restart compatibility"

cyhbf0dc200f892
diff --git a/tests/test_vibe_cli.py b/tests/test_vibe_cli.py
index d7eea52de..51b5dc657 100644
--- a/tests/test_vibe_cli.py
+++ b/tests/test_vibe_cli.py
@@ -176,33 +176,9 @@ def test_cmd_restart_runs_synchronously_by_default(monkeypatch):
assert calls == ["stop", ("sleep", 3), "start"]
-def test_cmd_vibe_starts_by_default(monkeypatch):
+def test_cmd_vibe_uses_restart_compatibility_default(monkeypatch):
calls = []
- config = SimpleNamespace(
- has_configured_platform_credentials=lambda: True,
- ui=SimpleNamespace(setup_host="127.0.0.1", setup_port=5123, open_browser=False),
- )
-
- monkeypatch.setattr(cli.paths, "ensure_data_dirs", lambda: None)
- monkeypatch.setattr(cli, "_ensure_config", lambda: config)
- monkeypatch.setattr(cli, "_should_restart_for_upgrade_compat", lambda cfg: False)
- monkeypatch.setattr(cli, "_cmd_start_with_config", lambda cfg: calls.append(("start", cfg)) or 0)
-
- assert cli.cmd_vibe() == 0
-
- assert calls == [("start", config)]
-
-
-def test_cmd_vibe_restarts_for_upgrade_compat(monkeypatch):
- calls = []
- config = SimpleNamespace(
- has_configured_platform_credentials=lambda: True,
- ui=SimpleNamespace(setup_host="127.0.0.1", setup_port=5123, open_browser=False),
- )
- monkeypatch.setattr(cli.paths, "ensure_data_dirs", lambda: None)
- monkeypatch.setattr(cli, "_ensure_config", lambda: config)
- monkeypatch.setattr(cli, "_should_restart_for_upgrade_compat", lambda cfg: True)
monkeypatch.setattr(cli, "_cmd_restart_with_delay", lambda delay: calls.append(("restart", delay)) or 0)
assert cli.cmd_vibe() == 0
@@ -232,40 +208,6 @@ def test_cmd_start_ensures_services_without_stopping(monkeypatch):
assert not any(call == "stop" for call in calls)
-def test_upgrade_compat_restart_when_running_ui_version_differs(monkeypatch):
- config = SimpleNamespace(ui=SimpleNamespace(setup_host="127.0.0.1", setup_port=5123))
-
- monkeypatch.setattr(cli, "__version__", "2.3.2")
- monkeypatch.setattr(cli, "_running_ui_version", lambda cfg: "2.3.1")
- monkeypatch.setattr(cli, "_launched_by_legacy_delayed_restart_helper", lambda: False)
-
- assert cli._should_restart_for_upgrade_compat(config) is True
-
-
-def test_upgrade_compat_does_not_restart_when_running_ui_version_matches(monkeypatch):
- config = SimpleNamespace(ui=SimpleNamespace(setup_host="127.0.0.1", setup_port=5123))
-
- monkeypatch.setattr(cli, "__version__", "2.3.2")
- monkeypatch.setattr(cli, "_running_ui_version", lambda cfg: "2.3.2")
- monkeypatch.setattr(cli, "_launched_by_legacy_delayed_restart_helper", lambda: False)
-
- assert cli._should_restart_for_upgrade_compat(config) is False
-
-
-def test_upgrade_compat_restarts_for_legacy_helper(monkeypatch):
- config = SimpleNamespace(ui=SimpleNamespace(setup_host="127.0.0.1", setup_port=5123))
-
- monkeypatch.setattr(cli, "_running_ui_version", lambda cfg: None)
- monkeypatch.setattr(cli, "_launched_by_legacy_delayed_restart_helper", lambda: True)
-
- assert cli._should_restart_for_upgrade_compat(config) is True
-
-
-def test_ui_local_url_uses_loopback_for_wildcard_bind():
- assert cli._ui_local_url("0.0.0.0", 5123, "/version") == "http://127.0.0.1:5123/version"
- assert cli._ui_local_url("::", 5123, "/version") == "http://[::1]:5123/version"
-
-
def test_restart_parser_accepts_delay_seconds():
parser = cli.build_parser()
args = parser.parse_args(["restart", "--delay-seconds", "60"])
diff --git a/vibe/cli.py b/vibe/cli.py
index 5899e52da..8d246b412 100644
--- a/vibe/cli.py
+++ b/vibe/cli.py
@@ -10,8 +10,6 @@ import signal
import subprocess
import sys
import time
-import urllib.error
-import urllib.request
from datetime import datetime, timezone
from pathlib import Path
from textwrap import dedent
@@ -1811,7 +1809,10 @@ def _doctor():
return result
-def _cmd_start_with_config(config) -> int:
+def cmd_start():
+ paths.ensure_data_dirs()
+ config = _ensure_config()
+
has_configured_platform_credentials = getattr(config, "has_configured_platform_credentials", None)
if callable(has_configured_platform_credentials):
ready = bool(has_configured_platform_credentials())
@@ -1849,74 +1850,9 @@ def _cmd_start_with_config(config) -> int:
return 0
-def cmd_start():
- paths.ensure_data_dirs()
- config = _ensure_config()
- return _cmd_start_with_config(config)
-
-
-def _ui_local_url(host: str, port: int, path: str) -> str:
- local_host = (host or "127.0.0.1").strip()
- if local_host in {"0.0.0.0", ""}:
- local_host = "127.0.0.1"
- elif local_host in {"::", "::0"}:
- local_host = "[::1]"
- elif local_host.startswith("[") and local_host.endswith("]"):
- pass
- elif ":" in local_host:
- local_host = f"[{local_host}]"
- normalized_path = path if path.startswith("/") else f"/{path}"
- return f"http://{local_host}:{port}{normalized_path}"
-
-
-def _running_ui_version(config, timeout: float = 0.75) -> str | None:
- url = _ui_local_url(config.ui.setup_host, config.ui.setup_port, "/version")
- try:
- with urllib.request.urlopen(url, timeout=timeout) as response:
- if response.status != 200:
- return None
- payload = json.loads(response.read().decode("utf-8"))
- except (OSError, TimeoutError, urllib.error.URLError, json.JSONDecodeError):
- return None
- current = payload.get("current") if isinstance(payload, dict) else None
- return current if isinstance(current, str) and current else None
-
-
-def _launched_by_legacy_delayed_restart_helper() -> bool:
- parent_command = runtime.get_process_command(os.getppid())
- if not parent_command:
- return False
- return (
- "subprocess.Popen" in parent_command
- and "time.sleep(" in parent_command
- and "stdout=subprocess.DEVNULL" in parent_command
- and "stderr=subprocess.DEVNULL" in parent_command
- )
-
-
-def _should_restart_for_upgrade_compat(config) -> bool:
- running_version = _running_ui_version(config)
- if running_version and running_version != __version__:
- logger.info(
- "Bare vibe detected running UI version %s differs from installed version %s; restarting",
- running_version,
- __version__,
- )
- return True
- if _launched_by_legacy_delayed_restart_helper():
- logger.info("Bare vibe launched by legacy delayed restart helper; restarting")
- return True
- return False
-
-
def cmd_vibe():
- """Bare `vibe` starts by default, with a narrow upgrade compatibility restart."""
- paths.ensure_data_dirs()
- config = _ensure_config()
- if _should_restart_for_upgrade_compat(config):
- return _cmd_restart_with_delay(0.0)
- return _cmd_start_with_config(config)
-
+ """Compatibility default: bare `vibe` restarts during the migration window."""
+ return _cmd_restart_with_delay(0.0)
def _stop_opencode_server():