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(admin): close remaining P1 gaps — load-time shadowing, Feishu DM detection, modal settings_key
cyh523c8af309ef
diff --git a/core/controller.py b/core/controller.pyindex 8a250bdc9..b9810e4d3 100644--- a/core/controller.py+++ b/core/controller.py@@ -430,6 +430,23 @@ class Controller:return Truereturn False+ def _resolve_settings_key(self, user_id: str, channel_id: Optional[str]) -> str:+ """Resolve settings key for update handlers that don't have a MessageContext.++ Uses the same DM-detection logic as ``_get_settings_key``:+ for DM contexts the key is ``user_id``, otherwise ``channel_id``.+ """+ platform = getattr(self.config, "platform", "slack")+ effective_channel = channel_id or ""+ if platform == "slack" and effective_channel.startswith("D"):+ return user_id+ if platform in ("discord", "lark"):+ # For DM updates, check if the user is a bound DM user+ if self.settings_manager and hasattr(self.settings_manager, "store"):+ if self.settings_manager.store.is_bound_user(user_id):+ return user_id+ return effective_channel if effective_channel else user_id+def _get_target_context(self, context: MessageContext) -> MessageContext:"""Get target context for sending messages"""if self.im_client.should_use_thread_for_reply() and context.thread_id:@@ -776,11 +793,8 @@ class Controller:):"""Handle settings update (typically from Slack modal)"""try:- # Determine settings key - for Slack, always use channel_id- if self.config.platform == "slack":- settings_key = channel_id if channel_id else user_id # fallback to user_id if no channel- else:- settings_key = channel_id if channel_id else user_id+ # Determine settings key — for DM contexts use user_id+ settings_key = self._resolve_settings_key(user_id, channel_id)# Update settingsuser_settings = self.settings_manager.get_user_settings(settings_key)@@ -1149,7 +1163,7 @@ class Controller:try:# Get settings key- settings_key = channel_id if channel_id else user_id+ settings_key = self._resolve_settings_key(user_id, channel_id)# Get existing routing to preserve settings for other backendsexisting_routing = self.settings_manager.get_channel_routing(settings_key)diff --git a/modules/im/feishu.py b/modules/im/feishu.pyindex aa0abb710..25ccdc82a 100644--- a/modules/im/feishu.py+++ b/modules/im/feishu.py@@ -1215,18 +1215,28 @@ class FeishuBot(BaseIMClient):return# --- Channel authorization ---- # Skip for bound users in DM (p2p) contexts.- # Feishu card actions don't carry chat_type, so we check if the user- # is a bound user — bound users are explicitly authorized for DM access.- is_bound_dm = False+ # Feishu card actions don't carry chat_type, so we need heuristics+ # to distinguish DM vs channel contexts.+ is_bound_user = False+ is_dm = Falseif self.settings_manager and user_id:store = self.settings_manager.store- if store.is_bound_user(user_id):- is_bound_dm = True- if not is_bound_dm:+ is_bound_user = store.is_bound_user(user_id)+ # If chat_id is NOT a known authorized channel but user is bound,+ # this is likely a DM context+ if is_bound_user and chat_id:+ is_known_channel = chat_id in store.settings.channels+ if not is_known_channel:+ is_dm = True+ if not is_bound_user or not is_dm:if not chat_id or not await self._is_authorized_channel(chat_id):- logger.info("Card action from unauthorized/unknown channel %s, ignoring", chat_id)- return+ if is_bound_user:+ # Bound user in a non-authorized channel — allow through+ # but don't mark as DM (it's a channel context)+ pass+ else:+ logger.info("Card action from unauthorized/unknown channel %s, ignoring", chat_id)+ returncontext = MessageContext(user_id=user_id,@@ -1236,7 +1246,7 @@ class FeishuBot(BaseIMClient):platform_specific={"event": event_data,"action": action,- "is_dm": is_bound_dm,+ "is_dm": is_dm,# Provide trigger_id so question_handler.open_question_modal()# doesn't abort with "Modal UI is not available".# Feishu doesn't use a real trigger_id (we send cards, notdiff --git a/modules/settings_manager.py b/modules/settings_manager.pyindex 9e54904eb..2e1d20fbc 100644--- a/modules/settings_manager.py+++ b/modules/settings_manager.py@@ -207,7 +207,13 @@ class SettingsManager:returnfor channel_id, channel_settings in self.store.settings.channels.items():- self.settings[str(channel_id)] = self._from_channel_settings(channel_settings)+ key = str(channel_id)+ # Skip legacy channel entries that collide with bound users —+ # the authoritative source for bound users is store.settings.users+ if key in self.store.settings.users:+ logger.info("Skipping channels[%s] — shadowed by users[%s]", key, key)+ continue+ self.settings[key] = self._from_channel_settings(channel_settings)try:self._settings_mtime_ns = self.settings_file.stat().st_mtime_ns