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.
Python agentagent-osaiai-agentsai-partnerchatopsclaudeclaude-codecodexdevtoolsdiscord-botlark-botllmlocal-firstlong-term-memoryopencodeslack-botvibe-codingvibeywechat
fix(discord): let a sent message notify only the users it names (#2675)
Call White10836f441b6f
diff --git a/core/message_output.py b/core/message_output.pyindex 03d57452c..1b263e96c 100644--- a/core/message_output.py+++ b/core/message_output.py@@ -128,9 +128,10 @@ class MessageOutput:# Mention neutralizers for text Avibe republishes into a channel on someone else's# behalf (a Harness prompt echo, an upstream provider's error message). Quoting does-# not stop a renderer from resolving a broadcast, a username, or an id mention, and-# the Discord adapter sends without ``allowed_mentions``, so an echoed ``@everyone``-# would really ping the channel. A zero-width space after the sigil keeps the text+# not stop a renderer from resolving a broadcast, a username, or an id mention. The+# Discord client now resolves only user mentions (``USERS_ONLY_MENTIONS``), but other+# platforms have no such switch and a quoted ``<@user>`` would still ping that user,+# so the guard stays platform-agnostic. A zero-width space after the sigil keeps the text# readable while leaving nothing for any renderer to resolve. Deliberately# platform-agnostic: every adapter renders the same body, so ``@`` before a word# character covers the Slack/Discord broadcasts AND a bare Telegram ``@username``diff --git a/modules/im/discord.py b/modules/im/discord.pyindex a5984f462..5b393c9a9 100644--- a/modules/im/discord.py+++ b/modules/im/discord.py@@ -44,6 +44,11 @@ from vibe.claude_model_catalog import DEFAULT_CLAUDE_MODEL_ALIASESlogger = logging.getLogger(__name__)+# What a message Avibe sends may notify (#2673): a user it names, never @everyone, @here or a role. Text Avibe relays+# (an agent's reply, a model's query, a provider's error) is not all its own words, and discord.py otherwise resolves+# every mention in it. ``replied_user`` keeps discord.py's default.+USERS_ONLY_MENTIONS = discord.AllowedMentions(everyone=False, users=True, roles=False)+_RUNTIME_RETRY_INITIAL_SECONDS = 1.0_RUNTIME_RETRY_MAX_SECONDS = 30.0@@ -95,7 +100,9 @@ class DiscordBot(BaseIMClient):self._stop_event = threading.Event()def _new_client(self) -> discord.Client:- client = discord.Client(intents=self._intents)+ # Every send, edit and interaction reply inherits this unless it passes its own (none does): text Avibe+ # relays can ping a user it names, but never @everyone, @here or a role, whoever wrote it (#2673).+ client = discord.Client(intents=self._intents, allowed_mentions=USERS_ONLY_MENTIONS)client.on_ready = self._on_ready_eventclient.on_message = self._on_message_eventreturn clientdiff --git a/tests/test_discord_mentions.py b/tests/test_discord_mentions.pynew file mode 100644index 000000000..6b1fe80fb--- /dev/null+++ b/tests/test_discord_mentions.py@@ -0,0 +1,39 @@+"""What a Discord message Avibe sends may notify (#2673): a user it names, never @everyone, @here or a role."""++from __future__ import annotations++import sys+from pathlib import Path++import pytest+from discord import AllowedMentions+from discord.http import handle_message_parameters++sys.path.insert(0, str(Path(__file__).resolve().parents[1]))++from config.v2_config import DiscordConfig+from modules.im.discord import DiscordBot++[email protected]("per_send", [None, ...])+def test_a_send_notifies_only_the_users_it_names(per_send) -> None:+ """Every send, edit and interaction reply merges the client's ``allowed_mentions`` with its own, as+ ``Messageable.send`` does here, and no send of ours passes its own. Text an agent or a model wrote+ (``@everyone``, ``@here``, ``<@&role>``) therefore stays inert, while ``<@user>`` still notifies."""++ bot = DiscordBot(DiscordConfig(bot_token="test-token"))+ params = handle_message_parameters(+ content="@everyone @here <@&1234> <@5678> the build is green",+ **({} if per_send is ... else {"allowed_mentions": per_send}),+ previous_allowed_mentions=bot.client.allowed_mentions,+ )+ assert params.payload["allowed_mentions"]["parse"] == ["users"]+++def test_a_recreated_client_keeps_the_rule() -> None:+ """The runtime builds a fresh client after a failed start; it must not fall back to resolving everything."""++ bot = DiscordBot(DiscordConfig(bot_token="test-token"))+ fresh = bot._new_client()+ assert isinstance(fresh.allowed_mentions, AllowedMentions)+ assert fresh.allowed_mentions.to_dict()["parse"] == ["users"]