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.

fix(ripgrep): install the managed ripgrep at service startup (#2440)

Call White3cf15092ae9d
diff --git a/tests/test_file_browser_backend.py b/tests/test_file_browser_backend.py
index 4190b40d3..c9d421ed5 100644
--- a/tests/test_file_browser_backend.py
+++ b/tests/test_file_browser_backend.py
@@ -2506,6 +2506,7 @@ def test_startup_reconcile_skips_tmux_when_env_set(monkeypatch):
monkeypatch.setattr(api, "ensure_askill_installed", lambda force=False: {"ok": True, "installed": True})
monkeypatch.setattr(api, "ensure_avault_installed", lambda force=False: {"ok": True, "installed": True})
monkeypatch.setenv("VIBE_UI_ENABLE_TERMINAL", "1")
+ monkeypatch.setenv("VIBE_RIPGREP_OFFLINE", "1")
import core.show_runtime as srt_mod
import core.tmux_runtime as tmux_mod
diff --git a/tests/test_local_deps.py b/tests/test_local_deps.py
index 87241aa98..ad89d0427 100644
--- a/tests/test_local_deps.py
+++ b/tests/test_local_deps.py
@@ -1739,6 +1739,7 @@ def test_dependencies_status_node_unsupported_not_ready(monkeypatch):
def test_reconcile_startup_dependencies_reports_runtime_install_failure_without_node(monkeypatch):
+ monkeypatch.setenv("VIBE_RIPGREP_OFFLINE", "1")
monkeypatch.setattr(api, "ensure_askill_installed", lambda force=False: {"ok": True, "installed": True})
monkeypatch.setattr(api, "ensure_avault_installed", lambda force=False: {"ok": True, "installed": True})
monkeypatch.setattr(
@@ -2300,6 +2301,7 @@ def test_dependencies_status_keeps_node_ready_for_explicit_runtime_config_failur
def test_reconcile_startup_dependencies_uses_automatic_runtime_admission(monkeypatch):
"""MH-RUNTIME-008: startup converges CPA without changing run intent."""
+ monkeypatch.setenv("VIBE_RIPGREP_OFFLINE", "1")
askill_calls = []
avault_calls = []
model_hub_calls = []
diff --git a/tests/test_ripgrep_runtime.py b/tests/test_ripgrep_runtime.py
index 66f24aaf0..95866986e 100644
--- a/tests/test_ripgrep_runtime.py
+++ b/tests/test_ripgrep_runtime.py
@@ -17,8 +17,8 @@ from core.ripgrep_runtime import RipgrepRuntimeManager, prepend_managed_ripgrep_
UPSTREAM = "https://github.com/BurntSushi/ripgrep/releases/download"
-def install_test_ripgrep(tmp_path: Path, monkeypatch: pytest.MonkeyPatch, *, tamper: str | None = None) -> dict:
- """Install a stand-in ``rg`` through a test manifest the default manager also reads."""
+def pin_test_ripgrep(tmp_path: Path, monkeypatch: pytest.MonkeyPatch, *, tamper: str | None = None) -> None:
+ """Pin a stand-in ``rg`` archive in a test manifest the default manager also reads."""
stem = "ripgrep-15.2.0-test"
binary = tmp_path / "archive-root" / stem / "rg"
@@ -53,6 +53,12 @@ def install_test_ripgrep(tmp_path: Path, monkeypatch: pytest.MonkeyPatch, *, tam
)
# The runtime installs under the test's own AVIBE_HOME (conftest).
monkeypatch.setenv("VIBE_RIPGREP_MANIFEST_PATH", str(manifest))
+
+
+def install_test_ripgrep(tmp_path: Path, monkeypatch: pytest.MonkeyPatch, *, tamper: str | None = None) -> dict:
+ """Install a stand-in ``rg`` through a test manifest the default manager also reads."""
+
+ pin_test_ripgrep(tmp_path, monkeypatch, tamper=tamper)
return RipgrepRuntimeManager().ensure()
@@ -140,3 +146,41 @@ def test_agent_path_is_unchanged_without_a_verified_managed_rg(
assert prepend_managed_ripgrep_to_path(env, base_env={}) is False
assert env == {"PATH": str(without_rg)}
+
+
[email protected]("tamper", (None, "sha256"))
+def test_startup_reconcile_installs_ripgrep_without_failing_startup(
+ tmp_path: Path, monkeypatch: pytest.MonkeyPatch, tamper: str | None
+) -> None:
+ """The desktop Runtime never runs `vibe runtime prepare`; service startup must install rg instead."""
+
+ import core.show_runtime as show_runtime
+ from vibe import api
+
+ for ensure in ("ensure_askill_installed", "ensure_avault_installed", "ensure_model_hub_engine_installed"):
+ monkeypatch.setattr(api, ensure, lambda force=False: {"ok": True, "installed": True})
+
+ class _ReadyShowRuntime:
+ def status(self, *, offline=False):
+ return {"node_available": True, "node_supported": True, "node_version": "22.12.0"}
+
+ def prepare(self, *, force=False, automatic=False):
+ return {"policy": {"state": "allowed"}, "install": {"state": "installed"}}
+
+ monkeypatch.setattr(show_runtime, "get_show_runtime_manager", lambda: _ReadyShowRuntime())
+ monkeypatch.setenv("VIBE_INSTALL_SKIP_TMUX", "1")
+ pin_test_ripgrep(tmp_path, monkeypatch, tamper=tamper)
+ assert RipgrepRuntimeManager().resolve_binary() is None
+
+ out = api.reconcile_startup_dependencies()
+
+ resolved = RipgrepRuntimeManager().resolve_binary()
+ if tamper is None:
+ assert out["ripgrep"]["ok"] is True
+ assert resolved is not None and resolved == Path(out["ripgrep"]["path"])
+ else:
+ assert out["ripgrep"]["ok"] is False
+ assert out["ripgrep"]["reason"] == "ripgrep_archive_checksum_mismatch"
+ assert resolved is None
+ # A missing ripgrep only changes Vibey's prompt line, so it never fails startup.
+ assert out["ok"] is True
diff --git a/vibe/api.py b/vibe/api.py
index 1daf02bd2..9526ab936 100644
--- a/vibe/api.py
+++ b/vibe/api.py
@@ -9472,6 +9472,7 @@ def reconcile_startup_dependencies() -> dict:
"model_hub_engine": {"ok": False, "status": "unknown"},
"show_runtime": {"ok": False, "status": "unknown"},
"tmux": {"ok": False, "status": "unknown"},
+ "ripgrep": {"ok": False, "status": "unknown"},
}
try:
_set_startup_dependency_reconciling("askill", True)
@@ -9569,6 +9570,18 @@ def reconcile_startup_dependencies() -> dict:
finally:
_set_startup_dependency_reconciling("tmux", False)
+ # Agent commands search with the managed ripgrep. `vibe runtime prepare`
+ # installs it, but a Runtime that never runs prepare (the desktop app)
+ # gets it only here. Its absence only changes Vibey's prompt line, so it
+ # never fails startup.
+ try:
+ from core.ripgrep_runtime import RipgrepRuntimeManager
+
+ result["ripgrep"] = RipgrepRuntimeManager().ensure(force=False)
+ except Exception as exc: # noqa: BLE001
+ logger.warning("Startup dependency reconcile failed to ensure ripgrep: %s", exc, exc_info=True)
+ result["ripgrep"] = {"ok": False, "status": "failed", "reason": str(exc)}
+
result["duration_ms"] = int((time.monotonic() - started_at) * 1000)
result["ok"] = (
bool(result["askill"].get("ok"))