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(upgrade): centralize restart invocation
cyh005b320d7067
diff --git a/tests/test_upgrade_flow.py b/tests/test_upgrade_flow.pyindex 53f655d93..7e9338dec 100644--- a/tests/test_upgrade_flow.py+++ b/tests/test_upgrade_flow.py@@ -17,6 +17,8 @@ from vibe.upgrade import (get_latest_version_info,get_restart_command,get_restart_environment,+ get_restart_invocation_command,+ get_restart_shell_command,get_running_vibe_path,get_safe_cwd,)@@ -268,6 +270,27 @@ def test_get_restart_command_falls_back_to_python_module(monkeypatch):assert command == ["/usr/bin/python3", "-c", "from vibe.cli import main; main()"]+def test_restart_invocation_command_adds_explicit_restart(monkeypatch, tmp_path):+ vibe_path = tmp_path / "bin" / "vibe"+ vibe_path.parent.mkdir()+ vibe_path.write_text("#!/bin/sh\n", encoding="utf-8")+ vibe_path.chmod(0o755)+ monkeypatch.setenv("VIBE_CURRENT_EXECUTABLE", str(vibe_path))++ command = get_restart_invocation_command()++ assert command == [str(vibe_path), "restart"]+++def test_restart_shell_command_adds_explicit_restart(monkeypatch):+ monkeypatch.delenv("VIBE_CURRENT_EXECUTABLE", raising=False)+ monkeypatch.setattr("vibe.upgrade.shutil.which", lambda *args, **kwargs: None)++ command = get_restart_shell_command(python_executable="/usr/bin/python3", argv0="python")++ assert command == "/usr/bin/python3 -c 'from vibe.cli import main; main()' restart"++def test_get_restart_environment_adds_source_root_for_python_fallback(monkeypatch):monkeypatch.delenv("VIBE_CURRENT_EXECUTABLE", raising=False)monkeypatch.setattr("vibe.upgrade.shutil.which", lambda *args, **kwargs: None)@@ -301,7 +324,7 @@ def test_do_upgrade_uses_upgrade_plan_env_and_restarts(monkeypatch):monkeypatch.setattr(api, "build_upgrade_plan", lambda **kwargs: plan)monkeypatch.setattr(api, "get_running_vibe_path", lambda: "/custom/bin/vibe")- monkeypatch.setattr(api, "get_restart_command", lambda **kwargs: ["/custom/bin/vibe"])+ monkeypatch.setattr(api, "get_restart_invocation_command", lambda **kwargs: ["/custom/bin/vibe", "restart"])monkeypatch.setattr(api, "get_restart_environment", lambda **kwargs: None)monkeypatch.setattr(api, "_delayed_restart_helper_command", lambda: ["/usr/bin/python3"])diff --git a/tests/test_vibe_cli.py b/tests/test_vibe_cli.pyindex e278787f3..ee70b7ff1 100644--- a/tests/test_vibe_cli.py+++ b/tests/test_vibe_cli.py@@ -109,7 +109,7 @@ def test_cmd_restart_schedules_delayed_restart(monkeypatch, capsys):start_called = []monkeypatch.setattr(cli, "cache_running_vibe_path", lambda: "/usr/local/bin/vibe")- monkeypatch.setattr(cli, "get_restart_command", lambda vibe_path=None: [vibe_path or "vibe"])+ monkeypatch.setattr(cli, "get_restart_invocation_command", lambda vibe_path=None: [vibe_path or "vibe", "restart"])monkeypatch.setattr(cli, "get_restart_environment", lambda vibe_path=None: None)monkeypatch.setattr(cli, "get_safe_cwd", lambda: "/tmp")monkeypatch.setattr(@@ -143,8 +143,8 @@ def test_cmd_restart_schedules_delayed_restart_with_import_env(monkeypatch):monkeypatch.setattr(cli, "cache_running_vibe_path", lambda: None)monkeypatch.setattr(cli,- "get_restart_command",- lambda vibe_path=None: [sys.executable, "-c", "from vibe.cli import main; main()"],+ "get_restart_invocation_command",+ lambda vibe_path=None: [sys.executable, "-c", "from vibe.cli import main; main()", "restart"],)monkeypatch.setattr(cli, "get_restart_environment", lambda vibe_path=None: {"PYTHONPATH": "/repo"})monkeypatch.setattr(cli, "get_safe_cwd", lambda: "/tmp")diff --git a/vibe/api.py b/vibe/api.pyindex 788fa9ea9..d557c6e62 100644--- a/vibe/api.py+++ b/vibe/api.py@@ -33,8 +33,8 @@ from vibe.opencode_config import (from vibe.upgrade import (build_upgrade_plan,get_latest_version_info,- get_restart_command,get_restart_environment,+ get_restart_invocation_command,get_running_vibe_path,get_safe_cwd,)@@ -1009,9 +1009,8 @@ def do_upgrade(auto_restart: bool = True) -> dict:if result.returncode == 0:restarting = Falseif auto_restart:- restart_command = [*get_restart_command(vibe_path=current_vibe_path), "restart"]_spawn_delayed_restart(- restart_command,+ get_restart_invocation_command(vibe_path=current_vibe_path),safe_cwd,env=get_restart_environment(vibe_path=current_vibe_path),)diff --git a/vibe/cli.py b/vibe/cli.pyindex 6f2b0fca1..805b7ba08 100644--- a/vibe/cli.py+++ b/vibe/cli.py@@ -43,8 +43,8 @@ from vibe.upgrade import (build_upgrade_plan,cache_running_vibe_path,get_latest_version_info,- get_restart_command,get_restart_environment,+ get_restart_invocation_command,get_safe_cwd,)@@ -2322,9 +2322,8 @@ def _format_restart_delay(delay_seconds: float) -> str:def _schedule_delayed_restart(delay_seconds: float) -> int:current_vibe_path = cache_running_vibe_path()- restart_command = [*get_restart_command(vibe_path=current_vibe_path), "restart"]api._spawn_delayed_restart(- restart_command,+ get_restart_invocation_command(vibe_path=current_vibe_path),get_safe_cwd(),delay_seconds=delay_seconds,env=get_restart_environment(vibe_path=current_vibe_path),diff --git a/vibe/upgrade.py b/vibe/upgrade.pyindex 35e5fdda0..f40669ab4 100644--- a/vibe/upgrade.py+++ b/vibe/upgrade.py@@ -148,6 +148,24 @@ def get_restart_command(return [python_executable or sys.executable, "-c", "from vibe.cli import main; main()"]+def get_restart_invocation_command(+ *,+ vibe_path: str | None = None,+ python_executable: str | None = None,+ argv0: str | None = None,+ search_path: str | None = None,+) -> list[str]:+ return [+ *get_restart_command(+ vibe_path=vibe_path,+ python_executable=python_executable,+ argv0=argv0,+ search_path=search_path,+ ),+ "restart",+ ]++def _get_source_checkout_root() -> str | None:source_root = Path(__file__).resolve().parent.parentif not source_root.is_dir():@@ -211,14 +229,13 @@ def get_restart_shell_command(argv0: str | None = None,search_path: str | None = None,) -> str:- return shlex.join(- get_restart_command(- vibe_path=vibe_path,- python_executable=python_executable,- argv0=argv0,- search_path=search_path,- )+ command = get_restart_invocation_command(+ vibe_path=vibe_path,+ python_executable=python_executable,+ argv0=argv0,+ search_path=search_path,)+ return shlex.join(command)def get_update_metadata_url() -> str: