Repository navigation
revert: remove built-in tool settings and mode availability - #5489
Conversation
🦋 Changeset detectedLatest commit: 55e9da1 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 |
Codex Review Summary: ✅ CompletedThis 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.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 44ea9a7118
ℹ️ About Codex in GitHub
Codex has been enabled to automatically 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 👍.
When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".
|
@codex review |
|
Codex Review: Didn't find any major issues. Another round soon, please! Reviewed commit: ℹ️ About Codex in GitHubCodex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you
If Codex has suggestions, it will comment; otherwise it will react with 👍. When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback". |
Compaction (MoonshotAI#5538): - Send the whole history to the summary request, drop the pre-shrink and the drop-oldest retries, shrink a truncated summary only when the window squeezed its output, and retry empty or thinking-only summaries with the same history. Keep flushReminders, applyCompactionRound and historyFromContextPreservingToolNotes. - Fix two pre-existing 2.7-alignment gaps the suite exposed: recognise the serialized { kind: 'context_overflow' } payload in shouldRecoverFromContextOverflow, and remove the duplicate runWithCredentialRecovery around the requester's own credential recovery so a replayed 401 surfaces instead of being retried. - fullCompaction 124 pass / 0 fail; agent-core-v2 typecheck clean. Built-in tool settings (MoonshotAI#5489): - Keep MoonshotAI#5351's KAP catalog/config/agent-state fields, the four mode guards and the desktop/Web UI as a fork-only capability. - Replace the 22 per-tool userConfigurable flags with the central USER_CONFIGURABLE_BUILTIN_TOOL_NAMES list in kap-server. The catalog still returns the same 39 entries (26 core + 13 Tower), now pinned by tools.test.ts. - Ledger: MoonshotAI#5351 marked fork-only, MoonshotAI#5489 not-applicable with the keep-both approval, both in B2; the PLAYBOOK records the invariant. - kap-server tools 8 pass; agent-core-v2 and kap-server typecheck clean. Loop baseline: - max_steps no longer marks a completed step as interrupted. - Goal creation accepts UpdateGoal when it is loadable through isToolActiveForDisclosure. - Refresh the three loop inline snapshots for the intentional continuation, loadable-tools and step.begin shape. - test/agent/loop 175 pass / 3 fail; the three remaining failures are the pre-existing cancelled-partial preservation, recorded as the first acceptance of the MoonshotAI#5541 requester migration. Ledger refresh adds 87 upstream rows; MoonshotAI#5538 and MoonshotAI#5489 are triaged, 85 remain pending.
Screenshots / Recordings
回退前(#5351 新增的设置入口与子页):
回退后,「Settings → Agent & Sessions」与移动端设置面板不再显示「Built-in tools」入口,恢复
#5351之前的设置页结构。本次未在本地启动 Electron 或浏览器自动化重新截图。Requirement or Bug
回退 #5351(
233b17fac):移除桌面端 / Web 设置中的内置工具开关、配套的GET /api/v1/tools/catalog与/configtools映射,以及 Plan / Swarm / Tower / Goal 在所需工具被禁用时的入口隐藏与服务端拦截。#5351尚未随任何正式版本发布,其两个 changeset 仍在.changeset/中;本 PR 一并删除这两个未发布的 changeset,不新增 changeset。#5351合入后其他 PR 的修复与重构保持不变。Bug Reproduction Steps
N/A
Root Cause
N/A
Code Changes
核心思路
基于最新
origin/main对233b17fac执行git revert,解决与后续提交产生的 5 处冲突:只摘除#5351引入的设置界面、目录接口、配置映射和模式可用性联动,保留后续 PR 引入的行为。全局[tools]策略对运行中 Agent、子 Agent 和新会话动态生效的引擎机制本身保持不变。另外,
#5351顺手在packages/kap-server/src/middleware/defineRoute.ts抽出的GetRouteHost/PostRouteHost共享类型(纯类型提取,无运行时行为)予以保留;若一并回退,会在 7 个路由文件中恢复重复的局部RouteHost接口,触发check:duplication的 9 处新增重复。同时按评审意见保留了
SettingsDialog的confirmDiscard暴露与App.vue的快捷键/菜单关闭守卫(只检查 Global AGENTS.md 未保存草稿)。#5262(已随 Desktop 1.5.0 发布)引入 Global AGENTS.md 编辑页时只守住了弹窗自身的requestClose()与 Tab 切换,漏掉了快捷键/菜单直接关闭路径;#5351曾顺手补上,本 PR 保留这部分守卫并补了回归测试与kimi-code-apppatch changeset。冲突处理(保留的后续改动)
apps/desktop/src/renderer/App.vue/SettingsDialog.vueDefaultToolsSetting相关状态与守卫,保留仅针对 Global AGENTS.md 未保存草稿的confirmDiscard暴露与快捷键/菜单关闭守卫apps/desktop/tests/renderer/settings-dialog-font-page.test.ts#5351的工具草稿confirmDiscard用例改为覆盖 Global AGENTS.md 未保存草稿(修复前失败、修复后通过),保留#5204新增的归档会话按项目分组与同名项目路径区分用例packages/app-components/src/composer/Composer.vuedisabled-command提示分支,保留#5443的isBlockedByProjectTrust(decision)项目信任提交拦截packages/kap-server/src/protocol/rest-config.tstoolsConfigSchema与tools字段,保留#5432回同步的configFieldsSchema+.extend()结构packages/kap-server/src/transport/ws/v1/sessionEventBroadcaster.tsISessionToolPolicy订阅及tools/experimental刷新触发,保留#5206的IProjectService命名,以及#5449在models/providers配置变化时刷新agent帧的逻辑packages/kap-server/src/transport/ws/v1/agentState.ts/ws-agent.ts/sessionAgentFeed.ts*_mode_available字段与toolPolicy读取,完整保留#5449的profile_revision、missing_model、SessionAgentFeed.refresh()及模型目录变化时的帧刷新packages/kap-server/test/sessionEventBroadcaster.test.ts#5351的 5 条模式可用性用例,保留#5449新增的「模型目录变化推送agent帧」用例,改用model字段(k2→k3)验证刷新packages/kap-server/test/apiSurface.test.tspnpm qa:refresh schema核对快照,HOST_CONTRACT.digest更新为回退后的实际值,HOST_API_LEVEL保持1(被移除的接口与字段均未正式发布)删除测试清单、原有覆盖与剩余保障
本次删除的测试均由
#5351引入,覆盖的功能随本次回退整体移除:apps/desktop/tests/renderer/chat-dock-goal.test.ts:覆盖UpdateGoal不可用时 ChatDock 的 Goal 恢复拦截与暂停可用性。packages/app-components/test/defaultToolsPanel.test.ts:覆盖DefaultToolsPanel/Row/Setting的分组、草稿保存、并发更新 rebase、离开确认与加载失败重试。packages/app-core/test/defaultTools.test.ts:覆盖defaultTools.ts对[tools]allowlist / denylist 的解析与并发 rebase。#5351用例:工具草稿未保存拦截(settings-dialog-font-page.test.ts,由同文件新增的 Global AGENTS.mdconfirmDiscard用例继续覆盖外部关闭守卫契约)、模式可用性帧与旧服务端回退(agentStateFrames.test.ts、mappers.test.ts)、菜单与提交拦截(composerSubmit.test.ts、composerRunningSendMode.test.ts、slashCommands.test.ts)、REST 目录与tools配置(configClient.test.ts、config.test.ts)、工具策略变化推送帧(sessionEventBroadcaster.test.ts)、各模式工具守卫(plan*.test.ts、goal*.test.ts、swarm.test.ts、tower*.test.ts、loop.test.ts)。需要单独说明的一项:
packages/kap-server/test/tools.test.ts中的applies global config changes to existing agents, subagents, and new sessions由#5351新增,依赖本次一并移除的POST /api/v1/config { tools }。引擎层「全局[tools]配置变更对已有 Agent 动态生效」的行为没有改动,仍由packages/agent-core-v2/test/agent/toolPolicy/toolPolicyService.test.ts覆盖;失去的仅是已回退的 RESTtools写入路径覆盖。未删除任何已登记的 L0 用例 ID;
[L0:kap.api-contract]保留,契约快照随接口回退同步更新。Behavior Changes and Affected Users
[tools],未保存修改有离开确认main的未发布桌面端 / Web 构建中使用该设置页的用户(正式版用户无感知)config.toml配置[tools]的enabled/disabledGET /api/v1/tools/catalogmain构建上调用该接口的自定义客户端GET /api/v1/tools?session_id=...查询工具及激活状态POST /api/v1/config的tools字段[tools].enabled / disabled#5351前行为:schema 不声明tools,该键被 Zod 剥离、不写入;GET /api/v1/config仍按原逻辑透传config.toml中已有的[tools][tools]的第一方设置页(已删除)或main构建上的外部调用方config.toml的[tools]段agent帧与POST /sessions/{id}/profile的*_mode_available字段plan_mode_available/swarm_mode_available/tower_mode_available/goal_mode_available;全局[tools]、[experimental]或会话工具策略变化时主动推送新agent帧agent帧(#5449的profile_revision、missing_model及models/providers/ 模型目录变化推送保持不变)#5351前帧结构,HOST_API_LEVEL保持1)settingsDialogRef.confirmDiscard()弹出丢弃确认(#5351引入,同时守卫工具开关页与 Global AGENTS.md)#5351前的 1.5.0 正式版会直接关闭丢失草稿)main上的防误关行为)/菜单与模式命令提交/plan、/swarm、/goal、/tower入口,手动输入进入命令时提示composer.disabledCommand且不发送/plan、/swarm、/goal始终显示(/tower仍仅受实验开关控制);手动输入命令正常分发ExitPlanMode/AgentSwarm/UpdateGoal/ Tower 工具的桌面端与 Web 用户#5351前行为)[tools]或 profile 中禁用上述工具的 TUI、desktop/web、KAP、ACP、SDK 用户#5351前行为,工具执行仍由既有AgentToolPolicyService控制)受影响模块与验证:
packages/kap-server:apiSurface.test.ts(含[L0:kap.api-contract]与HOST_CONTRACT哈希)、config.test.ts、sessionEventBroadcaster.test.ts、tools.test.ts,以及tsc --noEmit。packages/agent-core-v2:features/plan、features/goal、features/swarm、features/tower、agent/loop测试及tsc --noEmit。packages/app-core/app-client/app-components/apps/desktop:settings-dialog-font-page.test.ts、agentStateFrames.test.ts、composerSubmit.test.ts、composerRunningSendMode.test.ts、composerMenuViewportClamp.test.ts、composerUndoDraft.test.ts、configClient.test.ts、mappers.test.ts、slashCommands.test.ts,以及kimi-code-app类型检查(含渲染层vue-tsc)。pnpm lint、pnpm run check:duplication origin/main。实际运行的验证命令
pnpm exec tsc -p packages/agent-core-v2/tsconfig.json --noEmitpnpm exec tsc -p packages/kap-server/tsconfig.json --noEmitpnpm --filter kimi-code-app run typecheckpnpm qa:refresh schema(快照一致,HOST_CONTRACT哈希更新后复跑apiSurface.test.ts通过)pnpm exec vitest run --reporter=agent --maxWorkers=4 <上述 36 个受影响测试文件/目录>(36 files / 1315 tests 全部通过)origin/main(含#5449、#5483、#5450)后复跑:kap-server与kimi-code-app类型检查,以及apiSurface、sessionEventBroadcaster、sessions、tools、config、agentStateFrames、modelSwitchConfirm、modelSwitchConfirmGate、composerSubmit、tests/scenarios/conversation.test.ts(10 files / 449 tests 全部通过)settings-dialog-font-page.test.ts(新增用例在修复前失败,修复后 5/5 通过)及kimi-code-app类型检查pnpm lintpnpm run check:duplication origin/mainChecklist
/approve).gen-changesetsskill, or this PR needs no changeset.gen-docsskill, or this PR needs no doc update.