Skip to content

fix(subagent): keep delegated result tool registration stable - #246

Merged
Grivn merged 9 commits into
mainfrom
codex/issue-239-stable-result-tool
Sep 11, 2026
Merged

fix(subagent): keep delegated result tool registration stable#246
Grivn merged 9 commits into
mainfrom
codex/issue-239-stable-result-tool

Conversation

@Grivn

@Grivn Grivn commented Sep 11, 2026

Copy link
Copy Markdown
Collaborator

提交 PR 前请阅读贡献指南Contributing Guide开发和验证指南 / Development and Verification Guide
Before opening a PR, read the Contributing Guide, 贡献指南, and the Development and Verification Guide / 开发和验证指南.
PR 标题和提交信息必须使用 Conventional Commits(type(scope): subject),且不得包含 emoji。 / PR titles and commits must use Conventional Commits (type(scope): subject) and must not contain emoji.
本仓库接受 Bug 修复、兼容性适配、现有能力增强、性能或体验优化和维护类 PR。全新能力、Provider、持久化格式或安全边界变更必须先提 Issue 并获得维护者确认。 / This repository accepts bug fixes, compatibility work, improvements to existing capabilities, performance or UX optimization, and maintenance. New capabilities, Providers, persistence formats, or security-boundary changes require prior maintainer approval in an Issue.
外部贡献者的仅文档类 PR 不直接接受;请先提 Issue 讨论。维护者的发布说明与文档维护不受此限制。 / Documentation-only PRs from external contributors are not accepted directly; open an Issue first. Maintainer release notes and documentation maintenance are exempt.

摘要 / Summary

Every delegated run registered a UUID result tool, changing model tool definitions on each write. Register one stable mnemon_subagent_result for 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

  • Host 激活、Headless 或 bundle / Host activation, Headless, or bundle
  • 运行时记忆 / Runtime Memory
  • 项目档案 / Project Documents
  • 记忆空间或 Provider / Memory Spaces or Providers
  • 子 Agent 或 Agent 工作流 / Subagent or Agent workflow
  • Web UI 或对话交互 / Web UI or conversation interaction
  • 设置、存储或安全 / Settings, storage, or security
  • CLI、RPC、命令或工具 / CLI, RPC, commands, or tools
  • 安装、更新或发布 / Installation, update, or release
  • 测试、构建或文档 / Tests, build, or documentation
  • 其他(请说明)/ Other (explain below)

PR 类型 / PR Type

  • 面向用户的功能或行为变更 / User-facing feature or behavior change
  • Bug 修复 / Bug fix
  • 增强或优化 / Enhancement or optimization
  • 兼容性适配 / Compatibility change
  • 维护或重构 / Maintenance or refactor
  • 测试或构建 / Tests or build

最新代码确认 / Latest Codebase Confirmation

  • 我已基于最新 main 分支开发,或在提交前已 rebase 或合并最新 main。 / I developed from the latest main, or rebased or merged the latest main before submitting.

同步命令 / Sync command:

git fetch origin main; based on 1e19caf (latest origin/main).

AI 编码披露 / AI Coding Disclosure

  • 完全 AI 编码:全部编程改动由 AI 产出,并由贡献者接受和审查。 / Fully AI-coded: AI produced all programming changes, which the contributor accepted and reviewed.
  • 部分 AI 辅助:AI 帮助编写或修改了部分内容。 / Partially AI-assisted: AI helped write or modify part of the change.
  • 未使用 AI 编码辅助。 / No AI coding assistance was used.

使用的 AI 模型 / AI model used:

GPT-6 Astra, max reasoning.

使用的编码 Agent 工具 / Coding Agent tool used:

Codex desktop with an isolated issue worktree.

仓库规范检查 / Repository Rules

  • 未修改 DSH 官方源码,未让 tsconfig 指向 DSH 源码 checkout,仅使用正式的 @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.
  • Client 与 Host 边界仍以浏览器安全的 src/host/protocol.ts 为准,没有在两侧重复定义 wire DTO。 / The Client and Host boundary still uses browser-safe src/host/protocol.ts as the source for wire DTOs.
  • 持久化格式、RPC 权限、路径或凭据处理的变更包含兼容或拒绝路径、安全分析和相应测试。 / Changes to persistence formats, RPC authority, paths, or credentials include compatibility or rejection paths, security analysis, and tests.
  • 没有提交 token、密钥、私有记忆、未脱敏日志或生成的 lib/ 文件。 / I did not commit tokens, credentials, private memory, unredacted logs, or generated lib/ files.
  • 用户可见文案和长期文档已同步维护中文与英文版本,命令、配置键和路径保持一致。 / User-facing copy and long-lived documentation are synchronized in Chinese and English, with matching commands, configuration keys, and paths.
  • 会改变发布制品或其元数据的 PR 已添加 changeset;仅测试、CI 或站点文档变更可不添加。 / A PR that changes a published artifact or its metadata includes a changeset; test-only, CI-only, and site-documentation-only changes may omit one.
  • 新增和修改的代码、注释、文档、提交信息不含 emoji。 / New and modified code, comments, documentation, and commits contain no emoji.

兼容性与数据安全 / 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_code fencing 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_result and SHA256 b01c520da60b2e631963e1e8f4b8f0ba26026cd13b57e7a92ff17d20503dd28e; 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.

Before
After
Runtime write

@Grivn
Grivn merged commit d40164d into main Sep 11, 2026
3 checks passed
@Grivn Grivn mentioned this pull request Sep 11, 2026
28 tasks
@Grivn
Grivn deleted the codex/issue-239-stable-result-tool branch September 11, 2026 14:37
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

mnemon_subagent_result_<random-uuid> tool name churns every write, invalidating the prompt-prefix cache on every subagent result

1 participant