Skip to content

fix(agent-core-v2): remind the agent to update its todo list less often - #4524

Merged
RealKai42 merged 1 commit into
mainfrom
fix/todo-reminder-less-often
Oct 29, 2026
Merged

RealKai42 merged 1 commit into
mainfrom
fix/todo-reminder-less-often

Conversation

@RealKai42

Copy link
Copy Markdown
Collaborator

Requirement or Bug

todo 过期提醒太频繁:某一项正常要做十几步时,每 5 步就重复提醒一次,大多被模型忽略。

Bug Reproduction Steps

  1. 让 agent 做一个多步任务,其中某一项本身就要十几步(例如逐个检查一批会话文件)。
  2. 模型建表、把这一项标为进行中,然后持续工作。
  3. 距上次写入 5 步时出现第一次提醒,之后每 5 步再出现一次,文案里的步数从 5 变成 10、15……,而这一项仍在正常推进。

本地一个 26 步的回合里一共出现 4 次提醒,其中 2 次落在同一项正常进行的过程中,模型没有采纳。

Root Cause

  • fix(agent-core-v2): nudge the agent to keep its todo list current #4239 为了解决"模型不更新 todo",把阈值从 10 收紧到 5,首次提醒和重复提醒用同一个间隔。harness 分不清"做完了没标"和"这一项本来就要做很多步",所以只要列表里还有未完成项,长任务里每 5 步就固定出现一次提醒。
  • 文案只给了"做完就标""对不上就改"两条出路,没有告诉模型"列表仍然准确时不用更新"。

这是对提醒节奏和措辞的调整,不是根本修复。

Code Changes

只改了 features/todo/todoListReminder.ts:

 todoListStaleReminder(history, todos)
   if TodoList is not active → skip
   if no item is pending or in_progress → skip
-  if steps since last write < 5 or steps since last reminder < 5 → skip
+  if steps since last write < 10 or steps since last reminder < 10 → skip
   "The todo list has not been updated in the last N steps (k/n done, "X" still in_progress).
-   If an item is finished, mark it done now; the TodoList call can go in the same response as your next tool call.
+   If an item is finished, mark it done; the TodoList call can go in the same response as your next tool call.
    If the list no longer matches the current work, rewrite or clear it.
+   If the list still matches your progress, no update is needed; this is just a gentle reminder.
    Never mention this reminder to the user."

计数单位仍是 assistant step,todo_reminder_shown / todo_list_written 里 steps_since_write 的口径不变。

选 10/10 的依据:拿本地 49 个实际写过 TodoList 的会话(共 592 个 step),按真实的 step 与写入序列重放提醒条件:

阈值 提醒次数
5 / 5(改动前) 15
10 / 10(本 PR) 6

前面那个 26 步的回合,提醒从 4 次降到 1 次。另一个常见 coding agent 的同类提醒也是 10 / 10,不过它按 content block 计数,折算到本仓库大约是 6 个 step。

Behavior Changes and Affected Users

影响人群:所有 TodoList 可用的主 agent 会话(TUI、print 模式、desktop 与 web、VS Code、ACP、SDK)。subagent 本来就不提醒。

Behavior Before After Who relies on the old behavior Escape hatch
首次过期提醒 距上次 TodoList 写入 ≥ 5 step ≥ 10 step 列表在 5–9 步内过期、靠提醒把 todo 面板拉回正确状态的回合 无
重复提醒间隔 距上次提醒 ≥ 5 step ≥ 10 step 被提醒后仍不更新、靠下一次提醒补救的长回合 无
提醒第 2 句 "If an item is finished, mark it done now; …" 去掉 "now" 这句原来要求做完立即标。"立即标"的约束仍由工具描述里的 "As soon as a task is finished, mark it done"、system prompt 的 TodoList 段落和写入回显的下一步提示承担 无
提醒新增一句 无 "If the list still matches your progress, no update is needed; this is just a gentle reminder." 新增约束:列表与进度一致时,不必为了回应提醒去改列表或重发不变的列表。它只放过"列表仍然准确"的情况,不放过"做完没标",所以不是恢复 #4239 删掉的 "ignore it if not applicable" 无

不变:只在有未完成项时提醒;只提醒主 agent;提醒的其余句子和列表渲染;写入回显;工具描述和 system prompt;遥测事件与字段。

没有退路开关,需要维护者拍板。合入后看 #4239 定的主指标:updated_in_turn = true 的 todo_turn_ended 中 open_count > 0 所占比例;如果明显回升,说明降频过头了。

测试覆盖:

  • test/features/todo/todoListReminder.test.ts:写入后 9 步不提醒、10 步提醒;距上次提醒 9 步不提醒、10 步再次提醒(stepsSinceLastWrite 为 20);查询模式不算写入;新增的那句出现在文案里;全部完成和空列表时不提醒。
  • test/features/todo/sessionTodo.test.ts:只在有未完成项时提醒、subagent 不提醒(都改为 10 步);todo_reminder_shown.steps_since_write 为 10。

Checklist

  • I have read the CONTRIBUTING document.
  • I have linked a related issue (external PRs: issue must have a maintainer's /approve).
  • I have added tests that prove my feature works.
  • The behavior-change table above is complete, and every removed behavior or flipped default is named in the changeset and either has an escape hatch or was explicitly approved by a maintainer in this PR.
  • Ran gen-changesets skill, or this PR needs no changeset.
  • Ran gen-docs skill, or this PR needs no doc update.

- Wait 10 steps since the last TodoList write, and 10 steps since the
  previous reminder, before reminding again (was 5 and 5).
- Drop "now" from the "mark it done" sentence and tell the agent that no
  update is needed while the list still matches its progress.
Copilot AI balanced review requested due to automatic review settings October 29, 2026 11:34
@changeset-bot

changeset-bot Bot commented Oct 29, 2026

Copy link
Copy Markdown

🦋 Changeset detected

Latest commit: 6c7429a

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 1 package
Name Type
@moonshot-ai/kimi-code Patch

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

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot was unable to review this pull request because the user who requested the review has insufficient remaining quota.

An organization owner can choose the repository organization as the billing source for reviews requested by members with a paid Copilot license. Learn about Copilot code review billing.

@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Oct 29, 2026 •

Copy link
Copy Markdown

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-10-29T11:36:29.181178Z 6c7429a PR opened
🔒 Security Review ✅ Completed 2026-10-29T11:36:30.793595Z 6c7429a PR opened
ℹ️ 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" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@pkg-pr-new

pkg-pr-new Bot commented Oct 29, 2026

Copy link
Copy Markdown
pnpm dlx https://pkg.pr.new/@moonshot-ai/kimi-code@6c7429a
npx https://pkg.pr.new/@moonshot-ai/kimi-code@6c7429a

commit: 6c7429a

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 6c7429a308

ℹ️ 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".

Comment on lines +7 to +8
const TODO_LIST_REMINDER_STEPS_SINCE_WRITE = 10;
const TODO_LIST_REMINDER_STEPS_BETWEEN_REMINDERS = 10;

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P1 Badge Gate the reminder change on an escape hatch or explicit approval

For main-agent sessions with TodoList enabled, these unconditional constants remove reminders at steps 5–9 and double the repeat interval, with no way to restore the previous cadence. The reviewed commit explicitly says maintainer approval is still needed and leaves the corresponding approval checklist unchecked. Before merging, provide a config/env/flag escape hatch with coverage for the retained five-step behavior, or obtain explicit maintainer sign-off accepting its removal, as required by AGENTS.md.

AGENTS.md reference: AGENTS.md:L114-L116

Useful? React with 👍 / 👎.

@RealKai42
RealKai42 merged commit 47a518e into main Oct 29, 2026
17 checks passed
@RealKai42
RealKai42 deleted the fix/todo-reminder-less-often branch October 29, 2026 12:06
7723qqq pushed a commit to 7723qqq/kimi-code that referenced this pull request Nov 4, 2026
MoonshotAI#4410 MoonshotAI#4413 MoonshotAI#4431 MoonshotAI#4450 MoonshotAI#4451 MoonshotAI#4485 MoonshotAI#4524 were each implemented earlier —
the compaction prefix suite, the media-recovery case, the OAuth callback
socket drain, the split delivering-work section, the compaction wording,
the reasoning-key order and the 10-step todo reminder are all in the tree
and pinned by their own tests. Each row now carries that probe.

Only MoonshotAI#4410 needed care: upstream patched paths that this fork renamed
(`human/llm/builtin/protocol` versus `human/llm/requester/bases`), so the
matching was done on the behaviour — stripDynamicToolContext is gone and
extractEventUsage already reads usage only on terminal response events.

Ledger: closed 22 -> 28, remaining 71.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants