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(core): skip persistence for dropped platform replies

cyh15231cd9c5db
diff --git a/core/controller.py b/core/controller.py
index a8e5674cb..d8ceef1c4 100644
--- a/core/controller.py
+++ b/core/controller.py
@@ -61,9 +61,9 @@ class RemovedPlatformIMClient(BaseIMClient):
text: str,
parse_mode: Optional[str] = None,
reply_to: Optional[str] = None,
- ) -> str:
+ ) -> Optional[str]:
logger.info("Dropping stale outbound message for removed IM platform %s", self.platform)
- return ""
+ return None
async def send_message_with_buttons(
self,
@@ -71,9 +71,9 @@ class RemovedPlatformIMClient(BaseIMClient):
text: str,
keyboard,
parse_mode: Optional[str] = None,
- ) -> str:
+ ) -> Optional[str]:
logger.info("Dropping stale outbound button message for removed IM platform %s", self.platform)
- return ""
+ return None
async def edit_message(
self,
diff --git a/tests/test_controller_platform_reconcile.py b/tests/test_controller_platform_reconcile.py
index 1e21a81a6..b94e51add 100644
--- a/tests/test_controller_platform_reconcile.py
+++ b/tests/test_controller_platform_reconcile.py
@@ -212,8 +212,8 @@ def test_reconcile_routes_removed_platform_context_to_noop_sink(monkeypatch):
assert removed_client is platform_client
assert removed_client is not slack
- assert asyncio.run(removed_client.send_message(stale_context, "late result")) == ""
- assert asyncio.run(removed_client.send_message_with_buttons(stale_context, "late result", None)) == ""
+ assert asyncio.run(removed_client.send_message(stale_context, "late result")) is None
+ assert asyncio.run(removed_client.send_message_with_buttons(stale_context, "late result", None)) is None
assert asyncio.run(removed_client.send_typing_indicator(stale_context)) is False
assert asyncio.run(removed_client.clear_typing_indicator(stale_context)) is False
assert asyncio.run(removed_client.delete_message(stale_context, "ack-1")) is False
diff --git a/tests/test_message_dispatcher_result_fallback.py b/tests/test_message_dispatcher_result_fallback.py
index 162e17b2c..330459020 100644
--- a/tests/test_message_dispatcher_result_fallback.py
+++ b/tests/test_message_dispatcher_result_fallback.py
@@ -53,6 +53,20 @@ class _StubIMClient:
return self._upload_id
+class _DropClient(_StubIMClient):
+ async def send_message(self, context, text, parse_mode=None, reply_to=None):
+ self.sent_messages.append((context.channel_id, text, parse_mode))
+ return None
+
+ async def send_message_with_buttons(self, context, text, keyboard, parse_mode=None):
+ self.sent_messages.append((context.channel_id, text, parse_mode))
+ return None
+
+ async def upload_markdown(self, context, title, content, filetype="markdown"):
+ self.uploaded_markdowns.append((context.channel_id, title, content, filetype))
+ return None
+
+
class _NativeMarkdownIMClient(_StubIMClient):
def __init__(self):
super().__init__()
@@ -210,6 +224,28 @@ class MessageDispatcherResultFallbackTests(unittest.IsolatedAsyncioTestCase):
self.assertIsNone(result)
persist.assert_not_called()
+ async def test_removed_platform_notify_drop_is_not_persisted(self):
+ controller = _StubController(platform="discord", im_client=_DropClient())
+ dispatcher = ConsolidatedMessageDispatcher(controller)
+ context = MessageContext(user_id="U1", channel_id="C1", platform="discord")
+
+ with mock.patch("core.message_dispatcher.persist_agent_message") as persist:
+ result = await dispatcher.emit_agent_message(context, "notify", "late notify")
+
+ self.assertIsNone(result)
+ persist.assert_not_called()
+
+ async def test_removed_platform_result_drop_is_not_persisted(self):
+ controller = _StubController(platform="discord", im_client=_DropClient())
+ dispatcher = ConsolidatedMessageDispatcher(controller)
+ context = MessageContext(user_id="U1", channel_id="C1", platform="discord")
+
+ with mock.patch("core.message_dispatcher.persist_agent_message") as persist:
+ result = await dispatcher.emit_agent_message(context, "result", "late result")
+
+ self.assertIsNone(result)
+ persist.assert_not_called()
+
async def test_muted_log_message_still_persists(self):
"""assistant / tool_call rows persist BEFORE the mute filter, so a muted
process log still lands in the store (product requirement)."""