fix(subagents): prevent scoped tools from bypassing idle review - #247
Merged
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
摘要 / Summary
Idle review could execute an AOCI-style tool registered directly on its child Agent, bypassing DSH's inherited-tool filter even when complete overview evidence was already present. Attach a scoped execution guard before the child runs and explicitly reuse inherited evidence; bounded Document search and normal parent/manual tools remain available.
后台审查已继承完整概览时,仍可能通过直接注册在子 Agent 作用域中的工具重复读取。此修复在子 Agent 发布时安装执行限制,并明确复用继承证据,保留有界档案搜索和正常父会话 / 手动工具操作。
关联 Issue 或背景 / Related Issue or Context
Fixes #211.
The verified case is the current per-Agent plugin composition gap. The original Windows/AOCI profile and historical ~37K token usage were not reproduced; no token-saving measurement is claimed. Only the model choices and synthetic overview tool are fixtures.
涉及区域 / Affected Areas
PR 类型 / PR Type
最新代码确认 / Latest Codebase Confirmation
main分支开发,或在提交前已 rebase 或合并最新main。 / I developed from the latestmain, or rebased or merged the latestmainbefore submitting.同步命令 / Sync command:
git fetch origin mainconfirmed base1e19caf40f0bf37edf678c3d829f2398ab28792a; isolated worktree from latest main.AI 编码披露 / AI Coding Disclosure
使用的 AI 模型 / AI model used:
GPT-6 Astra, max reasoning.
使用的编码 Agent 工具 / Coding Agent tool used:
Codex desktop with explicitly authorized collaborative agents.
仓库规范检查 / Repository Rules
@deepseek-ai/*NPM 契约。 / I did not modify DSH source or point tsconfig at a DSH source checkout, and used only published@deepseek-ai/*NPM contracts.src/host/protocol.ts为准,没有在两侧重复定义 wire DTO。 / The Client and Host boundary still uses browser-safesrc/host/protocol.tsas the source for wire DTOs.lib/文件。 / I did not commit tokens, credentials, private memory, unredacted logs, or generatedlib/files.兼容性与数据安全 / Compatibility and Data Safety
Uses published DSH APIs only:
agent/created,agents.isOwnedBy, andagent.ctx.tools.guard. Real execution was verified on 0.1.5-rc.1; published 0.1.1-rc.1 and 0.1.2-rc.1 tarballs contain the required public contracts. Unsupported ownership/guard capability fails review explicitly. Both native and Code Mode paths preserve authorized tools and completion. The guard remains through child disposal; nested/concurrent starts and failing disposers are covered.No storage format, RPC authority, credential, or Provider schema changes. Tests isolated DSH_HOME, MNEMON_DATA_DIR, and workspace; no personal data was used. Root-only patch changeset included. The measured artifact is 1,271,378 unpacked bytes; the bounded package cap moves from 1,270,000 to 1,275,000 for the Host guard. The browser fixture and real-host test accept both result protocols from #239.
本地验证 / Local Validation
执行的命令 / Commands run:
结果摘要 / Result summary:
Final
pnpm run verifypassed: 935 Root and 323 plugin tests (seven opt-in skips), type checks, deterministic builds, Headless activation/restart/disable, package contents/public entries/lint. Targeted: 94 passed, including real native and worker-thread Code Mode dispatch before start returns. Real Native suite: 169 passed, one Windows-only skip. Both HTTP completion protocols also passed a fixed-fixture check. Release-intent coverage passed for dsh-mnemon. The initial package-cap failure was resolved by the documented measured cap adjustment; no failing checks remain.用户可见变更证据 / Local Feature Evidence
Bilingual evidence and reproduction records source hashes, workload, counts, environment, and limits. Both real WebUI runs enable all three Strategy extensions.
Baseline: five inherited chunks, five parent reads, one executed redundant child read.
Fixed: identical attempted read is denied; bounded Document search and skipped completion succeed.
A real Native CLI canary remains readable through WebUI; normal Forget returns zero items.
证据 / Evidence: