## What happened 定时 Agent 任务产生了当前轮 `send_file_to_user` 工具结果,但 `CronDeliveryService._deliver_agent` 只拼接 token/delta 文本,最后调用 `push_session_text`。工具返回的文件没有被提取为附件发送,用户可能只收到“文件已生成”等说明。 源码核对:[官方 develop delivery.py](https://github.com/TencentCloud/Octop/blob/d13614dbecfc17b1663bb4d3591ca5f6fd2e831d/src/octop/infra/cron/delivery.py)。该分支增加了工具错误日志,但最终交付仍是文本。 ## Expected behavior 当前轮明确请求发送的文件应与正文一起交付。文件解析、读取或渠道发送失败应体现为交付失败;不能仅凭非空文本认定附件已送达。 ## Steps to reproduce 1. 构造 task_type=agent 的定时任务,绑定可接受文件的 Dashboard 会话。 2. 用固定 stream 返回本轮 HumanMessage、调用 send_file_to_user 的 AIMessage、带合成文件块的 ToolMessage,以及一段最终文本。 3. 对 gateway 的 push_session_text 和 push_session_content 设置 spy。 4. 断言当前轮文件被发送一次;官方当前函数只有文本交付路径。 复现不得把历史工具文件或 read_file 的输出自动当成待交付附件。下游测试覆盖了历史排除、重复 state_snapshot/state_update 去重以及缺失工具结果。 ## Environment - 源码核对:Octop 1.0.2b6;develop `d13614dbecfc17b1663bb4d3591ca5f6fd2e831d`。 - 下游回归:Python 3.12 / Linux。 - 证据层级:上游源码检查 + 下游回归通过;发布前应在纯上游环境执行同一 stub。未进行本轮真实钉钉群投递。 ## Suggested fix and tests 从 TurnHistoryTracker 的本轮工具记录提取显式 send_file_to_user 结果,解析 ContentPart 并调用内容交付接口。覆盖本轮范围、call_id 去重、丢失/失败结果、文件读取失败和渠道失败。 本地参考:`tests/unit/cron/test_cron_delivery.py::test_agent_delivers_explicit_current_turn_file_once_excluding_old_history`。请随独立修复提交最小测试,不要求维护者访问私有下游仓库。
Activity