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(claude): resolve configured cli override

cyh172fc4f4eaba
diff --git a/core/handlers/session_handler.py b/core/handlers/session_handler.py
index 5cfa79c85..bfd2a42e1 100644
--- a/core/handlers/session_handler.py
+++ b/core/handlers/session_handler.py
@@ -60,10 +60,16 @@ class SessionHandler(BaseHandler):
return None
normalized = str(cli_path).strip()
- if not normalized or normalized == "claude":
+ if not normalized:
return None
- return normalized
+ expanded = os.path.expanduser(normalized)
+ if normalized == "claude":
+ from vibe.api import resolve_cli_path
+
+ return resolve_cli_path(normalized)
+
+ return expanded
def _load_agent_file(self, agent_name: str, working_path: str) -> Optional[Dict[str, Any]]:
"""Load an agent file and return its parsed content.
diff --git a/tests/test_claude_cli_path.py b/tests/test_claude_cli_path.py
index efa54e9b3..2203f47ea 100644
--- a/tests/test_claude_cli_path.py
+++ b/tests/test_claude_cli_path.py
@@ -9,6 +9,7 @@ from typing import Any
sys.path.insert(0, str(Path(__file__).resolve().parents[1]))
import core.handlers.session_handler as session_handler_module
+import vibe.api as vibe_api
from config.v2_compat import to_app_config
from config.v2_config import AgentsConfig, ClaudeConfig, RuntimeConfig, SlackConfig, V2Config
from core.handlers.session_handler import SessionHandler
@@ -124,6 +125,7 @@ def test_session_handler_keeps_sdk_default_for_default_claude_binary(monkeypatch
captured["connected"] = True
monkeypatch.setattr(session_handler_module, "ClaudeSDKClient", _StubClaudeSDKClient)
+ monkeypatch.setattr(vibe_api, "resolve_cli_path", lambda binary: None)
controller = _Controller(tmp_path)
controller.config.claude.cli_path = "claude"
@@ -134,3 +136,52 @@ def test_session_handler_keeps_sdk_default_for_default_claude_binary(monkeypatch
assert captured["connected"] is True
assert captured["options"].cli_path is None
+
+
+def test_session_handler_uses_resolved_path_for_claude_binary(monkeypatch, tmp_path: Path) -> None:
+ captured: dict[str, Any] = {}
+
+ class _StubClaudeSDKClient:
+ def __init__(self, options):
+ captured["options"] = options
+
+ async def connect(self) -> None:
+ captured["connected"] = True
+
+ resolved_path = "/opt/homebrew/bin/claude"
+
+ monkeypatch.setattr(session_handler_module, "ClaudeSDKClient", _StubClaudeSDKClient)
+ monkeypatch.setattr(vibe_api, "resolve_cli_path", lambda binary: resolved_path)
+
+ controller = _Controller(tmp_path)
+ controller.config.claude.cli_path = "claude"
+ handler = SessionHandler(controller)
+ context = MessageContext(user_id="U123", channel_id="C123")
+
+ _run_session(handler, context)
+
+ assert captured["connected"] is True
+ assert captured["options"].cli_path == resolved_path
+
+
+def test_session_handler_expands_tilde_in_claude_cli_path(monkeypatch, tmp_path: Path) -> None:
+ captured: dict[str, Any] = {}
+
+ class _StubClaudeSDKClient:
+ def __init__(self, options):
+ captured["options"] = options
+
+ async def connect(self) -> None:
+ captured["connected"] = True
+
+ monkeypatch.setattr(session_handler_module, "ClaudeSDKClient", _StubClaudeSDKClient)
+
+ controller = _Controller(tmp_path)
+ controller.config.claude.cli_path = "~/bin/claude"
+ handler = SessionHandler(controller)
+ context = MessageContext(user_id="U123", channel_id="C123")
+
+ _run_session(handler, context)
+
+ assert captured["connected"] is True
+ assert captured["options"].cli_path == str(Path("~/bin/claude").expanduser())