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(prompt): guard missing platform context

cyh3b31c7cda795
diff --git a/core/reply_enhancer.py b/core/reply_enhancer.py
index 0e18c840e..30d020b09 100644
--- a/core/reply_enhancer.py
+++ b/core/reply_enhancer.py
@@ -253,7 +253,8 @@ def _build_user_preferences_prompt(
platform = fallback_platform
user_id = "<user_id>"
if context is not None:
- platform = context.platform or context.platform_specific.get("platform") or fallback_platform
+ platform_specific = context.platform_specific or {}
+ platform = context.platform or platform_specific.get("platform") or fallback_platform
user_id = context.user_id or "<user_id>"
user_section = f"{platform or '<platform>'}/{user_id}"
return _USER_PREFERENCES_PROMPT.format(
diff --git a/tests/test_reply_enhancer_platform.py b/tests/test_reply_enhancer_platform.py
index f4b49be43..72fe813cd 100644
--- a/tests/test_reply_enhancer_platform.py
+++ b/tests/test_reply_enhancer_platform.py
@@ -115,6 +115,23 @@ class ReplyEnhancerPlatformTests(unittest.IsolatedAsyncioTestCase):
self.assertIn("Default session key: `slack::channel::C1`", prompt)
self.assertIn("usually in the current user's section: `slack/U1`.", prompt)
+ def test_prompt_handles_missing_platform_specific(self):
+ context = MessageContext(
+ user_id="U1",
+ channel_id="C1",
+ platform=None,
+ platform_specific=None,
+ )
+
+ with patch.object(paths, "get_user_preferences_path", return_value=Path("/tmp/user_preferences.md")):
+ prompt = build_reply_enhancements_prompt(
+ include_quick_replies=True,
+ context=context,
+ fallback_platform="slack",
+ )
+
+ self.assertIn("usually in the current user's section: `slack/U1`.", prompt)
+
def test_file_links_with_parentheses_are_preserved(self):
enhanced = process_reply("![video](file:///Users/test/SaveTwitter.Net_GABV3XNWYAARAZz(gif).mp4)")