Skip to content

[bug] BTW 确认消息阶段被中断后遗留永不过期的排队任务 #155

Description

@BegoniaHe

Preflight

  • I searched open and closed Issues and PRs.
  • I tested the current master branch or the exact commit.
  • This report contains no secrets, tokens, or private data.
  • This is not a security vulnerability (those use a private advisory).
  • I filled exactly one of Human note or Agent note, matching who wrote this Issue.

Affected area

Providers / agent runners

What happened

P2 / medium · AUD-20260910-agent-004

submit 在确认消息 yield 之前创建 pending 会话,仅在恢复后注册后台任务;后续阶段 stop_event 或中断生成器时无补偿。真实 PipelineScheduler 组合实验显示 pending、后台任务数零且事件已清理;活动任务不受 TTL 清理。

Minimal reproduction

使用 tests/unit/test_btw_delivery.py 的 setup_work 建立真实 PipelineScheduler 与 WorkLoop。让确认消息之后的发送阶段调用 event.stop_event,再执行 scheduler.execute;检查 WorkSession 和后台注册表。生产等价触发是确认消息装饰插件停止事件,或在确认消息阶段取消请求。

Expected: 未被后台接管的会话应终止为 cancelled/failed,并清理事件一次。

Actual: status=pending,后台任务数=0,事件清理次数=1。pending 不参与 TTL 清理,关闭 WorkLoop 也只遍历已登记的任务。

Impact: /work status 持续显示无人执行的排队任务,记录直到重载或重启才清空。

Code evidence

Suggested acceptance criteria

  • 为确认与后台接管之间增加 finally 补偿,将未接管任务标记 cancelled 或 failed,并确保清理仅一次。
  • 在当前真实控制流上增加失败路径组合回归,不能只断言测试替身抛异常或手工设置工作状态。
  • 保持 BTW 默认关闭、现有授权和原请求身份;如调整用户行为,同步中英文文档。

Validation and limits

真实 scheduler + WorkLoop;为确定性触发,在测试发送阶段设置停止标志,未安装或执行外部插件。

本次审计运行:首轮 BTW/入口/状态/能力路由相关测试 173 passed;Agent、工具、历史、配置与导入边界测试 327 passed;pipeline/WebChat/生命周期测试 108 passed;两套循环选择器测试 3 passed。另运行上述确定性组合探针,并完成独立只读反证。现有测试通过不代表已覆盖此缺陷。未改动产品代码。

已检索全部 61 条 Issue 与 89 条 PR(含关闭/合并状态,审计开始时快照),未发现本缺陷的重复报告。关联已完成的功能跟踪 #125#126#127,以及总跟踪 #122;自动分类器实验 #133#135 不属于此缺陷。

Commit or version

037994ea4c8c289e4d5c8e7611a835ced93eeddd (master)

Environment

Linux,源码 checkout;Python 3.14.6;Node.js v26.8.1。后端探针使用内存/临时目录,不访问开发者数据或真实 IM、付费模型。

Author

Agent

Agent note

Codex 按用户授权结合代码审查与仓库 audit-product 技能报告此问题,并使用独立只读 AI agent 反证。目标是修复 BTW 工作循环的实际行为;涉及路径见上方证据,已运行检查与剩余限制如上。本 Issue 按 bug_report.yml 填写;本次只审计、建单,没有修改产品代码或声称修复已完成。

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions