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): preserve agent system prompt override

cyh59c02aca6b87
diff --git a/core/handlers/session_handler.py b/core/handlers/session_handler.py
index 3f53d06f6..f75339543 100644
--- a/core/handlers/session_handler.py
+++ b/core/handlers/session_handler.py
@@ -513,7 +513,6 @@ class SessionHandler(BaseHandler):
# Claude Code has a bug where ~/.claude/agents/*.md files are not auto-discovered
# See: https://github.com/anthropics/claude-code/issues/11205
# Workaround: read the agent file and use its content as system_prompt
- agent_system_prompt: Optional[str] = None
agent_allowed_tools: Optional[list] = None
agent_model: Optional[str] = None
if effective_agent and agent_system_prompt is None:
diff --git a/tests/test_claude_cli_path.py b/tests/test_claude_cli_path.py
index dd28de0d7..a722ef3f8 100644
--- a/tests/test_claude_cli_path.py
+++ b/tests/test_claude_cli_path.py
@@ -236,6 +236,42 @@ def test_session_handler_ensures_agent_session_id_before_prompt(
assert "--session-key" not in prompt
+def test_session_handler_preserves_passed_agent_system_prompt(monkeypatch, tmp_path: Path) -> None:
+ captured: dict[str, Any] = {}
+
+ class _PromptSessions(_Sessions):
+ @staticmethod
+ def ensure_agent_session_id(settings_key, agent_name, base_session_id):
+ return "sesk8m4q2p7x"
+
+ class _StubClaudeSDKClient:
+ def __init__(self, options):
+ captured["options"] = options
+
+ async def connect(self) -> None:
+ captured["connected"] = True
+
+ monkeypatch.setattr(session_handler_module, "ClaudeAgentOptions", _StubClaudeAgentOptions)
+ monkeypatch.setattr(session_handler_module, "ClaudeSDKClient", _StubClaudeSDKClient)
+
+ controller = _Controller(tmp_path)
+ controller.settings_manager.sessions = _PromptSessions()
+ handler = SessionHandler(controller)
+ context = MessageContext(user_id="U123", channel_id="C123")
+
+ asyncio.run(
+ handler.get_or_create_claude_session(
+ context,
+ agent_system_prompt="Use the release-reviewer Vibe Agent policy.",
+ )
+ )
+
+ prompt_value = captured["options"].system_prompt
+ prompt = prompt_value["append"] if isinstance(prompt_value, dict) else prompt_value
+ assert captured["connected"] is True
+ assert "Use the release-reviewer Vibe Agent policy." in prompt
+
+
def test_session_handler_recreates_cached_claude_client_when_prompt_changes(
monkeypatch, tmp_path: Path
) -> None: