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): bridge v3.0.13 generation installs (#1783)
Call Whiteb4760d9b6681
diff --git a/install.ps1 b/install.ps1index 883ffac05..14480df34 100644--- a/install.ps1+++ b/install.ps1@@ -415,7 +415,10 @@ function Invoke-UvToolInstallAttempt {}$runtimeHome = Resolve-InstallPath $runtimeHome$generationRoot = Join-Path (Join-Path $runtimeHome "runtime\install-generations") ([Guid]::NewGuid().ToString("N"))- $generationTools = Join-Path $generationRoot "tools"+ # 3.0.13 identifies uv-managed installs from the executable's /uv/tools/+ # path. Keep that released contract in every generation so the old binary+ # can hand the first upgrade to uv instead of falling through to pip.+ $generationTools = Join-Path $generationRoot "uv\tools"$generationBin = Join-Path $generationRoot "bin"$stableBin = Get-StableBinDirectory$stableLauncher = Join-Path $stableBin "vibe.exe"diff --git a/install.sh b/install.shindex 5d607f39d..d3798c26c 100755--- a/install.sh+++ b/install.sh@@ -421,7 +421,10 @@ uv_tool_install() {# durable generation and activate its launcher only after uv exits# successfully, so an interrupted copy cannot damage the active install.local generation_root="$AVIBE_RUNTIME_HOME/runtime/install-generations/$(date +%s)-$$-${RANDOM}"- local generation_tools="$generation_root/tools"+ # 3.0.13 identifies uv-managed installs from the executable's /uv/tools/+ # path. Keep that released contract in every generation so the old binary+ # can hand the first upgrade to uv instead of falling through to pip.+ local generation_tools="$generation_root/uv/tools"local generation_bin="$generation_root/bin"local stable_bin_dir="${VIBE_TOOL_BIN_DIR:-$HOME/.local/bin}"local previous_target=""diff --git a/tests/e2e/test_upgrade_command.py b/tests/e2e/test_upgrade_command.pyindex e03a98e38..8c3cc2d41 100644--- a/tests/e2e/test_upgrade_command.py+++ b/tests/e2e/test_upgrade_command.py@@ -1,13 +1,15 @@-"""Docker smoke test for release-style upgrade flow using a built wheel."""+"""Docker regression for upgrading the released 3.0.13 wheel to a built wheel."""from __future__ import annotations+import hashlibimport jsonimport osimport shutilimport subprocessimport sysimport tempfile+import urllib.requestfrom pathlib import Pathimport pytest@@ -15,7 +17,11 @@ import pytestREPO_ROOT = Path(__file__).resolve().parents[2]BASE_IMAGE = os.environ.get("VIBE_UPGRADE_TEST_IMAGE", "debian:trixie-slim")-INITIAL_RELEASE_VERSION = "9998.0.0"+INITIAL_RELEASE_VERSION = "3.0.13"+INITIAL_RELEASE_WHEEL_URL = (+ "https://github.com/avibe-bot/avibe/releases/download/v3.0.13/avibe_os-3.0.13-py3-none-any.whl"+)+INITIAL_RELEASE_WHEEL_SHA256 = "994adbfd23228ea387f0479db8a4efe0ef121847bd04efa550486203a6b03542"TEST_RELEASE_VERSION = "9999.0.0"@@ -48,14 +54,29 @@ def _build_test_wheel(fixtures_dir: Path, version: str) -> Path:return wheel_path+def _released_initial_wheel(fixtures_dir: Path) -> Path:+ wheel_path = fixtures_dir / f"avibe_os-{INITIAL_RELEASE_VERSION}-py3-none-any.whl"+ local_wheel = os.environ.get("VIBE_UPGRADE_INITIAL_WHEEL")+ if local_wheel:+ shutil.copy2(local_wheel, wheel_path)+ else:+ request = urllib.request.Request(INITIAL_RELEASE_WHEEL_URL, headers={"User-Agent": "avibe-upgrade-test"})+ with urllib.request.urlopen(request, timeout=120) as response, wheel_path.open("wb") as destination:+ shutil.copyfileobj(response, destination)++ digest = hashlib.sha256(wheel_path.read_bytes()).hexdigest()+ assert digest == INITIAL_RELEASE_WHEEL_SHA256, f"Unexpected {INITIAL_RELEASE_VERSION} wheel digest: {digest}"+ return wheel_path++@pytest.mark.integration-def test_upgrade_command_uses_built_release_artifact():+def test_upgrade_command_bridges_released_3_0_13_generation():if not _docker_available():pytest.skip("Docker is not available")with tempfile.TemporaryDirectory(prefix="vibe-upgrade-fixtures-") as tmpdir:fixtures_dir = Path(tmpdir)- initial_wheel_path = _build_test_wheel(fixtures_dir, INITIAL_RELEASE_VERSION)+ initial_wheel_path = _released_initial_wheel(fixtures_dir)wheel_path = _build_test_wheel(fixtures_dir, TEST_RELEASE_VERSION)metadata_path = fixtures_dir / "metadata.json"@@ -68,10 +89,13 @@ def test_upgrade_command_uses_built_release_artifact():"apt-get install -y --no-install-recommends curl ca-certificates bash procps >/dev/null","curl -LsSf https://astral.sh/uv/install.sh | sh",'export PATH="$HOME/.local/bin:$PATH"',- f"uv tool install /fixtures/{initial_wheel_path.name} --force",- 'ln -sf "$HOME/.local/bin/vibe" /usr/local/bin/vibe',- 'export PATH="/usr/local/bin:/usr/bin:/bin"',+ "VIBE_INSTALL_SKIP_NODE=1 VIBE_INSTALL_SKIP_SHOW_RUNTIME=1 "+ f"AVIBE_INSTALL_PACKAGE_SPEC=/fixtures/{initial_wheel_path.name} bash /work/install.sh",+ 'export PATH="$HOME/.local/bin:/usr/local/bin:/usr/bin:/bin"',+ 'initial_vibe="$(readlink -f "$HOME/.local/bin/vibe")"',+ 'printf "%s\\n" "$initial_vibe" | grep "/uv/tools/"',"vibe version",+ 'printf "preserved\\n" > "$HOME/.avibe/upgrade-state-marker"',"AVIBE_UPDATE_METADATA_URL=file:///fixtures/metadata.json "f"VIBE_INSTALL_SKIP_SHOW_RUNTIME=1 AVIBE_UPGRADE_PACKAGE_SPEC=/fixtures/{wheel_path.name} vibe check-update","AVIBE_UPDATE_METADATA_URL=file:///fixtures/metadata.json "@@ -79,6 +103,8 @@ def test_upgrade_command_uses_built_release_artifact():"hash -r",'printf "launcher=%s\n" "$(command -v vibe)"',"vibe version",+ 'test -x "$initial_vibe"',+ 'test "$(cat "$HOME/.avibe/upgrade-state-marker")" = "preserved"',"AVIBE_UPDATE_METADATA_URL=file:///fixtures/metadata.json vibe check-update","vibe","sleep 2",@@ -116,7 +142,7 @@ def test_upgrade_command_uses_built_release_artifact():assert f"avibe-os {INITIAL_RELEASE_VERSION}" in result.stdoutassert "New version available: 9999.0.0" in result.stdoutassert "Upgrade successful!" in result.stdout- assert "launcher=/usr/local/bin/vibe" in result.stdout+ assert "launcher=/root/.local/bin/vibe" in result.stdoutassert f"avibe-os {TEST_RELEASE_VERSION}" in result.stdoutassert "You are using the latest version." in result.stdoutassert '"running": true' in result.stdoutdiff --git a/tests/test_install_script.py b/tests/test_install_script.pyindex 263f8b64a..7a4b09e5f 100644--- a/tests/test_install_script.py+++ b/tests/test_install_script.py@@ -36,6 +36,7 @@ def _write_fake_uv(path: Path, uv_log: Path) -> None:set -euo pipefailprintf '%s' "${{UV_TOOL_BIN_DIR:-}}" > "{uv_log}"+ printf '%s' "${{UV_TOOL_DIR:-}}" > "{uv_log}.tools"if [ -n "${{AVIBE_PAIRING_KEY:-}}" ]; thenprintf 'uv leaked key\\n' >> "${{VIBE_TEST_CALL_LOG:-/dev/null}}"@@ -257,10 +258,14 @@ def _vibe_version(env: dict[str, str], *, cwd: Path = REPO_ROOT) -> subprocess.Cdef _assert_staged_uv_bin(uv_log: Path, home_dir: Path) -> None:- staged = Path(uv_log.read_text(encoding="utf-8"))- assert staged.is_absolute()- assert staged.name == "bin"- assert staged.parent.parent == home_dir / ".avibe" / "runtime" / "install-generations"+ staged_bin = Path(uv_log.read_text(encoding="utf-8"))+ staged_tools = Path(f"{uv_log}.tools").read_text(encoding="utf-8")+ generation_root = home_dir / ".avibe" / "runtime" / "install-generations"++ assert staged_bin.is_absolute()+ assert staged_bin.name == "bin"+ assert staged_bin.parent.parent == generation_root+ assert Path(staged_tools) == staged_bin.parent / "uv" / "tools"def test_install_script_keeps_vibe_available_on_current_path(tmp_path):@@ -413,6 +418,50 @@ def test_install_script_uses_the_current_owner_for_a_legacy_candidate(tmp_path):assert (path_dir / "vibe").resolve() != first_owner+def test_install_script_recovers_an_existing_3_0_13_generation(tmp_path):+ home_dir = tmp_path / "home"+ home_dir.mkdir()+ path_dir = tmp_path / "path-bin"+ path_dir.mkdir()+ uv_log = tmp_path / "uv-tool-bin-dir.txt"+ _write_fake_uv(path_dir / "uv", uv_log)++ old_generation = home_dir / ".avibe" / "runtime" / "install-generations" / "3.0.13"+ old_vibe = old_generation / "tools" / "avibe-os" / "bin" / "vibe"+ old_vibe.parent.mkdir(parents=True)+ _write_executable(+ old_vibe,+ """\+ #!/usr/bin/env bash+ if [ "${1:-}" = "version" ]; then+ echo "avibe-os 3.0.13"+ exit 0+ fi+ exit 2+ """,+ )+ generation_launcher = old_generation / "bin" / "vibe"+ generation_launcher.parent.mkdir(parents=True)+ generation_launcher.symlink_to(old_vibe)+ stable_launcher = path_dir / "vibe"+ stable_launcher.symlink_to(generation_launcher)+ state_marker = home_dir / ".avibe" / "state-preserved"+ state_marker.write_text("preserved\n", encoding="utf-8")++ env = os.environ.copy()+ env["HOME"] = str(home_dir)+ env["PATH"] = os.pathsep.join([str(path_dir), "/usr/bin", "/bin"])+ env["VIBE_TEST_REQUIRE_SOURCE_GENERATION"] = "1"++ result = _install(env)++ assert result.returncode == 0, result.stdout + result.stderr+ assert stable_launcher.resolve() != old_vibe+ assert old_vibe.exists()+ assert state_marker.read_text(encoding="utf-8") == "preserved\n"+ _assert_staged_uv_bin(uv_log, home_dir)++def test_install_script_keeps_active_launcher_when_uv_install_fails(tmp_path):home_dir = tmp_path / "home"home_dir.mkdir()@@ -674,6 +723,7 @@ def test_windows_installer_honors_configured_tool_bin_and_cross_volume_copy_fallassert "function Get-StableBinDirectory" in powershellassert "function Resolve-InstallPath" in powershellassert "function Get-LauncherState" in powershell+ assert '$generationTools = Join-Path $generationRoot "uv\\tools"' in powershellassert "Get-Content -LiteralPath $marker" not in powershellassert "function Get-GenerationPath" not in powershellassert '$expanded.StartsWith("~\\")' in powershelldiff --git a/tests/test_upgrade_flow.py b/tests/test_upgrade_flow.pyindex 9bcba74f5..cbf271ab5 100644--- a/tests/test_upgrade_flow.py+++ b/tests/test_upgrade_flow.py@@ -131,8 +131,10 @@ def test_build_upgrade_plan_stages_uv_install_for_a_stable_launcher(monkeypatch,assert plan.activation is not Noneassert plan.activation.launcher == launcherassert plan.env is not None- assert plan.env["UV_TOOL_DIR"].startswith(str(tmp_path / "home" / "runtime" / "install-generations"))- assert plan.env["UV_TOOL_BIN_DIR"].startswith(str(tmp_path / "home" / "runtime" / "install-generations"))+ tool_dir = Path(plan.env["UV_TOOL_DIR"])+ bin_dir = Path(plan.env["UV_TOOL_BIN_DIR"])+ assert tool_dir == bin_dir.parent / "uv" / "tools"+ assert bin_dir.parent.parent == tmp_path / "home" / "runtime" / "install-generations"def test_build_upgrade_plan_refuses_uv_install_without_activation_point(monkeypatch):@@ -825,14 +827,15 @@ def test_restart_state_with_a_non_object_shape_is_not_pending(monkeypatch, tmp_passert not restart_is_pending()-def test_doctor_resolves_hardlinked_atomic_generation(monkeypatch, tmp_path):[email protected]("tools_path", [Path("uv/tools"), Path("tools")], ids=["bridged", "legacy"])+def test_doctor_resolves_hardlinked_atomic_generation(monkeypatch, tmp_path, tools_path):from vibe import upgraderoot = tmp_path / "home" / "runtime" / "install-generations"generation = root / "old"launcher_source = generation / "bin" / "vibe.exe"launcher = tmp_path / ".local" / "bin" / "vibe.exe"- site_packages = generation / "tools" / "avibe-os" / "lib" / "python3.12" / "site-packages"+ site_packages = generation / tools_path / "avibe-os" / "lib" / "python3.12" / "site-packages"launcher_source.parent.mkdir(parents=True)site_packages.mkdir(parents=True)launcher.parent.mkdir(parents=True)diff --git a/vibe/cli.py b/vibe/cli.pyindex dee077add..2a1b2b0e3 100644--- a/vibe/cli.py+++ b/vibe/cli.py@@ -12112,8 +12112,9 @@ def _uv_tool_site_packages_for_vibe(vibe_path: Path) -> list[Path]:generation_root = atomic_uv_install_root().expanduser().resolve()generation = _launcher_generation(vibe_path, generation_root)if generation:- for package_name in UV_TOOL_PACKAGE_NAMES:- add_tool_root(generation / "tools" / package_name)+ for tools_dir in (generation / "uv" / "tools", generation / "tools"):+ for package_name in UV_TOOL_PACKAGE_NAMES:+ add_tool_root(tools_dir / package_name)parts = vibe_path.partstry:diff --git a/vibe/upgrade.py b/vibe/upgrade.pyindex 20c42a634..35731ac4b 100644--- a/vibe/upgrade.py+++ b/vibe/upgrade.py@@ -217,7 +217,10 @@ def launcher_is_current_process(launcher: Path | str) -> bool:def _staged_uv_environment(vibe_path: str | None) -> tuple[Path, Path, AtomicActivation | None]:generation = atomic_uv_install_root() / uuid4().hex- tools_dir = generation / "tools"+ # 3.0.13 only recognizes uv installs whose interpreter path contains+ # /uv/tools/. Generations must retain that released handoff contract so an+ # immutable 3.0.13 process can choose uv for its first product upgrade.+ tools_dir = generation / "uv" / "tools"bin_dir = generation / "bin"if not vibe_path:return tools_dir, bin_dir, None@@ -245,7 +248,7 @@ def _candidate_python(candidate_launcher: Path) -> Path | None:with contextlib.suppress(OSError, RuntimeError, ValueError):generation = _generation_for_path(candidate_launcher, atomic_uv_install_root())if generation is not None:- roots.append(generation / "tools")+ roots.extend((generation / "uv" / "tools", generation / "tools"))names = ("python.exe", "python3.exe", "python3", "python") if os.name == "nt" else ("python3", "python")for root in roots:for name in names: