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: Correct Slack thread reply behavior to use user message timestamp
cyhhao97a90294b2cb
diff --git a/core/controller.py b/core/controller.pyindex 745327875..02540ea89 100644--- a/core/controller.py+++ b/core/controller.py@@ -135,24 +135,22 @@ Choose a command below or type any message to add it to the processing queue."""# Send confirmation reply immediatelytarget_context = self._get_target_context(context)- # For Slack, establish thread with the confirmation message+ # For Slack, use the user's message timestamp as threadconfirmation_msg = None- if self.config.platform == "slack" and hasattr(self.im_client, 'get_or_create_thread'):- # Create thread if needed- thread_ts = await self.im_client.get_or_create_thread(- target_context.channel_id,- target_context.user_id- )- if thread_ts:- target_context.thread_id = thread_ts+ if self.config.platform == "slack":+ # Use the user's message timestamp as the thread ID+ user_message_ts = context.message_id # This is the timestamp of the user's message+ if user_message_ts:+ target_context.thread_id = user_message_ts- # Send confirmation with thread context+ # Send confirmation as reply in the threadconfirmation_text = f"📝 *Received:* {message}\n⏳ *Processing...*"formatted_confirmation = self.im_client.format_markdown(confirmation_text)confirmation_msg = await self.im_client.send_message(target_context,formatted_confirmation,- parse_mode='markdown'+ parse_mode='markdown',+ reply_to=user_message_ts # Reply to the user's message)else:# For non-Slack platforms, just send confirmation@@ -164,15 +162,15 @@ Choose a command below or type any message to add it to the processing queue."""parse_mode='markdown')- # Store thread context with the message- thread_id = getattr(target_context, 'thread_id', None)+ # Store thread context with the message (use user's message timestamp for Slack)+ thread_id = user_message_ts if self.config.platform == "slack" and user_message_ts else Noneawait self.session_manager.add_message_with_context(context.user_id,context.channel_id,message,thread_id=thread_id)- logger.info(f"User {context.user_id} added message to queue")+ logger.info(f"User {context.user_id} added message to queue with thread_id: {thread_id}")# Check if not already executing, then start processingif not await self.session_manager.is_executing(context.user_id):@@ -220,7 +218,12 @@ Choose a command below or type any message to add it to the processing queue."""target_context.thread_id = thread_idformatted_msg = self.im_client.format_markdown(claude_msg)- await self.im_client.send_message(target_context, formatted_msg, parse_mode='markdown')+ await self.im_client.send_message(+ target_context,+ formatted_msg,+ parse_mode='markdown',+ reply_to=thread_id if self.config.platform == "slack" else None+ )try:await self.claude_client.stream_execute(message, on_claude_message, context.user_id)@@ -234,12 +237,14 @@ Choose a command below or type any message to add it to the processing queue."""if remaining:await self.im_client.send_message(target_context,- "✅ Completed. Processing next message..."+ "✅ Completed. Processing next message...",+ reply_to=thread_id if self.config.platform == "slack" else None)else:await self.im_client.send_message(target_context,- "✅ All messages processed!"+ "✅ All messages processed!",+ reply_to=thread_id if self.config.platform == "slack" else None)except Exception as e:@@ -249,7 +254,8 @@ Choose a command below or type any message to add it to the processing queue."""self.claude_client.options.cwd = original_cwdawait self.im_client.send_message(target_context,- f"❌ Error processing message: {str(e)}\nStopping queue processing."+ f"❌ Error processing message: {str(e)}\nStopping queue processing.",+ reply_to=thread_id if self.config.platform == "slack" else None)breakdiff --git a/modules/im/slack.py b/modules/im/slack.pyindex 56d4c894b..bde2ccc24 100644--- a/modules/im/slack.py+++ b/modules/im/slack.py@@ -22,8 +22,7 @@ class SlackBot(BaseIMClient):self.web_client = Noneself.socket_client = None- # Store thread timestamps for conversation continuity- self.thread_timestamps: Dict[str, str] = {}+ # Note: Thread handling now uses user's message timestamp directly# Store callback handlersself.command_handlers: Dict[str, Callable] = {}@@ -61,6 +60,9 @@ class SlackBot(BaseIMClient):# Optionally broadcast to channelif context.platform_specific and context.platform_specific.get('reply_broadcast'):kwargs['reply_broadcast'] = True+ elif reply_to:+ # If reply_to is specified, use it as thread timestamp+ kwargs['thread_ts'] = reply_to# Handle formattingif parse_mode == 'markdown':@@ -69,11 +71,6 @@ class SlackBot(BaseIMClient):# Send messageresponse = await self.web_client.chat_postMessage(**kwargs)- # Store thread timestamp for future replies- if not context.thread_id and response['ts']:- thread_key = f"{context.channel_id}:{context.user_id}"- self.thread_timestamps[thread_key] = response['ts']-return response['ts']except SlackApiError as e:@@ -658,8 +655,8 @@ class SlackBot(BaseIMClient):async def get_or_create_thread(self, channel_id: str, user_id: str) -> Optional[str]:"""Get existing thread timestamp or return None for new thread"""- thread_key = f"{channel_id}:{user_id}"- return self.thread_timestamps.get(thread_key)+ # Deprecated: Thread handling now uses user's message timestamp directly+ return Noneasync def send_slash_response(self, response_url: str, text: str,ephemeral: bool = True) -> bool: