fix(subagent): keep delegated result tool registration stable - #246
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
Every delegated run registered a UUID result tool, changing model tool definitions on each write. Register one stable
mnemon_subagent_resultfor the coordinator lifetime and pass a revocable{ requestId, result }envelope while retaining per-operation validation, child ownership, and authoritative completion checks.每次委派原先都会注册 UUID 结果工具,导致模型工具定义持续变化;现改为协调器生命周期内固定注册,并使用可撤销请求封装,同时保留操作专用 schema、子任务归属及权威完成事件校验。
关联 Issue 或背景 / Related Issue or Context
Fixes #239
涉及区域 / 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 main; based on1e19caf(latestorigin/main).AI 编码披露 / AI Coding Disclosure
使用的 AI 模型 / AI model used:
GPT-6 Astra, max reasoning.
使用的编码 Agent 工具 / Coding Agent tool used:
Codex desktop with an isolated issue worktree.
仓库规范检查 / 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 tool registration, execution, and disposal contracts; no configuration, Provider, persistence, RPC DTO, or stored-memory changes. The internal completion tool is now permanently visible, but root, foreign-child, unknown, duplicate, cancelled, disposed, and expired requests are rejected. Request IDs are revoked before asynchronous child cleanup; operation schemas remain enforced at submission and final receipt validation. Existing child tool allowlists, inherited parent context, and successful outer
run_codefencing remain in force. Restart the plugin when upgrading or rolling back; no data conversion is needed.仅变更内部结果协议;无配置、Provider、存储格式、RPC DTO 或存量记忆变更。固定工具拒绝父任务、其他子任务及未知、重复、取消、销毁、过期请求;异步清理前撤销请求,保留专用 schema、原有工具白名单、父上下文继承和外层
run_code成功校验。升级或回滚需重启插件,无需数据迁移。本地验证 / Local Validation
执行的命令 / Commands run:
pnpm run verify node scripts/verify-plugin-artifacts.mjs --skip-build MNEMON_NATIVE_TEST_CLI=/opt/homebrew/bin/mnemon pnpm --filter dsh-mnemon-source-memory-spaces exec vitest run tests/native-integration.spec.ts pnpm run typecheck pnpm run test:root pnpm run verify:docs git diff --check结果摘要 / Result summary:
Passed the full verification pipeline (935 root tests, 5 expected live-model skips), all 16 independent plugin repositories and 17 packed artifacts, isolated Headless activation, package validation, and the real Mnemon 0.2.7 create/write/recall/forget test. The new registration regression failed on baseline
1e19caf. The final full verification pass also covers disposal during asynchronous workflow preparation, plus actual placement-tool rejection for write envelopes and ineligible Providers. Real WebUI ran before and after with all three Strategy enhancements and completed a runtime-memory write.完整验证通过:根测试 935 项,5 项实时模型测试按预期跳过;16 个独立插件仓库、17 个发布包、Headless、包校验和真实 CLI 闭环通过。新增注册回归在基线失败;真实 WebUI 前后验证与热记忆写入成功。
用户可见变更证据 / Local Feature Evidence
证据 / Evidence:
Reproduction, exact fingerprints, and bilingual evidence
Two baseline child requests used different UUID result tools and different serialized tool-array hashes. Both fixed requests use
mnemon_subagent_resultand SHA256b01c520da60b2e631963e1e8f4b8f0ba26026cd13b57e7a92ff17d20503dd28e; fixed parent inventories are also stable. This proves tool-prefix stability for the reproduced operations. No paid model, large-context cache-hit rate, or monetary saving was measured. The profile uses disposable storage and synthetic data.