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(runtime): handle pid permission errors

cyh3e08e682a532
diff --git a/tests/test_vibe_cli.py b/tests/test_vibe_cli.py
index 43485aa4d..e263a5c51 100644
--- a/tests/test_vibe_cli.py
+++ b/tests/test_vibe_cli.py
@@ -102,3 +102,15 @@ def test_stop_pid_handles_process_lookup_race(monkeypatch):
monkeypatch.setattr(runtime.os, "kill", _kill)
assert runtime.stop_pid(12345) is False
+
+
+def test_stop_pid_handles_permission_error(monkeypatch):
+ monkeypatch.setattr(runtime.os, "name", "posix", raising=False)
+ monkeypatch.setattr(runtime, "pid_alive", lambda pid: True)
+
+ def _kill(pid, sig):
+ raise PermissionError()
+
+ monkeypatch.setattr(runtime.os, "kill", _kill)
+
+ assert runtime.stop_pid(12345) is False
diff --git a/vibe/runtime.py b/vibe/runtime.py
index 5b1c7eb92..398e0a8fb 100644
--- a/vibe/runtime.py
+++ b/vibe/runtime.py
@@ -258,6 +258,8 @@ def stop_pid(pid: int, timeout: float = 5) -> bool:
os.kill(pid, signal.SIGTERM)
except ProcessLookupError:
return False
+ except PermissionError:
+ return False
deadline = time.monotonic() + timeout
while time.monotonic() < deadline:
if not pid_alive(pid):