Appearance
Slack:审批按钮和独立消息发送忽略 thread 上下文
问题
两个独立 bug 导致 Slack 消息以新的顶层消息发送,而非在原对话 thread 中回复:
Bug 1:_send_slack() 缺少 thread_id 参数
tools/send_message_tool.py 中的 _send_slack() 函数没有 thread_id 参数。Discord 和飞书的对应函数已支持 thread,Slack 是唯一遗漏的平台。所有通过独立路径发送的 Slack 消息(cron 任务输出、send_message 工具调用等)都会忽略 thread 上下文,在频道中创建新的顶层消息。
Bug 2:工具审批按钮不在原 thread 回复
当 agent 请求工具调用审批时,Slack 中显示的 approve/reject 按钮消息始终以新的顶层消息发出,而不是在触发该工具调用的对话 thread 中回复。用户点击审批后,回复也出现在错误位置。
解决方案
Bug 1 修复:在 _send_slack() 中添加 thread_id 参数,并在调用 Slack API 时传入 thread_ts:
python
def _send_slack(self, channel: str, message: str, thread_id: str = None):
params = {"channel": channel, "text": message}
if thread_id:
params["thread_ts"] = thread_id
self.slack_client.chat_postMessage(**params)Bug 2 修复:审批消息的发送逻辑应从当前对话上下文中获取 thread_ts,并用它发送审批按钮消息。
临时绕过:目前无有效绕过方式。如果 thread 组织对你很重要,考虑使用 Discord 或飞书渠道——这两个平台的 thread 支持已正常工作。
Issue:#9394