Repository navigation
Conversation
- Decide TodoList availability once when an agent binds its profile and record the decision in the bound tool policy, so tool registration, the tools sent to the model, the system prompt guidance, the stale-list reminder, and execution all agree. - Add the [todo] config section and KIMI_CODE_TODO; an unset value follows the kernel default, now off. Custom profiles and the [tools] enabled allowlist that name TodoList keep it, and [tools] disabled still wins. - Keep TodoList, its prompt guidance, and its reminder in sessions bound before this change. - Mention TodoList in the compaction instruction, the swarm enter reminder, and the tower reminders only while it is active. - Document [todo] and KIMI_CODE_TODO and regenerate the config manifest.
🦋 Changeset detectedLatest commit: 0d6e141 The changes in this PR will be included in the next version bump. This PR includes changesets to release 3 packages
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 |
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. |
commit: |
There was a problem hiding this comment.
🟡 Changes recommended
Sub-agent capability descriptions still advertise TodoList when todo opt-in is disabled, potentially causing the main model to delegate tasks to coders that cannot use it.
1 open issue
What changed in this PR
本 PR 将内核的 TodoList 改为默认关闭、长期可选的功能,通过绑定时持久化工具策略,让工具可用性与相关提示保持一致,并保留旧会话的绑定状态。
Changes:
- 新增
[todo] enabled和KIMI_CODE_TODO,支持显式工具列表优先开启,原有硬禁用策略仍然生效。 - 按工具策略渲染 compaction、swarm 和 tower 中的 TodoList 提示,并控制压缩后的列表重贴。
- 补充绑定、恢复及提示渲染测试,同步配置契约、中英文文档和 changeset。
| File | Description |
|---|---|
packages/agent-core-v2/test/session/subagent/forkParity.test.ts |
更新默认工具集的父子 Agent 一致性断言。 |
packages/agent-core-v2/test/features/tower/towerService.test.ts |
覆盖 tower 提示中 TodoList 文本的条件渲染。 |
packages/agent-core-v2/test/features/swarm/swarm.test.ts |
覆盖 swarm 提示中 TodoList 文本的条件渲染。 |
packages/agent-core-v2/test/agent/profile/binding.test.ts |
覆盖 opt-in 优先级、默认行为和会话恢复。 |
packages/agent-core-v2/test/agent/fullCompaction/fullCompaction.test.ts |
覆盖压缩提示及列表重贴的启停行为。 |
packages/agent-core-v2/src/index.ts |
导出 todo 配置模块。 |
packages/agent-core-v2/src/features/tower/towerService.ts |
向 tower 提示注入器传递工具策略。 |
packages/agent-core-v2/src/features/tower/injection/towerModeInjection.ts |
根据工具策略渲染 TodoList 提法。 |
packages/agent-core-v2/src/features/tower/injection/tower-mode-sparse-reminder.md |
将 TodoList 禁用说明改为条件占位符。 |
packages/agent-core-v2/src/features/tower/injection/tower-mode-full-reminder.md |
将 TodoList 对比说明改为条件占位符。 |
packages/agent-core-v2/src/features/tower/injection/tower-mode-exit-reminder.md |
将 TodoList 恢复说明改为条件占位符。 |
packages/agent-core-v2/src/features/todo/todoListOptIn.ts |
实现显式点名、配置和默认值的判定。 |
packages/agent-core-v2/src/features/todo/configSection.ts |
注册 todo 配置、环境变量及内核默认值。 |
packages/agent-core-v2/src/features/swarm/agent/swarmService.ts |
向 swarm 提示提供 TodoList 可用状态。 |
packages/agent-core-v2/src/features/swarm/agent/injection/swarmInjection.ts |
条件渲染 TodoList 工作流说明。 |
packages/agent-core-v2/src/features/swarm/agent/enter-reminder.md |
将 TodoList 说明改为条件占位符。 |
packages/agent-core-v2/src/agent/profile/profileService.ts |
在绑定和应用 profile 时写入 opt-in 工具策略。 |
packages/agent-core-v2/src/agent/fullCompaction/fullCompactionService.ts |
根据工具策略控制压缩提示及列表重贴。 |
packages/agent-core-v2/src/agent/fullCompaction/compactionInstruction.ts |
接收 TodoList 状态并渲染对应段落。 |
packages/agent-core-v2/src/agent/fullCompaction/compaction-todo-list.md |
保存按需插入的原有 todo 压缩指导。 |
packages/agent-core-v2/src/agent/fullCompaction/compaction-instruction.md |
用条件占位符替换固定 todo 段落。 |
packages/agent-core-v2/docs/config-manifest.toml |
增加 todo 配置契约及环境变量映射。 |
docs/zh/reference/tools.md |
说明 TodoList 默认关闭及开启方式。 |
docs/zh/configuration/env-vars.md |
记录 KIMI_CODE_TODO。 |
docs/zh/configuration/config-files.md |
说明 todo 配置及优先级。 |
docs/en/reference/tools.md |
同步英文工具行为说明。 |
docs/en/configuration/env-vars.md |
同步英文环境变量说明。 |
docs/en/configuration/config-files.md |
同步英文 todo 配置说明。 |
.changeset/todo-list-off-by-default.md |
记录默认行为变化及恢复方式。 |
Review effort: Balanced
TodoList is now off by default, so the scripted TodoList call was rejected and no todo display was persisted. Write [todo] enabled = true to the rig's config.toml for this test only.
The Agent tool described coder with TodoList even though new coder subagents now bind without it by default. Whether a subagent can keep a todo list does not help the caller pick an agent type, so leave TodoList out of every subagent type description, the same way select_tools is left out when it would not be sent. A user tool named TodoList is still listed.
|
Codex Review: Didn't find any major issues. Keep it up! Reviewed commit: ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
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". |
…nying it - Profiles with a tool list now bind with TodoList removed from the list rather than added to disallowedTools, so a user tool registered under the same name stays available, as it was before TodoList became opt-in. Profiles that allow every tool still deny TodoList by name. - Builtin profiles bind with an empty disallowedTools list again, and the fork parity test returns to its original expectation: forks still copy the parent's binding, so a forked child matches its parent exactly.
- Add todo.enabled to KimiConfig and KimiConfigPatch and map the todo domain in getConfig, so hosts can turn the TodoList tool on for new sessions with setConfig and read the setting back. - Read and write the [todo] section in the TOML helpers too, so config write-backs through them keep the section.
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 85645a91ed
ℹ️ 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".
# Conflicts: # packages/agent-core-v2/test/agent/loop/loop.test.ts # packages/agent-core-v2/test/app/config/config.test.ts # packages/agent-core-v2/test/features/plan/plan.test.ts # packages/agent-core-v2/test/tool/tool.test.ts
|
Codex usage limits have been reached for code reviews. Please check with the admins of this repo to increase the limits by adding credits. |

Requirement or Bug
TodoList目前在每个新会话里默认提供,随它一起出现的还有 system prompt 里的 todo 指导、列表过期提醒和 compaction 后的重贴。这个 PR 把它改成长期可选的功能:默认关闭,用户在config.toml写[todo] enabled = true或设置KIMI_CODE_TODO=1即可开启。默认值只保存在内核里、不写进用户配置,以后要改回默认开启只需改一个内核常量,没写过[todo]的用户会自动跟随。Bug Reproduction Steps
N/A
Root Cause
N/A
Code Changes
核心思路:TodoList 是否可用,在 agent 绑定 profile 时决定一次;不可用时把
TodoList从这个 agent 绑定的工具列表里去掉(profile 没写工具列表时才加进disallowedTools),随profile.bind记录一起持久化。工具注册、发给模型的工具列表、system prompt 里的 todo 指导、过期提醒和执行拦截本来就都读这份工具策略,所以只要写进策略这一处,它们就自动一致;另外三处无条件提到 TodoList 的提示(compaction 指令、swarm 进入提醒、tower 提醒)改成读同一个策略来渲染。本 PR 之前创建的会话,绑定记录里没有这条排除,恢复后原样保留;fork 出来的子 agent 复制父 agent 的绑定快照、不重新判定,所以和父 agent 逐字节一致,prompt cache 照常命中。SDK 的KimiConfig/KimiConfigPatch新增todo.enabled,宿主可以用setConfig打开、用getConfig读回。概念
[todo] enabledTodoList的 agent 要不要提供它TODO_LIST_ENABLED_BY_DEFAULT(现为false),环境变量KIMI_CODE_TODO优先于它TodoListtools列了它(且不是原样沿用同名内置 profile 的列表,例如 SYSTEM.md 覆盖),或全局[tools] enabled列了它;点名优先于[todo] enabled = false判定流程
flowchart TD A[agent 绑定 profile] --> B{"[tools] enabled 点名了 TodoList?"} B -- 是 --> K[保留 TodoList] B -- 否 --> C{"非内置 profile 自己的 tools 点名了 TodoList?"} C -- 是 --> K C -- 否 --> D{"KIMI_CODE_TODO 或 [todo] enabled 有值?"} D -- "true" --> K D -- "false" --> X["从绑定的工具列表里去掉 TodoList<br/>(没有工具列表时加进 disallowedTools)"] D -- 未设置 --> E["内核默认值(关)"] E --> X这一步只决定"要不要额外排除 TodoList"。
[tools] disabled、workspace 与 session 级禁用、profile 自己的白名单和disallowedTools仍在原来的策略层生效,所以硬禁止始终优先于点名和[todo] enabled。谁读这个结果
flowchart LR Bind["绑定 profile"] --> Policy["绑定的工具策略<br/>随 profile.bind 持久化"] Policy --> Reg["工具注册"] Policy --> Disc["发给模型的工具列表"] Policy --> Prompt["system prompt 里的 todo 指导"] Policy --> Rem["过期提醒"] Policy --> Guard["执行拦截"] Policy --> Comp["compaction 提示与重贴"] Policy --> Inj["swarm 与 tower 提醒"]前五个消费方原本就通过
isToolActive读策略,不需要改;后两个原来是无条件文本,这次改成同样读isToolActive(TodoList)。另外,Agent 工具给主 agent 的子 agent 类型描述(Tools:行)任何时候都不列TodoList:主 agent 知道子 agent 能不能维护 todo 列表,对选择子 agent 类型没有帮助,所以不在描述里复用这套判定。改完后,默认会话的所有提示词里都不会出现TodoList。关键决策
[todo] enabled[tools]里再加一个数组[tools]按文档只能收窄,其中enabled是白名单,写["TodoList"]会只剩它一个工具;独立的[todo]节以后还能放别的 todo 配置enabled是 optional,没有 schema 默认值config.toml或[tools] disabledenabled = false顺带写进文件[todo] enabled = false的含义[tools] disableddisallowedToolsdisallowedToolsdisallowedTools按名字匹配,会把宿主注册的同名 user 工具一起禁掉;从列表里去掉后,同名 user 工具会像其他 user 工具一样被加回列表KimiConfig/KimiConfigPatch加todo.enabledcreateKimiHarness({ todo }))或按会话开关阅读指南
packages/agent-core-v2/src/features/todo/todoListOptIn.ts:判定规则本身(点名 → 配置 → 内核默认)。packages/agent-core-v2/src/features/todo/configSection.ts:[todo]配置节、KIMI_CODE_TODO和内核默认值。packages/agent-core-v2/src/agent/profile/profileService.ts的withTodoListOptIn:绑定时怎么收集输入、怎么区分内置来源(包括 Feature 以内置优先级贡献的 tower worker)和 SYSTEM.md 覆盖,以及怎么把结果写进绑定策略。packages/agent-core-v2/src/agent/fullCompaction/:compaction 指令里 todo 段落和重贴的条件化。packages/agent-core-v2/src/features/swarm/agent/injection/swarmInjection.ts和packages/agent-core-v2/src/features/tower/injection/towerModeInjection.ts:提醒文本的条件化。可以略读:
index.ts导出、重新生成的config-manifest.toml、中英文文档和测试。具体变化
提示词里原本写死的 TodoList 句子改成
${...}占位符:TodoList 可用时填回原句,输出逐字不变;不可用时为空。Behavior Changes and Affected Users
TodoList[todo] enabled = true或KIMI_CODE_TODO=1TodoList…"session.getTodos()todo_list_written/todo_reminder_shown/todo_turn_ended遥测tools: '*'或不写tools的自定义 agent 文件、用 SYSTEM.md 覆盖默认 agent[todo] enabled,默认没有[todo] enabled = true,或在 agent 文件的tools里写TodoListtools显式列了TodoList[todo] enabled = false[tools] enabled白名单列了TodoList[todo] enabled = true[tools] disabled了 TodoList)以前也收到这句,但对它们不成立;现在只在列表确实会被重贴时才发[tools] disabled、但还留着旧列表的用户TodoList"、sparse 的 "; TodoList is code-denied"、exit 的 " (including TodoList)"towerService在执行前强制,不依赖这几句Tools:行tools: '*'的自定义 profile)列出TodoListTodoList(宿主注册的同名 user 工具除外)TodoList)[todo] enabled = true或KIMI_CODE_TODO=1TodoListtools: '*'的自定义 profile 下会被禁用[todo] enabled = truefork: true)KimiConfig/KimiConfigPatchtodo字段todo.enabled:setConfig写入[todo],getConfig能读回;未设置时为{},和其他绑定了环境变量的配置节一致config-manifest.toml新增[todo]一节(只增不改),新增环境变量KIMI_CODE_TODOwire、transcript、ACP 的契约和数据形状都没变:新会话的
profile.bind只是工具列表里少了TodoList(profile 没写工具列表时是disallowedTools里多了它),旧会话写下的 todo 状态照常回放。SDK 只新增了一个可选字段,上一版的 SDK 用户不受影响。受影响模块与测试覆盖
profileService的绑定判定:test/agent/profile/binding.test.ts的AgentProfileService TodoList opt-in覆盖默认关闭且不写配置、模型请求里没有 TodoList、[todo] enabled = true(锁住旧行为:工具和 prompt 指导都在)、环境变量双向覆盖配置、自定义 profile 点名压过enabled = false、不写tools的自定义 profile、SYSTEM.md 形态的覆盖、内置优先级的 Feature profile、[tools] enabled点名、[tools] disabled硬禁止,启用时绑定的会话恢复后保留 TodoList,以及宿主注册的同名 user 工具在默认会话里仍可用;同文件里断言 bind 记录的旧测试中,内置 profile 恢复为disallowedTools: [],没写工具列表的deny-builtin多了TodoList。test/agent/fullCompaction/fullCompaction.test.ts新增渲染器两种状态的用例,以及服务层"不可用时既不提示也不重贴"的用例;原有 inline snapshot 和"追加 todo 列表"用例跑在 TodoList 可用的 agent 上,逐字锁住旧输出;一条使用不含 TodoList 的工具列表的用例,输入 token 期望值从 1215 改为 1129。test/features/swarm/swarm.test.ts锁住可用时原句保留、不可用时消失。test/features/tower/towerService.test.ts锁住可用时原句保留、不可用时三处全部消失且没有残留占位符。test/session/subagent/forkParity.test.ts保持 main 原样,继续断言 fork 子 agent 第一次请求的 system prompt、工具和消息前缀与父 agent 完全相等(父 agent 带着 TodoList 时同样成立)。test/sdk-rpc-client-v2.test.ts覆盖setConfig({ todo: { enabled: true } })写入[todo]并能读回;test/config.test.ts覆盖旧 TOML 读写层解析并写回[todo],没有[todo]时也不会凭空生成。test/tool/tool.test.ts的 "never lists TodoList in subagent type descriptions" 覆盖[todo] enabled为 false 和 true。apps/vscode/test/replay-resume.integration.test.ts的 todo 显示用例在测试 home 的config.toml里写入[todo] enabled = true,代表开启了 TodoList 的用户。验证结论:上表每一行都有测试覆盖;相关包的全量测试除两条在 main 上本来就失败的用例外全部通过。另外用公开 SDK 加模拟 provider 跑过端到端验证(临时脚本,未提交):默认会话的请求里任何位置都不出现
TodoList,压缩前后都是;[todo] enabled = true或setConfig开启后,工具、指导语、compaction 段落和重贴都在;开启时创建的旧会话改回默认后恢复,主 agent 原样保留,新开的 coder 子 agent 跟随新默认;fork 子 agent 在默认会话和旧会话里都与父 agent 逐字节一致。把引擎切回 main 再跑,同一套断言会失败。没有在真实 TUI 或 desktop 里手动走查,也没有用真实模型对比开关前后的任务表现。测试与检查明细
agent-core-v2:394 个测试文件,7803 通过,1 失败:test/tool/tool.test.ts› "returns the spawned agent id when a foreground subagent times out"(30 秒超时),在 main 上同样失败。kap-server:1442 通过,1 失败:test/plugins.test.ts› "falls back to the source-checkout catalog when the remote is unreachable"(本机能连上远端),在 main 上同样失败。node-sdk213、acp-server153、klient141、VS Code 扩展 384 全部通过。agent-core-v2、node-sdk、kap-server、acp-server、apps/kimi-code、apps/vscode通过。pnpm lint:0 error,改动的行上没有 warning;零注释检查通过。lint:imports报 1 处违规(src/human/agent/origin.ts),是 main 上已有的,与本 PR 无关。gen:config-manifest重新生成后只多出[todo]一节。Checklist
/approve).gen-changesetsskill, or this PR needs no changeset.gen-docsskill, or this PR needs no doc update.