Repository navigation
fix(agent-core-v2): nudge the agent to keep its todo list current - #4239
Conversation
- Remind only while the list still has pending or in_progress items, and drop the first-use arming gate so compaction and /undo no longer arm the reminder for agents that never used TodoList. - Remind after 5 steps without an update (was 10) with text that names the step count, progress, and the item still in progress, instead of the gentle "ignore it if not applicable" wording. - Replace the static TodoList write echo with a next step for the current list state. - Drop the churn warnings that discouraged updates from the TodoList description, say the list is a live progress panel, and add a TodoList paragraph to the system prompt when the tool is active. - Track todo_list_written, todo_reminder_shown, and todo_turn_ended.
Codex Review SummaryThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
🦋 Changeset detectedLatest commit: 91d692c The changes in this PR will be included in the next version bump. This PR includes changesets to release 1 package
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
commit: |
There was a problem hiding this comment.
🟡 Changes recommended
最后一项的回显需保留未完成或阻塞状态,避免无条件要求标记完成而误导用户及遥测。
1 open finding
仅在最后一项实际完成后标记 done · New
What changed in this PR
本 PR 在 agent-core-v2 中加强 TodoList 更新提示,减少进度面板过期,并增加遥测衡量效果。
Changes:
- 仅对未完成列表提醒,将提醒间隔从 10 步缩短为 5 步。
- 增加系统提示规则和按列表状态生成的写入回显。
- 新增写入、提醒和回合结束遥测,并补充相关测试。
| File | Description |
|---|---|
packages/agent-core-v2/test/features/todo/tools/todo-list.test.ts |
覆盖状态回显和写入遥测 |
packages/agent-core-v2/test/features/todo/todoListReminder.test.ts |
覆盖提醒阈值及写入统计 |
packages/agent-core-v2/test/features/todo/sessionTodo.test.ts |
覆盖提醒启用和回合遥测 |
packages/agent-core-v2/test/app/agentProfileCatalog/profile-shared.test.ts |
验证提示词条件渲染 |
packages/agent-core-v2/test/agent/loop/loop.test.ts |
更新工具描述快照及哈希 |
packages/agent-core-v2/src/features/todo/tools/todo-list/todoListTool.ts |
添加状态回显和写入遥测 |
packages/agent-core-v2/src/features/todo/tools/todo-list/todo-list.md |
强化进度更新规则 |
packages/agent-core-v2/src/features/todo/tools/todo-list/todo-list-write-reminder.md |
删除固定写入提示 |
packages/agent-core-v2/src/features/todo/todoService.ts |
调整提醒注册并跟踪回合状态 |
packages/agent-core-v2/src/features/todo/todoListReminder.ts |
调整提醒条件、文案及统计 |
packages/agent-core-v2/src/features/todo/todoItem.ts |
增加列表进度汇总 |
packages/agent-core-v2/src/app/telemetry/events.ts |
定义三个 TodoList 遥测事件 |
packages/agent-core-v2/src/app/agentProfileCatalog/system.md |
添加 TodoList 指导槽位 |
packages/agent-core-v2/src/app/agentProfileCatalog/profile-shared.ts |
按工具可用性渲染指导 |
packages/agent-core-v2/src/app/agentProfileCatalog/agentProfileCatalog.ts |
增加工具可用性上下文字段 |
packages/agent-core-v2/src/agent/profile/profileService.ts |
计算 TodoList 可用性 |
.changeset/todo-list-keep-current.md |
记录用户可见行为变化 |
🧠 Review effort: Balanced
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 8d55fb4bae
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| const TODO_LIST_REMINDER_STEPS_SINCE_WRITE = 5; | ||
| const TODO_LIST_REMINDER_STEPS_BETWEEN_REMINDERS = 5; |
There was a problem hiding this comment.
Gate the new five-step reminder behavior
For every main-agent session with an unfinished TodoList, these constants unconditionally replace the previous ten-step cadence with a more frequent five-step prompt, while the accompanying prompt changes also remove the old gentle/ignore behavior. There is no config, environment variable, or flag that preserves the previous model behavior, and the commit does not contain the alternative explicit maintainer sign-off required for an un-gated removal/default change; add an escape hatch or obtain and record that approval.
AGENTS.md reference: AGENTS.md:L101-L103
Useful? React with 👍 / 👎.
- Ask the agent to mark the last open item done only once it is finished; if it stays blocked or unfinished, keep it in_progress and say what remains in the reply. - Emit todo_turn_ended for turns that cleared the list, so cleared lists count toward the stale-list ratio instead of being dropped.
…onshotAI#4239) Ported from MoonshotAI/kimi-code 2.3.0 (da5918c). Kept this fork's richer todo model (ids, milestones, progress) and its tree renderer, so the port only adds upstream's TodoProgress/todoProgress helper next to computeTodoProgress. Rendered the new reminder wording through renderTodoList instead of upstream's flat renderTodoItems, and kept todoActiveReminder beside the new stale reminder. Rebuilt the todo tests on the fork's TodoItem shape (todoItem helper rather than title/status literals) and moved the step thresholds from 10 to 5. Reworked the todo-list tool prompt: our granularity, milestone and progress sections stay and upstream's keep-it-current bullets fold into the churn section; the write-time hint replaces the deleted todo-list-write-reminder.md. Rebaselined the llm.tools_snapshot inline snapshots in loop.test.ts and tool.test.ts for the new tools hash and TodoList description.

Requirement or Bug
模型在多步任务中经常不更新 todo 列表,回合结束后面板仍停在过期状态;现有的过期提醒几乎不起作用。
Bug Reproduction Steps
Root Cause
/undo也算访问,会把它意外启用。无关的提醒多了,模型就学会忽略。这是提示层面的缓解,不是根本修复:模型最终是否更新仍取决于模型本身。本 PR 同时加了埋点,用来衡量改动效果、决定后续方向。
Code Changes
文件职责:
packages/agent-core-v2/src/ ├── features/todo/ │ ├── todoItem.ts # + todoProgress():总数 / 完成数 / 未完成数 / 进行中的项 │ ├── todoListReminder.ts # 只在有未完成项时提醒,阈值 10 → 5,新文案;+ todoListWriteStatsBefore() │ ├── todoService.ts # 去掉"首次访问才启用";提醒与回合结束的埋点 │ └── tools/todo-list/ │ ├── todo-list.md # 工具描述:删掉劝阻更新的说法,新增 "Keeping it current" -│ ├── todo-list-write-reminder.md │ └── todoListTool.ts # 写入回显改为按状态给出下一步;todo_list_written 埋点 ├── app/agentProfileCatalog/ │ ├── system.md # Delivering work 一节新增 ${todo_list_guidance} │ ├── profile-shared.ts # TODO_LIST_GUIDANCE,只在 TodoList 可用时渲染 │ └── agentProfileCatalog.ts # AgentProfileContext.todoListActive ├── agent/profile/profileService.ts # 和 notifyUserActive 一样计算 todoListActive └── app/telemetry/events.ts # 三个新事件过期提醒的判断:
todo actor 的状态机:
TodoList 写入后的回显:
新增的埋点(agent 级事件,只记数字,不记标题或内容):
todo_list_writtenitem_count、open_count、steps_since_write(上下文里没有更早的写入时省略)、after_remindertodo_reminder_shownsteps_since_write、item_count、open_counttodo_turn_endedreason、item_count、open_count、updated_in_turn衡量这次改动的主指标:在
updated_in_turn = true的todo_turn_ended中,open_count > 0所占的比例,也就是本回合用过列表、结束时仍有未完成项的回合占比。本回合内清空列表的回合以item_count = 0计入分母。updated_in_turn = false的是上一个请求遗留下来的列表,单独看。注意open_count = 0并不代表列表准确,模型也可能误标完成,这部分要靠离线抽样核对。Behavior Changes and Affected Users
/undo也会启用todos: []清空列表[tools]里禁用 TodoList 后不会出现KIMI_DISABLE_TELEMETRY提示词逐句变化:
工具描述
todo-list.md(受众:所有能用 TodoList 的会话,即默认 agent、coder 子 agent、Tower worker)todos) to check the list before deciding what to update."in_progress" 和 "Immediately after finishing a tracked task, mark itdone; do not batch completions at the end" 从 When to use 移到新的 "Keeping it current",并补上 "before you start the next one"in_progress."删除
todo-list-write-reminder.md(受众:每次成功写入非空列表的所有 agent)过期提醒文案
todoListReminder.ts(受众:主 agent,列表有未完成项且 ≥5 步未更新)system.md(受众:渲染内置模板、且 TodoList 可用的 profile,即默认 agent 和 coder 子 agent;explore 子 agent 没有 TodoList,不受影响)TodoList, keep it in step with what you have actually done: mark an item done as soon as it is finished, before you start the next one, and make sure the list matches what you did before you write your final message."受影响模块与测试覆盖:
test/features/todo/todoListReminder.test.ts、test/features/todo/sessionTodo.test.ts。子 agent 不提醒的旧行为由sessionTodo.test.ts继续覆盖。todo_list_written:test/features/todo/tools/todo-list.test.tstodo_reminder_shown、todo_turn_ended:test/features/todo/sessionTodo.test.ts,包括本回合清空列表时上报、列表为空且本回合未改动时不上报test/app/agentProfileCatalog/profile-shared.test.tstest/app/telemetry/events.test.tstest/agent/loop/loop.test.ts、test/tool/tool.test.ts,只有 TodoList 描述和随之变化的 hashdocs/下的 manifest、kap-server API 快照、node-sdk 导出、apps/kimi-code/src/cli/都没动。本地完整测试中有两个失败与本 PR 无关,CI 上均通过:
test/tool/tool.test.ts的 "returns the spawned agent id when a foreground subagent times out" 在本地未改动的 main 上同样超时;test/mcpCore/connection-manager.test.ts的 OAuth 401 用例在全量并发下不稳定,单独运行通过。Checklist
/approve).gen-changesetsskill, or this PR needs no changeset.gen-docsskill, or this PR needs no doc update.