Skip to content

Bug: WeChat clawbot 中使用 /stop 命令无法真正停止任务,仍继续发送结果 #396

@XMWell

Description

@XMWell

问题描述

在 WeChat clawbot 模式下,当 agent 正在执行任务时,用户发送 /stop 命令,虽然 Agent 内部 stop_sig 被置为 True 导致主循环中断,但 _handle() 线程仍然会处理之前积累的中间结果,将部分输出逐条发送给用户,并最终显示 [任务已完成],让用户感觉 /stop 没有生效。

复现步骤

  1. 启动 WeChat Bot (wechatapp.py)
  2. 通过微信发送一个耗时的任务(比如需要多次 LLM 调用或执行多个工具)
  3. 在任务执行过程中发送 /stop
  4. 观察到:虽然 Agent 会显示一个已停止,但还是会继续执行任务发消息

环境

  • 项目版本:main 分支最新
  • 操作系统:Windows
  • Python 版本:3.13

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions