Agent 任务执行完成后 Task List 状态未同步(in_progress/pending 残留)
Open
Nobody has claimed this yet.
- Dominant language
- TypeScript
- Stars
- 4.7k
- Forks
- 719
- Avg merge
- 4h 30m
- Merged PRs (30d)
- 83
Description
问题描述
Agent 实际执行的任务已全部完成(交付物均已生成并通过验证),但会话内的 Task List 仍保留大量未完成状态(in_progress / pending)的任务项,与真实进度严重脱节。
现象
- Agent 在任务开始时用
TaskCreate创建了 5 个跟踪任务项; - 执行过程中只把前 2 项更新为
completed,其余 3 项一直停留在in_progress/pending; - 所有实际工作已完成(代码写完、测试跑通、报告生成),但 Task List 仍显示有未完成任务,用户侧看到"任务没做完"的错误印象;
- 排查确认:不是系统残留,而是状态同步缺失 —— 实际工作与任务清单两条记录线脱节。
复现场景
- 多步骤任务(TaskCreate 创建多个任务项)
- 每步实际工作量大、步骤多
- Agent 在每步收尾时未调用
TaskUpdate同步状态 - 最终 Task List 与真实进度不一致
原因分析
- 直接原因:Agent 在完成每个任务项后没有调用
TaskUpdate将其标记为completed,仅更新了早期部分任务。 - 根因:任务状态完全依赖 Agent 手动维护(
TaskCreate/TaskUpdate/TaskList三条并行的记录线),缺少自动校准机制。当 Agent 专注实际工作时,容易遗忘回写状态,导致清单与真实进度漂移。 - 工具层面无兜底:当前没有任何机制能检测"任务已实际完成但状态未同步",也没有收尾时强制复查清单的约束。
修复建议
Agent / 使用侧
- 约定每个任务项完成后立即调用
TaskUpdate同步状态,不留到收尾。 - 结束任务前强制
TaskList复查一遍,把残留的in_progress/pending一次性校准。
产品 / 工具侧
- 状态自动校准:提供一键"将未完成任务标记为 completed / cancelled"的能力,或提供类似
git status的"任务状态与实际会话活动对比"提示。 - 完成证据校验:任务项可附加完成条件(如"运行测试全部通过"、"报告文件已生成"),Agent 完成时可自动核对并置为
completed。 - 僵化任务提醒:对长时间停留在
in_progress的任务(如超过 N 步未更新)给出提示,引导 Agent 校准。 - 会话收尾检查:会话结束时若存在未完成任务,提示 Agent 是否标记完成或作废,避免"活干完了、清单还挂着"。
环境信息
- 产品:MonkeyCode(OhMyAgent)
- 触发场景:
security_tools_agent项目搭建离线 mock 测试套件(多步骤、约 20 个文件、多次迭代) - 操作方式:文本会话中 Agent 使用 TaskCreate / TaskUpdate / TaskList 工具
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by tracing the TaskCreate, TaskUpdate, and TaskList implementations and the session-completion flow in MonkeyCode. Reproduce a multi-step task where work finishes but items remain pending or in_progress, then determine which completion check or synchronization behavior is appropriate. Done means the task list no longer misleadingly shows unfinished work and the relevant tests cover the end-of-session case.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- typescript
- Domain
- ai, developer-experience
- Issue type
- Feature
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Active
- Clarity
- Mostly clear
- Newbie friendliness
- 48/100