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
Make bare vibe start idempotent
cyhe11ee43a880f
diff --git a/tests/test_cli_setup_status.py b/tests/test_cli_setup_status.pyindex 6c9610a23..2728ee876 100644--- a/tests/test_cli_setup_status.py+++ b/tests/test_cli_setup_status.py@@ -20,8 +20,8 @@ def test_cmd_vibe_marks_setup_when_no_enabled_platform_has_credentials(capsys) -with (patch("vibe.cli.paths.ensure_data_dirs"),patch("vibe.cli._ensure_config", return_value=config),- patch("vibe.cli.runtime.stop_service"),- patch("vibe.cli.runtime.stop_ui"),+ patch("vibe.cli.runtime.stop_service") as stop_service,+ patch("vibe.cli.runtime.stop_ui") as stop_ui,patch("vibe.cli.runtime.start_service", return_value=101),patch("vibe.cli.runtime.start_ui", return_value=202),patch("vibe.cli.runtime.write_status"),@@ -29,6 +29,8 @@ def test_cmd_vibe_marks_setup_when_no_enabled_platform_has_credentials(capsys) -):cli.cmd_vibe()+ stop_service.assert_not_called()+ stop_ui.assert_not_called()write_status.assert_called_once_with("setup", "missing platform credentials")output = capsys.readouterr().outassert "Run: vibe remote" in output@@ -41,8 +43,8 @@ def test_cmd_vibe_marks_starting_when_non_slack_platform_is_configured() -> Nonewith (patch("vibe.cli.paths.ensure_data_dirs"),patch("vibe.cli._ensure_config", return_value=config),- patch("vibe.cli.runtime.stop_service"),- patch("vibe.cli.runtime.stop_ui"),+ patch("vibe.cli.runtime.stop_service") as stop_service,+ patch("vibe.cli.runtime.stop_ui") as stop_ui,patch("vibe.cli.runtime.start_service", return_value=101),patch("vibe.cli.runtime.start_ui", return_value=202),patch("vibe.cli.runtime.write_status"),@@ -50,4 +52,6 @@ def test_cmd_vibe_marks_starting_when_non_slack_platform_is_configured() -> None):cli.cmd_vibe()+ stop_service.assert_not_called()+ stop_ui.assert_not_called()write_status.assert_called_once_with("starting")diff --git a/tests/test_vibe_cli.py b/tests/test_vibe_cli.pyindex e2fa5b37a..8e550c6da 100644--- a/tests/test_vibe_cli.py+++ b/tests/test_vibe_cli.py@@ -411,6 +411,21 @@ def test_stop_pid_writes_shutdown_intent_before_sigterm(monkeypatch):assert calls[1] == (12345, signal.SIGTERM)+def test_start_ui_reuses_existing_live_pid(tmp_path, monkeypatch):+ monkeypatch.setattr(paths, "get_vibe_remote_dir", lambda: tmp_path / ".vibe_remote")+ runtime.ensure_dirs()+ paths.get_runtime_ui_pid_path().write_text("12345", encoding="utf-8")++ monkeypatch.setattr(runtime, "pid_alive", lambda pid: pid == 12345)++ def fail_spawn(*_args, **_kwargs):+ raise AssertionError("start_ui should not spawn when an existing UI process is alive")++ monkeypatch.setattr(runtime, "spawn_background", fail_spawn)++ assert runtime.start_ui("127.0.0.1", 5123) == 12345++def test_shutdown_intent_round_trip(tmp_path, monkeypatch):monkeypatch.setattr(paths, "get_vibe_remote_dir", lambda: tmp_path / ".vibe_remote")runtime.ensure_dirs()diff --git a/vibe/cli.py b/vibe/cli.pyindex 66949d572..6f2b0fca1 100644--- a/vibe/cli.py+++ b/vibe/cli.py@@ -1813,10 +1813,6 @@ def cmd_vibe():paths.ensure_data_dirs()config = _ensure_config()- # Always restart both processes- runtime.stop_service()- runtime.stop_ui()-has_configured_platform_credentials = getattr(config, "has_configured_platform_credentials", None)if callable(has_configured_platform_credentials):ready = bool(has_configured_platform_credentials())diff --git a/vibe/runtime.py b/vibe/runtime.pyindex 772d7bf7d..fa0e303d9 100644--- a/vibe/runtime.py+++ b/vibe/runtime.py@@ -528,10 +528,20 @@ def effective_ui_bind_host(config: V2Config, requested_host: str | None = None)def start_ui(host, port):+ pid_path = paths.get_runtime_ui_pid_path()+ if pid_path.exists():+ try:+ existing_pid = int(pid_path.read_text(encoding="utf-8").strip())+ except Exception:+ existing_pid = 0+ if existing_pid and pid_alive(existing_pid):+ return existing_pid+ pid_path.unlink(missing_ok=True)+command = "from vibe.ui_server import run_ui_server; run_ui_server('{}', {})".format(host, port)return spawn_background([sys.executable, "-c", command],- paths.get_runtime_ui_pid_path(),+ pid_path,"ui_stdout.log","ui_stderr.log",)