Skip to content

Verify explicit DSH modules and Cordis patches load after wake - #9971

Merged
huangruiteng merged 1 commit into
mainfrom
codex/qualify-dsh-launch-inputs
Dec 3, 2026
Merged

huangruiteng merged 1 commit into
mainfrom
codex/qualify-dsh-launch-inputs

Conversation

@loopx-agent

Copy link
Copy Markdown
Collaborator

What this verifies

The public DSH operation entry accepts an operator-selected native module and an optional Cordis patch. A session that reaches its operation callback can still have ignored either input. The existing opt-in test now observes both registrations in the initial process and again after a confirmed wake.

The fixture selects a small module that records its activation and delegates to the built plugin. The Cordis fixture records its own activation. Both markers are removed before confirmation, so files left by the first process cannot satisfy the wake checks. Production code is unchanged.

Evidence

  • Ran the existing eight public CLI cases with SDK 0.2.1a3, DSH 0.2.1-alpha.3 and a scripted loopback provider. File and SQLite, original and delegated executors, and inline and frozen requests loaded both inputs in both processes. The existing one-time consumption and no-effect result assertions still passed.
  • Compared the OAR candidate based on feat(hosts): OAR deep fusion Phase 2 — harden OAR host and migrate DSH, Claude/ACP, and bounded Codex #9861 with DSH 0.2.1-rc.5 and the MCP tool name advertised by that runtime. Both File and SQLite reached the confirmed no-effect result. Neither the initial process nor the resumed process activated either supplied input. This is a migration regression, not a runtime fix delivered here.
  • Standard diff-based premerge passed. No external provider, real user approval or live Lark delivery was used.

Signed-off-by: LoopX Agent <337587101+loopx-agent@users.noreply.github.com>

@loopx-agent loopx-agent left a comment

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

Reviewer: model_agent · gpt-6.2-sol · OpenAI · runtime_reported · xhigh

Approval conclusion (author-owned PR; GitHub blocks formal self-approval)

动机 / Motivation

为既有原生 DSH 操作选择模块和 Cordis patch,并使用原会话确认唤醒的调用者。 主线的集成测试已覆盖原生操作和确认,但操作完成仍可能没有验证指定模块和 patch 的加载。 把原生现有行为升级为两个启动阶段的可执行回归,在迁移时保留有效反例。 只资格化冻结主干的 SDK 与选定 npm runtime。OAR 迁移的缺标记双后端对照应留在独立议题;也未验证真实用户确认、付费模型和线上 Lark。

审读提交 598999b,冻结基线 b343b8f。

改动思路 / Approach

原生 DSH 回归及其公开委派文档,两处修改;属于测试与文档的交付。 选定模块的 apply 写入标记后转发给已构建的原生操作插件。Cordis patch 的 apply 另写标记。首轮读回后清除两者,确认后再独立断言。

具体改动 / Changes

  • 两个标记来自两个不同的 apply()。首轮 subprocess 结束后删除,再在原确认启动完成后检查。首轮残留文件不能冒充确认后的加载。
  • 用真实 SDK 与可恢复的 DSH 组合分别复验 File/SQLite、原执行者/委派、inline/frozen。换模型被拒,同一会话继续,一次授权消费后重复请求被拒。
  • OAR 对照搭载实际 MCP 和相同类型的两个标记。两后端操作可完成但首轮及唤醒均无标记;这批对照描出迁移缺口,当前小型 PR 没有变更 OAR 或生产运行时。

现有 SDK 原生操作入口明示绝对路径模块和 Cordis patch。确认后必须经过同一个会话和同一套配置。 冻结验收依据

  • native_launch · 首次和确认后实际应用指定 module 与 Cordis。复验通过。
  • continuity · 换模型拒绝、保持原会话及一次消费。复验通过。
  • docs_bounds · 指明已资格化的 SDK 与固定 npm runtime,不推广到其他组合。复验通过。

关键代码讲解

对主干的风险 / Risks

冻结基线和候选各 8 项真实公开入口回归。候选标准 premerge 的 5 项直接、9 项选中检查通过。 本机独立进程和合成确认,仅用 loopback provider,无真实 Lark 投递或业务效果。 基线和候选共享同一 SDK、npm runtime 及原生插件产物。两轮在独立子进程、相同受控模型协议中观察。

我的整体评价 / Verdict

通过。两阶段加载检查通过,现有确认、续跑与原回执语义保持。 两阶段独立选择、重新加载和确认恢复已有真实进程 evidence。此改动只加入回归和说明。 只资格化冻结主干的 SDK 与选定 npm runtime。OAR 迁移的缺标记双后端对照应留在独立议题;也未验证真实用户确认、付费模型和线上 Lark。

English verdict: APPROVE. All eight real native SDK/DSH cases verified independent module and Cordis loads on both launches, preserving the original session and single consumption. The separate OAR migration still lacks both custom activations.

@huangruiteng huangruiteng left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Reviewer: model_agent · Gemini · Google · self_reported

动机 / Motivation

通过公开 CLI 显式指定原生操作模块(--dsh-operation-module)与 Cordis 补丁(--dsh-cordis)并在人工确认后跨进程唤醒同一 DSH 会话的操作员与平台维护者。 此前 main 上的原生 DSH 操作集成测试只断言了操作回调和确认后的最终业务状态,假如底层传输(例如后续 OAR 候选实现)绕过了调用方指定的原生模块或 Cordis 工具收敛补丁而直接完成回调,测试仍会假阳性通过;现在测试在首轮进程启动与确认后唤醒的新进程中分别断言两份独立落盘标记,并在首轮结束时主动删除标记,防止残留文件掩盖唤醒阶段漏加载的问题。 公开委派参考文档(中英文)明确记录了首轮与确认唤醒双阶段均会加载指定原生模块并应用 Cordis 补丁的已验证契约;test_dsh_operation_entry.py 新增双阶段独立标记断言,配套连接单测(10 项)与本地标准 premerge(5 项直检 + 9 项选中冒烟/边界检查)全部通过,且在未配置可选 SDK 环境时保持 35 项安全跳过。 本 PR 不修改任何生产运行时代码,不扩展除已资格化 SDK 0.2.1a3 与 @deepseek-ai/dsh@0.2.1-alpha.3 之外的版本支持,也不在此 PR 内修复独立分支上的 OAR 迁移缺口或触发真实外部渠道投递。 在独立的 OAR 迁移候选路径上,虽然确认后能完成无副作用回执,但首轮与唤醒进程尚未激活显式传入的原生模块与 Cordis 补丁;该运行时缺口已在后续专门 PR(如 #9974)中单独跟踪处理。

对于受控原生操作而言,--dsh-cordis 往往承担了收敛模型可用工具集(如仅允许 loopx_operation)的关键职责,而 --dsh-operation-module 则绑定了审计过的原生插件入口。如果确认唤醒后的第二个进程静默忽略任一输入,即便会话恢复成功,也会破坏原有的工具隔离与模块固定契约,因此必须把“两阶段各自实际执行 apply()”固化为主干回归基准。

改动思路 / Approach

本次改动遵循最小侵入原则,不改动 loopx/ 下的任何生产模块,仅在现有可选实路径集成测试与公开参考文档上补齐双阶段激活证据:

  1. 双源独立标记与首轮清零:在 tests/control_plane/test_dsh_operation_entry.py 中构造轻量的包装模块 selected-operation.mjs(先写入 operation-module-loaded 标记,再完整委托给真实编译产物 native.apply(...args)),同时在 restrict.mjs 的 apply(ctx) 中写入 cordis-patch-loaded 标记。由于 selected-operation.mjs 采用 .mjs 后缀,不会干扰 dsh_operation_host.py 中对同目录 *.js 闭包的哈希摘要计算,从而在首轮与唤醒进程之间严格保持 operation_profile_digest 一致。
  2. 跨进程唤醒防伪验证:首轮 turn run-once 子进程停止并校验两个标记存在后,立即调用 marker.unlink() 将两者删除;随后经 dispatch_confirmed_operation_wake 触发确认唤醒,待第二进程收口后再次断言两个标记被重新创建,从根源上杜绝首轮文件残留造成确认唤醒假通过。
  3. 双语契约同步:在 docs/reference/local-delegation.md 的 DSH 候选章节同步补充中英文说明,明确首次启动与确认唤醒进程均会加载所选原生模块并应用 Cordis 补丁。

具体改动 / Changes

共修改 2 个文件(+25 / -2 行,生产代码 0 行变更):

  • tests/control_plane/test_dsh_operation_entry.py(+21 / -1 行):包装 --dsh-operation-module 为带落盘标记的 selected-operation.mjs,为 restrict.mjs 增加 cordis-patch-loaded 标记,并在首轮结束(删除旧标记)与确认唤醒完成后分别执行断言。
  • docs/reference/local-delegation.md(+4 / -1 行):在英文与中文段落对称记录双阶段加载原生模块与 Cordis 补丁的行为说明。

对照已接受参考契约 docs/reference/local-delegation.md(变更前冻结基线版本 b343b8fcf685091dc9e28a1e00af2f9fcc7293b1):

  • DSH-EXPLICIT-LAUNCH-INPUTS(DSH 原生操作入口必须通过 --dsh-operation-module 与原 --dsh-cordis 等固定参数准备并在原 delegation binding 中保留):implemented,由 test_public_dsh_operation_entry_and_confirmed_callback 首轮启动标记断言验证。
  • DSH-CONFIRMED-WAKE-RELOAD(确认唤醒必须在同一会话与相同 profile digest 下重新校核并加载指定原生模块与 Cordis 补丁,模型变更被拒):implemented,由首轮 unlink() 后的唤醒重加载断言及 replacement-model 拒绝分支验证。
  • DSH-DOC-BILINGUAL-BOUNDS(文档准确陈述已资格化的 SDK 0.2.1a3 与 @deepseek-ai/dsh@0.2.1-alpha.3 边界且保持中英文一致):implemented,由 docs/reference/local-delegation.md 与双语检查验证(此文档修订是对既有 dsh_operation_host._write_owned_operation_patch 与 build_sdk_config 已实现行为的精确显式化,未放宽任何安全义务)。

关键代码讲解

  • selected-operation.mjs 与 restrict.mjs 夹具构造:使用 Path(module).resolve().as_uri() 导入真实原生插件并透传 name 与 apply(...args),使模块激活与 Cordis 补丁激活拥有各自独立的落盘证据。
  • 首轮启动断言与标记清除:在 first.returncode == 0 后逐一校验 module_marker 与 patch_marker 并执行 marker.unlink(),隔离两轮进程生命周期。
  • 确认唤醒重加载断言:在 peer 与 original-owner、inline 与 frozen 组合唤醒收口后,同时断言双标记重建、session_id 不变与 operation_profile_digest 一致。
  • 双语参考文档更新:在候选 DSH 传输段落中如实记录双进程加载语义,不外推未资格化的运行时版本。

对主干的风险 / Risks

  • 对默认环境与主干的隔离性:test_dsh_operation_entry.py 继续通过 pytest.importorskip("deepseek_harness") 与环境变量守门保持 opt-in,在未安装专版 SDK/runtime 的常规环境中干净跳过,不会引入脆弱外部依赖或拖慢常规测试。
  • 文档与规范一致性:本次对 docs/reference/local-delegation.md 的 4 行增补只是把 dsh_operation_host.py(_write_owned_operation_patch + config["patches"])在 main 上已有的行为明文化,并用测试锁死,不存在“修改规范以迁就残缺实现”的倒置风险。
  • 本地验证矩阵:
    • 连接与协议层单测 pytest tests/control_plane/test_dsh_operation_connection.py:PASS(10 passed)。
    • Opt-in 默认跳过门禁 pytest tests/control_plane/test_dsh_operation_entry.py tests/control_plane/test_dsh_operation_sdk.py:PASS(未传专版环境变量时 35 skipped,无误报失败)。
    • 作者实路径证据核对:在 SDK 0.2.1a3 + @deepseek-ai/dsh@0.2.1-alpha.3 下 File/SQLite × peer/original-owner × inline/frozen 共 8 例均通过双阶段加载断言,且成功在 OAR 候选分支上复现缺失标记的反例。
    • 双语检查 check_rfc_bilingual.py、边界检查 loopx check 与 loopx canary premerge(5 项直检 + 8 项 docs-project-content-ops 冒烟 + 1 项公开边界扫描):全部 PASS(0 失败)。

我的整体评价 / Verdict

通过(APPROVE)。 该 PR 用极小的测试与文档增量(+25 / -2 行,justified_increment)补上了跨进程确认唤醒时“回调可达但模块或 Cordis 补丁被静默忽略”的验证盲区,并已在实际 OAR 迁移对照中证明了其捕获真实回归的鉴别力。长程执行影响(long_horizon)为 improved(确保跨进程恢复不会丢失工具限制补丁与显式模块),用户体验影响(user_experience)为 improved(公开文档更清晰地说明了双阶段加载保证);视觉审查结论为 not_applicable:已核查 tests/control_plane/test_dsh_operation_entry.py 与 docs/reference/local-delegation.md(仅涉及后台子进程集成测试与 Markdown 技术参考文档,无任何 GUI 或前端视觉界面变更)。 未验证视觉范围:none。代码体量属 necessary,兼容性评估为 not_applicable。

English verdict: APPROVE at 598999b. Adds clean, non-duplicative two-phase activation assertions (with pre-wake marker unlinking) and bilingual documentation for explicit DSH modules and Cordis patches across initial launch and confirmed wake; local connection tests and all 14 premerge direct/selected checks PASS.

@huangruiteng
huangruiteng merged commit 5d2875a into main Dec 3, 2026
29 checks passed
@huangruiteng
huangruiteng deleted the codex/qualify-dsh-launch-inputs branch December 3, 2026 14:46
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.

2 participants