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(slack): identify own bot without app id
cyh166c29b84c89
diff --git a/modules/im/slack.py b/modules/im/slack.pyindex c70f8dcd5..97f7df29b 100644--- a/modules/im/slack.py+++ b/modules/im/slack.py@@ -77,6 +77,8 @@ class SlackBot(BaseIMClient):self._user_info_cache: Dict[str, Dict[str, Any]] = {}self._channel_info_cache: Dict[str, Dict[str, Any]] = {}self._bot_user_id: Optional[str] = None+ self._bot_id: Optional[str] = None+ self._bot_identity_lookup_attempted = Falseself._stop_event: Optional[asyncio.Event] = Noneself._loop: Optional[asyncio.AbstractEventLoop] = Noneself._on_ready: Optional[Callable] = None@@ -283,27 +285,40 @@ class SlackBot(BaseIMClient):payload_user_id = self._extract_bot_user_id_from_payload(payload or {})if payload_user_id:self._bot_user_id = payload_user_id+ if not self._bot_id:+ await self._hydrate_bot_identity()return payload_user_idif self._bot_user_id:+ if not self._bot_id:+ await self._hydrate_bot_identity()return self._bot_user_id+ await self._hydrate_bot_identity()+ return self._bot_user_id++ async def _hydrate_bot_identity(self) -> None:+ if (self._bot_user_id and self._bot_id) or self._bot_identity_lookup_attempted:+ return+self._ensure_clients()auth_test = getattr(self.web_client, "auth_test", None)if not callable(auth_test):- return None+ returntry:response = await auth_test()except Exception as exc:- logger.debug("Failed to resolve Slack bot user id: %s", exc)- return None+ logger.debug("Failed to resolve Slack bot identity: %s", exc)+ return- user_id = response.get("user_id") if isinstance(response, dict) else None+ self._bot_identity_lookup_attempted = True+ user_id = self._slack_response_get(response, "user_id")if isinstance(user_id, str) and user_id:self._bot_user_id = user_id- return user_id- return None+ bot_id = self._slack_response_get(response, "bot_id")+ if isinstance(bot_id, str) and bot_id:+ self._bot_id = bot_id@staticmethoddef _has_specific_mention(text: str, user_id: Optional[str]) -> bool:@@ -357,6 +372,8 @@ class SlackBot(BaseIMClient):return Trueif bot_user_id and bot_profile.get("user_id") == bot_user_id:return True+ if self._bot_id and event.get("bot_id") == self._bot_id:+ return Trueconfig_app_id = getattr(self.config, "app_id", None)if config_app_id and event.get("app_id") == config_app_id:return Truediff --git a/tests/test_slack_dm_mentions.py b/tests/test_slack_dm_mentions.pyindex b107982b5..1dc9fb7fc 100644--- a/tests/test_slack_dm_mentions.py+++ b/tests/test_slack_dm_mentions.py@@ -949,6 +949,37 @@ class SlackDmMentionTests(unittest.IsolatedAsyncioTestCase):self.assertFalse(received["called"])+ async def test_own_bot_message_with_auth_test_bot_id_is_ignored_without_app_id(self):+ slack = SlackBot(SlackConfig(bot_token="xoxb-test"))+ received = {"called": False}++ class _WebClient:+ async def auth_test(self):+ return {"user_id": "U_BOT", "bot_id": "B_SELF"}++ async def _on_message(_context, _text):+ received["called"] = True++ slack.web_client = _WebClient()+ slack.register_callbacks(on_message=_on_message)++ payload = {+ "event_id": "evt-own-bot-auth-bot-id",+ "team_id": "T1",+ "authorizations": [{"user_id": "U_BOT"}],+ "event": {+ "type": "message",+ "channel": "C_CONNECT",+ "bot_id": "B_SELF",+ "text": "<@U_BOT> loop",+ "ts": "1710000000.000359",+ },+ }++ await slack._handle_event(payload)++ self.assertFalse(received["called"])+async def test_slack_connect_channel_mention_marks_thread_active(self):slack = SlackBot(SlackConfig(bot_token="xoxb-test", require_mention=True))marked = []