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(auth): resolve 4 critical regressions from architecture refactoring
cyh095085acc6c0
diff --git a/core/auth.py b/core/auth.pyindex b809a51b0..a06222957 100644--- a/core/auth.py+++ b/core/auth.py@@ -35,6 +35,19 @@ ADMIN_PROTECTED_ACTIONS: frozenset = frozenset(BIND_EXEMPT_COMMANDS: frozenset = frozenset({"bind"})+def _is_admin_protected(action: str) -> bool:+ """Check if an action requires admin permission.++ Handles both exact matches and prefix matches (e.g. ``vibe_update_now:v1.2``).+ """+ if action in ADMIN_PROTECTED_ACTIONS:+ return True+ # Prefix match for actions with dynamic suffixes+ if action.startswith("vibe_update_now"):+ return True+ return False++@dataclassclass AuthResult:"""Result of an authorization check."""@@ -90,7 +103,7 @@ def check_auth(return AuthResult(allowed=False, denial="unauthorized_channel", is_dm=False)# 3. Admin check for protected actions- if action in ADMIN_PROTECTED_ACTIONS:+ if _is_admin_protected(action):if store.has_any_admin() and not store.is_admin(user_id):return AuthResult(allowed=False, denial="not_admin", is_dm=is_dm)diff --git a/core/controller.py b/core/controller.pyindex 3a527afa0..90362c3ae 100644--- a/core/controller.py+++ b/core/controller.py@@ -780,14 +780,16 @@ class Controller:raise# Working directory change handler (for Slack modal)- async def handle_change_cwd_submission(self, user_id: str, new_cwd: str, channel_id: Optional[str] = None):+ async def handle_change_cwd_submission(+ self, user_id: str, new_cwd: str, channel_id: Optional[str] = None, is_dm: bool = False+ ):"""Handle working directory change submission (from Slack modal) - reuse command handler logic"""try:# Create context for messages (without 'message' field which doesn't exist in MessageContext)context = MessageContext(user_id=user_id,channel_id=channel_id if channel_id else user_id,- platform_specific={},+ platform_specific={"is_dm": is_dm},)# Reuse the same logic from handle_set_cwd command handler@@ -799,7 +801,7 @@ class Controller:context = MessageContext(user_id=user_id,channel_id=channel_id if channel_id else user_id,- platform_specific={},+ platform_specific={"is_dm": is_dm},)await self.im_client.send_message(context,@@ -814,6 +816,7 @@ class Controller:agent: Optional[str],session_id: Optional[str],host_message_ts: Optional[str] = None,+ is_dm: bool = False,) -> None:"""Bind a provided session_id to the current thread for the chosen agent."""from modules.settings_manager import ChannelRouting@@ -841,7 +844,7 @@ class Controller:user_id=user_id,channel_id=channel_id or user_id,thread_id=target_thread or None,- platform_specific={},+ platform_specific={"is_dm": is_dm},)settings_key = self._get_settings_key(context)@@ -884,7 +887,7 @@ class Controller:user_id=user_id,channel_id=channel_id or user_id,thread_id=thread_id or None,- platform_specific={},+ platform_specific={"is_dm": is_dm},)await self.im_client.send_message(context,@@ -910,7 +913,7 @@ class Controller:context = MessageContext(user_id=user_id,channel_id=resolved_channel_id,- platform_specific={},+ platform_specific={"is_dm": isinstance(channel_id, str) and channel_id.startswith("D")},)settings_key = self._get_settings_key(context)diff --git a/core/handlers/message_handler.py b/core/handlers/message_handler.pyindex 209906b46..990762ab1 100644--- a/core/handlers/message_handler.py+++ b/core/handlers/message_handler.py@@ -375,6 +375,7 @@ class MessageHandler:thread_id=context.thread_id,agent=agent,session_id=session_id,+ is_dm=(context.platform_specific or {}).get("is_dm", False),)elif callback_data.startswith("opencode_question:"):diff --git a/modules/im/discord.py b/modules/im/discord.pyindex e0e542c82..ec4aff259 100644--- a/modules/im/discord.py+++ b/modules/im/discord.py@@ -476,8 +476,13 @@ class DiscordBot(BaseIMClient):# Determine if this is a DMis_dm = isinstance(channel, discord.DMChannel) or message.guild is None- # Centralized auth check- action = "bind" if (content.startswith("/bind ") or content == "/bind") else ""+ # Centralized auth check — parse command name before auth so+ # admin-protected text commands (e.g. /settings, /set_cwd) are checked.+ if content.startswith("/"):+ _cmd_parts = content.split(maxsplit=1)+ action = _cmd_parts[0][1:] # strip leading "/"+ else:+ action = ""auth_result = check_auth(user_id=str(message.author.id),channel_id=channel_id,@@ -575,10 +580,12 @@ class DiscordBot(BaseIMClient):returnouter: DiscordBot = getattr(self, "_outer")if hasattr(outer, "_on_change_cwd"):+ _is_dm = submit_interaction.guild is Noneawait outer._on_change_cwd(str(submit_interaction.user.id),str(self.new_cwd.value or ""),channel_id,+ _is_dm,)await submit_interaction.response.send_message("✅ Working directory updated.", ephemeral=True)@@ -875,6 +882,7 @@ class DiscordBot(BaseIMClient):chosen_agent,chosen_session,host_message_ts,+ resume_interaction.guild is None,)await resume_interaction.response.edit_message(content="✅ Session resumed.", view=None)diff --git a/modules/im/feishu.py b/modules/im/feishu.pyindex 4592e398b..583963878 100644--- a/modules/im/feishu.py+++ b/modules/im/feishu.py@@ -1119,10 +1119,15 @@ class FeishuBot(BaseIMClient):else:return- # Centralized auth check+ # Centralized auth check — parse command name before auth so+ # admin-protected text commands (e.g. /settings, /set_cwd) are checked.from core.auth import check_auth- _action = "bind" if (text.startswith("/bind ") or text == "/bind") else ""+ if text.startswith("/"):+ _cmd_parts = text.split(maxsplit=1)+ _action = _cmd_parts[0][1:] # strip leading "/"+ else:+ _action = ""auth_result = check_auth(user_id=user_id,channel_id=chat_id,@@ -1314,7 +1319,8 @@ class FeishuBot(BaseIMClient):logger.warning("CWD form submitted with empty path")returnif self._on_change_cwd:- await self._on_change_cwd(context.user_id, new_cwd, context.channel_id)+ is_dm = context.platform_specific.get("is_dm", False) if context.platform_specific else False+ await self._on_change_cwd(context.user_id, new_cwd, context.channel_id, is_dm)async def _handle_settings_form_submit(self, context: MessageContext, form_value: Dict[str, Any]):"""Handle settings form submission."""@@ -1602,6 +1608,7 @@ class FeishuBot(BaseIMClient):# Delegate to the resume session callback (same as Slack/Discord)if hasattr(self, "_on_resume_session") and self._on_resume_session:+ is_dm = context.platform_specific.get("is_dm", False) if context.platform_specific else Falseawait self._on_resume_session(context.user_id,context.channel_id,@@ -1609,6 +1616,7 @@ class FeishuBot(BaseIMClient):chosen_agent,chosen_session,host_message_ts,+ is_dm,)# ------------------------------------------------------------------diff --git a/modules/im/slack.py b/modules/im/slack.pyindex fac9d0b68..7f479060e 100644--- a/modules/im/slack.py+++ b/modules/im/slack.py@@ -895,9 +895,14 @@ class SlackBot(BaseIMClient):logger.debug(f"No settings_manager, ignoring thread message: '{text}'")return- # Centralized auth gate+ # Centralized auth gate — parse command name before auth so+ # admin-protected text commands (e.g. /settings, /set_cwd) are checked.is_dm = channel_id.startswith("D")- auth_action = "bind" if (text.startswith("/bind ") or text == "/bind") else ""+ if text.startswith("/"):+ _cmd_parts = text.split(maxsplit=1)+ auth_action = _cmd_parts[0][1:] # strip leading "/"+ else:+ auth_action = ""auth = check_auth(user_id=user_id,channel_id=channel_id,@@ -1294,7 +1299,8 @@ class SlackBot(BaseIMClient):# Update CWD - need access to controller or settings managerif hasattr(self, "_on_change_cwd"):- await self._on_change_cwd(user_id, new_cwd, channel_id)+ is_dm = isinstance(channel_id, str) and channel_id.startswith("D")+ await self._on_change_cwd(user_id, new_cwd, channel_id, is_dm)# Send success message to the user (via DM or channel)# We need to find the right channel to send the message@@ -1344,8 +1350,9 @@ class SlackBot(BaseIMClient):chosen_agent = selected_agent or agentif hasattr(self, "_on_resume_session"):+ is_dm = isinstance(channel_id, str) and channel_id.startswith("D")await self._on_resume_session(- user_id, channel_id, thread_id, chosen_agent, chosen_session, host_message_ts+ user_id, channel_id, thread_id, chosen_agent, chosen_session, host_message_ts, is_dm)elif callback_id == "opencode_question_modal" or callback_id == "claude_question_modal":diff --git a/modules/settings_manager.py b/modules/settings_manager.pyindex 6b526a9fc..09e601a0c 100644--- a/modules/settings_manager.py+++ b/modules/settings_manager.py@@ -107,6 +107,7 @@ class SettingsManager:self.store = SettingsStore.get_instance(self.settings_file)self.sessions_store = SessionsStore()self.sessions_store.load()+ self._last_seen_store_mtime: Optional[float] = Noneself._load_settings()# ---------------------------------------------@@ -199,14 +200,19 @@ class SettingsManager:"""Load settings from JSON file"""self.store = SettingsStore.get_instance(self.settings_file)self._rebuild_runtime_settings()+ self._last_seen_store_mtime = self.store._file_mtimedef _reload_if_changed(self) -> None:- """Reload runtime settings if the underlying store has changed on disk."""- old_mtime = self.store._file_mtime+ """Reload runtime settings if the underlying store has changed on disk.++ Uses a locally tracked mtime so that same-process writes (e.g. from+ the UI API hitting the singleton store) are detected correctly.+ """self.store.maybe_reload()- if self.store._file_mtime != old_mtime:+ if self.store._file_mtime != self._last_seen_store_mtime:logger.info("Settings file changed on disk, rebuilding runtime settings")self._rebuild_runtime_settings()+ self._last_seen_store_mtime = self.store._file_mtimedef _rebuild_runtime_settings(self) -> None:"""Rebuild the in-memory settings dicts from the store."""@@ -240,6 +246,9 @@ class SettingsManager:for uid, s in self.dm_user_settings.items():self._sync_to_bound_user(uid, s)self.store.save()+ # Keep local mtime in sync so _reload_if_changed doesn't+ # trigger an unnecessary rebuild right after our own save.+ self._last_seen_store_mtime = self.store._file_mtimelogger.info("Settings saved successfully")except Exception as e:logger.error(f"Error saving settings: {e}")