Skip to content

feat(discovery): approve investigation tools by group - #6991

Merged
M4n5ter merged 8 commits into
apache:rust-previewfrom
sunrioa:codex/discovery-grouped-tool-approvals
Nov 19, 2026
Merged

M4n5ter merged 8 commits into
apache:rust-previewfrom
sunrioa:codex/discovery-grouped-tool-approvals

Conversation

@sunrioa

@sunrioa sunrioa commented Nov 18, 2026 •

Copy link
Copy Markdown
Contributor

Summary

People approving a scheduled investigation can choose file reading, conversation history, web tools and other groups without having to recognize every tool name. The editor starts with the existing read-only or standard Session preset. Show selected tools displays the exact names that will be approved.

The form shows all available groups and lets you change the investigation model in place. Switching an approved read-only plan to Standard Session tools keeps the previous selection and shows newly available tools unchecked. Install and manage plugins covers installation, replacement, enabling and configuration. It starts unchecked on new plans. Workspace MCP tools and read-only plugin queries remain in Extensions and other tools.

The Host derives each configured tool’s group from the service and method it calls. The preview uses the catalog available to a fresh worker, including workspace MCP tools. A client MCP connection attached to the Bot belongs to that Session. When the worker starts, its selection is checked against the approved names, their current categories, and the parent Session’s tool ceiling. Automatic one-time follow-ups inherit that selection. The worker always retains DiscoveryComplete to submit its result.

Groups control which tools the worker can call. File and network access by a selected terminal, desktop, or extension tool is governed by the existing workspace and sandbox permissions.

Builds on #6730. Refs #6716. The grouped approvals commit shows the changes for this PR on top of scheduled discovery.

The discovery approval form with extensions enabled and plugin management off

Verification

The grouped approval commit passed 23 native Host tests, 9 scheduler tests, 3 headless desktop interaction tests, and 197 Workbench JavaScript tests locally. After syncing the two #6730 fixes, the combined branch passed 5 focused Host integration tests, 3 headless desktop interaction tests, and all 199 Workbench JavaScript tests. The generated SDK declarations and Workbench types also passed verification.

  • Native Host tests exercise a file reader under an alias, an ineligible alias in the read-only preset, a changed category at approval, subsequent narrowing of the parent ceiling, and a one-time follow-up’s actual model request.
  • A local MCP fixture supplies a tool visible to the Bot's own Session. The discovery preview omits it from the worker’s available tools.
  • Workbench interaction tests deselect terminal tools, verify that the choice survives reapproval, and renew a preset-only plan with a replacement model after a new tool appears. The new tool stays unselected. JavaScript tests also cover changes in a tool’s category.
  • Generated SDK declarations, SDK and Workbench TypeScript checks, and formatting were verified locally. The screenshot comes from the native macOS renderer with a sample workspace.

The product sources in the merged commit match the local build that passed 25 native tests matching discovery, 71 native Workbench tests, 9 scheduler tests and 214 Workbench JavaScript tests. The CI-only update from #7013 passed all 22 CI planning tests. The generated SDK declarations and the SDK, bundle and Workbench type checks also passed. One opt-in paid dictation test kept its existing skip. The Host regression checks the exact tools in the worker’s model request using two aliases on the same deployment service. The desktop regression switches an approved plan from read-only to standard tools and checks the choices saved on reapproval. Merged commit

AI use

  • No generative tool made a substantive contribution
  • Generative tooling made a substantive contribution

Codex helped implement the Host and Workbench changes, write and run regression tests, and prepare this description.

Checklist

  • Tests cover the changed approval and admission paths.
  • Formatting, type checking, and the affected suites pass locally.
  • The user-visible behavior change is described in the summary.
中文说明

改动

审批定时调查时,可以从现有的「只读工具」或「普通会话工具」预设开始,按文件读取、会话与记忆、网页等工具组选择。需要核对时,点「查看具体工具」即可看到最终清单。

表单直接展示可用工具组,也可以在同一处更换调查模型。已批准的只读计划切换到「普通会话工具」后保留原勾选,新增工具保持未选中。「安装与管理插件」单独控制安装、替换、启停和配置,新计划默认关闭。工作区 MCP 工具和只读插件查询仍在「扩展与其他工具」中。

Host 根据工具实际绑定的服务和方法分类。预览使用新调查会话能够取得的工具目录,包括工作区提供的 MCP 工具。只接入 Bot 会话的客户端 MCP 工具归该会话使用。调查启动时,Host 核对已批准的名称、当前类别和父会话工具上限。一次性复查继承原清单,调查会话保留 DiscoveryComplete 用于提交结果。

分组授权控制调查可以调用的工具。终端、桌面和扩展工具的文件与网络访问仍由工作区和沙箱权限决定。

基于已合入的 #6730,关联 #6716。可单独查看本次新增的分组审批提交。

验证

分组审批提交在本地通过了 23 项原生 Host 测试、9 项调度测试、3 项桌面交互测试和 197 项 Workbench JavaScript 测试。同步 #6730 的两项修复后,合并版本通过了 5 项针对性 Host 集成测试、3 项桌面交互测试和全部 199 项 Workbench JavaScript 测试,SDK 生成契约与 Workbench 类型检查也已通过。

  • 通过隔离 Host 核验工具别名、只读分类、类别变化、父会话收紧授权,以及一次性复查实际收到的模型工具清单。
  • 使用本地 MCP 样例验证只接入 Bot 的工具不会出现在调查审批清单。
  • 桌面交互测试验证关闭终端工具后重新审批仍保留选择。另一个用例给按预设批准的计划更换模型,同时让目录出现新工具,验证计划可以恢复且新增工具保持未选中。JavaScript 测试还验证了工具重新分类的情况。
  • 已核对 SDK 生成契约、TypeScript 类型和格式。截图来自 macOS 原生渲染器和样例工作区。

实测的产品代码与上游合入的版本一致。25 项匹配 discovery 的原生测试、71 项工作台原生测试、9 项调度测试和 214 项工作台 JavaScript 测试通过。随后同步的 #7013 仅修改 CI,22 项 CI 规划测试全部通过。SDK 生成契约以及 SDK、产品包和工作台的类型检查也已通过。另有 1 项需付费接口的语音测试按默认设置跳过。Host 回归用同一部署服务的两个别名核对实际模型请求中的工具。桌面回归将已批准的计划从只读切换到普通会话工具,再核对重新审批保存的选择。合并提交

@sunrioa
sunrioa force-pushed the codex/discovery-grouped-tool-approvals branch from ace9f7d to 1eeb478 Compare November 18, 2026 09:56
Keep the last granted tools available for review when a plan loses authorization. Show partially enabled groups and explain how Read handles existing conversation references.

Generated-by: Codex
Remember explicit group choices for the current editor. Select untouched groups from the preset or the existing grant and recheck the exact displayed names on save.

Generated-by: Codex
@github-actions github-actions Bot added the effort/XL Under 2500 readable lines label Nov 19, 2026

@M4n5ter M4n5ter left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

English

Overall this is a clean, well-thought-out design—deriving DiscoveryToolGroup from the bound service contract/method, pinning exact tool names together with their displayed categories (BTreeMap<String, DiscoveryToolGroup>), peeling the client MCP layer via Catalog::for_new_session(), and snapshotting preset grants on require_discovery_approval all keep the security model tight, and the test coverage is focused on real behavior.

Two non-blocking suggestions worth considering before merge:

  1. Switching an existing approved read_only plan to Standard Session tools leaves all newly available groups unchecked while the picker stays collapsed.
    In products/maka/workbench/app/DiscoveryPanel.tsx (edit / previewTools) and discoveryCore.ts (selectedDiscoveryTools), editing an approved read_only plan sets initialToolSelection to the currently approved read-only tools. When the user clicks Standard Session tools, selectedDiscoveryTools filters against initialToolSelection, so every newly exposed session group (File editing, Terminal tools, Web tools, etc.) remains off—while DiscoveryToolPicker defaults to expanded = false. From the user's perspective, clicking Standard Session tools appears to do nothing to the displayed summary, yet saving elevates the worker's sandbox permissions without enabling any session tools.
    Keeping new groups fail-closed is sensible, so a lightweight fix would be automatically expanding DiscoveryToolPicker when switching an existing plan from read_only to session with newly available groups unselected.

  2. DiscoveryToolGroup::Other bundles deployment-mutating Plugin* tools together with workspace MCP tools, Skill*, and ModelList.
    In plugins/agent/native/src/tools.rs, deployment_contract methods (PluginInstallSource, PluginInstallUrl, PluginReplaceDeployment, PluginEditComposition, PluginConfigure, etc.) all fall into DiscoveryToolGroup::Other (Extensions and other tools). Because the UI only toggles whole groups, enabling Extensions and other tools to grant a read-only workspace MCP server also grants all plugin-installation / deployment-modification tools with no way to opt out individually. Separating deployment/plugin management tools from general extensions (or keeping deployment mutations out of the same bucket as MCP tools) would make least-privilege approval much cleaner.

Also, the native-windows stack overflow (0xc00000fd) in desktop_lists_a_scripts_tool_calls_in_place_of_the_script is unrelated to this PR and was fixed in #7019—rebasing onto rust-preview should clear that failure.

简体中文

整体实现非常干净、安全模型也很扎实:基于绑定的服务契约和方法推导 DiscoveryToolGroup、把具体工具名与展示类别一起钉死(BTreeMap<String, DiscoveryToolGroup>)、通过 Catalog::for_new_session() 剥离 Bot 会话专属的 client MCP 层,以及在 require_discovery_approval 中对旧预设授权做快照,逻辑都很严密,新增测试也紧扣真实行为。

有两个非阻塞的小建议供合并前参考:

  1. 编辑已批准的 read_only 计划并切到「普通会话工具」时,所有新增分组保持未勾选且选择器默认折叠。
    在 products/maka/workbench/app/DiscoveryPanel.tsx(edit / previewTools)和 discoveryCore.ts(selectedDiscoveryTools)中,编辑已批准的只读计划时 initialToolSelection 会初始化为当前已批准的只读工具集合。用户点击 普通会话工具 后,selectedDiscoveryTools 以 initialToolSelection 为白名单过滤,导致新出现的 编辑文件、终端工具、网页工具 等分组全部处于关闭状态;而 DiscoveryToolPicker 默认 expanded = false。用户视角下点完预设后上方摘要毫无变化,直接保存还会把 worker 沙箱权限提升到工作区权限却未启用任何 session 工具。
    新分组默认不自动开启(fail-closed)本身是合理的,建议在编辑已有计划从 read_only 切到 session 且存在未选中的新分组时,自动展开 DiscoveryToolPicker,让用户直观看到并勾选需要的分组。

  2. DiscoveryToolGroup::Other(「扩展与其他工具」)把高危插件部署修改工具与工作区 MCP / Skill* / ModelList 混在了同一个分组里。
    在 plugins/agent/native/src/tools.rs 中,deployment_contract 下的 PluginInstallSource、PluginInstallUrl、PluginReplaceDeployment、PluginEditComposition、PluginConfigure 等工具都会落入 DiscoveryToolGroup::Other。由于 UI 只能整组开关、无法组内单选,用户如果只是想让定时调查调用某个只读工作区 MCP 工具而打开「扩展与其他工具」,就会连带把安装/修改插件部署的工具一并授权。建议后续(或在本 PR 中)把插件部署管理类工具与普通扩展/MCP 拆开,让最小权限授权更清晰。

另外,native-windows 里 desktop_lists_a_scripts_tool_calls_in_place_of_the_script 的栈溢出(0xc00000fd)与本 PR 无关,已在 #7019 修复,rebase 一下 rust-preview 应该即可恢复绿灯。

Show the available groups and their partial selections directly in the editor. Keep exact names available on demand and preserve tool choices when changing presets or the model.

Generated-by: OpenAI Codex
Classify deployment mutations by their bound service and method mode. Keep them opt-in for a new plan while preserving previously approved exact tools and preventing old extension selections from enabling a reclassified tool.

Generated-by: OpenAI Codex
@M4n5ter
M4n5ter merged commit 86269a4 into apache:rust-preview Nov 19, 2026
5 of 8 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

effort/XL Under 2500 readable lines

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants