Skip to content

Release: native-first MiOpIIk slim-down for DSH 0.2.1 - #14

Merged
Chillizu merged 8 commits into
mainfrom
release/native-0.2.1-slim
Oct 21, 2026
Merged

Chillizu merged 8 commits into
mainfrom
release/native-0.2.1-slim

Conversation

@Chillizu

Copy link
Copy Markdown
Owner

Scope\n- Keep 3 lean packages and 6 model-facing tools; align their DSH host peer contract to 0.2.1-rc.2.\n- Publish dsh-agent-rewind + dsh-session-policy 0.5.2, mop-probe 0.1.1 after merge.\n- Remove obsolete multi-agent architecture plans, lab A/B tool and upstream spawn-fixture tests from the current tree (all remain recoverable from Git history).\n- Keep real Loader, tool JSON Schema and Session contract tests; simplify patches and CI.\n\n## Verified locally\n- npm ci (fresh), syntax, lint, Prettier\n- 101/101 unit tests, 4/4 real composition tests, Session contract\n- npm pack verified three minimal artifacts with LICENSE\n\nNo DSH production sessions or local historical archives were changed by this repo cleanup.

破坏性变更(0.5.0,已发布 npm)。

## 定位

从「运行时机制的提供者」收缩为「策略到执行适配层」:DSH 已提供的原语一律
不重造,只补 DSH 刻意保持「有原语、无模型面」的少数几处。

判定依据见 docs/design/0.5-repositioning.md,逐条对 DSH 0.2.0-rc.2 的
README / lib/types/*.d.ts / 源码取证,并用活运行时 cordis_inspect_query
取模型可见工具全集作第一手判据。

## 包边界(9 → 2)

- dsh-agent-rewind(新):会话的命名恢复账本,通用,与 MiOpIIk 工作流解耦。
- dsh-session-policy(原 dsh-miopiik):会话级硬规则 + 诊断,依赖前者。
- 删除 dsh-miopiik-{tool-recovery,diagnostics,learn,magic-keywords,capabilities,
  checkpoint,run-stats,policy},不做兼容 shim。
- 不再代管 agent preset(DSH 0.2 起是声明行,旧目录已无人读取)。
- 不再挂载 dsh-tool-session-query(Agent Teams 已覆盖协作面)。

## 命名统一

历史上包名用 miopiik、工具名用 mop_ 前缀,是同一个词的两个缩写并存。
现统一为「工具名前缀 = 所属包职责」,与 DSH 先例同形(包
dsh-tool-session-query → 工具 session_*):

  mop_checkpoint      -> agent_checkpoint
  mop_rewind          -> agent_rewind
  mop_checkpoint_list -> agent_checkpoint_list
  mop_rule_*          -> session_rule(action)
  mop_probe_capabilities / mop_run_stats -> session_doctor(mode)

## 修复

- 冷路径 fork 产出未闭合子会话:改用 DSH 公开的 buildForkSeed(与第一方
  dsh-api-session-controller 同一导入路径),inheritedEventCount 只计继承前缀。
  新增边界未闭合/恰好闭合两条成对回归锚。
- 检查点静默丢失:appendCheckpoint 在文件无尾换行时会把新行粘在末行,该行
  无法解析、检查点静默失效。
- 能力清单谎报在场:presenceOnly 以 typeof fn === 'function' 判定,而「成对
  原语」判据传的是布尔 → 一律判 false;且 filterSessions/filterEvents 只查前者。
  改为接收谓词并要求两者都在。
- 三处测试真空通过:子路径 import 未归一化;release-version 按包名正则过滤会
  漏掉 scoped 包;两处缺反向自检。

## 验证

npm run check / lint / format:check / test(94/94) / verify-crossrefs.sh /
test:composition(6/6) 全绿。已从公开 registry 真装 dsh-session-policy@0.5.0
验证依赖链,tarball shasum 与发布回执一致。

## 发布

dsh-agent-rewind@0.5.0、dsh-session-policy@0.5.0 已在 npm;
dsh-miopiik@0.4.1 已 deprecate 指向迁移说明。
## 缺陷

DSH 的 `Session` 没有公开的 `.events` 属性——事件只能经 `snapshotEvents()`
取得。旧实现读 `agent.session.events` 拿到 `undefined`,被自身校验误判成
「会话不可用」,报 `agent_checkpoint: event stream of session <id> unavailable`,
检查点在真实部署里永远写不下去。

这是升级到 0.5.0 后在活会话里实测发现的(旧版 mop_checkpoint 报的
`Cannot read properties of undefined (reading 'length')` 是另一个更早的形态)。

修法:新增 `liveSessionEvents()` 统一取内存快照,兼容更早形态的 `.events`。
选已弃用的同步 `snapshotEvents()` 而非 async 的 `sessionQuery.readSession`,
是因为持久化后端异步缓冲、durable log 可能落后于内存,而边界必须取「此刻」
的最后一个 turn/end。

## 根因:测试替身比现实更宽松

`test/harness-mocks.mjs` 的 `rootAgent()` 返回 `{ id, header, events }`,
凭空造出真实 `Session` 没有的 `.events`,让整条代码路径假绿。

- 替身改为只提供真实 API(`snapshotEvents()` 有、`.events` 没有)。
- 新增 `test/session-contract.mjs`(`npm run test:contract`):在**无 stub 的
  独立进程**里对真实 `Session` 类实测断言该契约(快照存在、`.events` 缺位、
  插件能从替身读出事件并定位边界)。之所以独立进程:`npm test` 把
  `@deepseek-ai/dsh-llm` 换成 stub,真实 `dsh-session` 需要它的
  `callConfigEquals`,两者不能同进程共存。
- 新增回归锚:先断言替身不得暴露 `.events`,再验证边界来自 snapshotEvents()。

## 其他

- `suite-manifest` 的 lockstep 断言不再硬编码 `^0.5.0`(升版时会无故变红),
  改为断言不变式 `^<meta 版本>`。
- 清掉两个中途引入、无人使用的 devDependency(`@deepseek-ai/dsh-llm`、`zod`)。
- CONTRIBUTING:门禁表加 `test:contract`;代码约定补两条
  (live 会话事件流只能走 snapshotEvents;测试替身不得比现实更宽松)。

全门绿:check / test(95/95) / test:contract / lint / format:check /
verify-crossrefs / test:composition(6/6)。
事故:web profile 上一个第三方探针以 mop_probe_env 注册空 schema,上游
deepseek API 拒收整个请求(schema must be a JSON Schema of 'type: "object"',
got 'type: null'),该会话此后每轮都失败。DSH 的 tools.register() 原样路径
不做 object-root 校验,判据只能由插件侧守。

- 新增 packages/mop-probe(0.1.0,不参与 0.5.x lockstep):单工具
  mop_probe_env,mode=env 报部署事实,mode=tools 审计可见工具 schema 契约
- 三层防线:注册形态唯一(扫源码禁止绕过 defineTool)、判据双向可用
  (扁平参数图与投影 schema 同判,CI 与运行时共用)、只读自检报错不抛错
- test/mop-probe.test.js:反例锚定线上那条 type: null;正向覆盖全部包
- test/composition:真实 Loader 挂载 + 真实投影面实跑审计(tools 行经
  systemPrompt 传递依赖才 activate,夹具已补齐)
- 套件清单/README/CHANGELOG/npm run check 同步为三个包
CHANGELOG 归入 [0.1.0]:只发 mop-probe(0.1.x 独立版本线),
dsh-session-policy / dsh-agent-rewind 本次无代码变更故不发版。
npm 会拒绝发布 private 包("Skipping workspace mop-probe, marked as private"),
而这个标记是我加错的:它表达的是「不得发布」,与本包的发布意图相反。
两个已发布的包都没有该字段。
mop-probe 0.1.0 的 npm publish 回执成功但未公开:registry 上只有 0.0.0-stage
占位,dist-tags.latest 未指向 0.1.0,公开安装 404。原因是无 2FA
proof-of-presence 的 token(本机为 gh-CI 建的那个)被 npm 转入 staged publishing。

- CONTRIBUTING「npm 陷阱」新增第 3 条:判定标准(dist-tags.latest 是否等于
  目标版本)、批准方式(npm stage list/approve)、以及 npm profile get 403 /
  npm whoami 通过 ≠ 能发布 这两个反直觉点
- 原第 3 条(409 措辞误导)顺延为第 4 条
- 发布步骤新增第 8 条:回执不构成成功,必须核对线上真实版本并真装一次
- CHANGELOG 修正为「已暂存、待 2FA 审批」,并说明本机 link: 安装不受影响
mop-probe 0.1.0 实际已公开发布:dist-tags.latest=0.1.0,公开安装实装成功。
上一提交把「发布后两三分钟内只看到 0.0.0-stage 占位 + 安装 404」误判为
staged publishing 卡在 2FA proof-of-presence,并据此写了错误的陷阱条目。

修正 CONTRIBUTING「npm 陷阱」:
- 第 3 条重写为传播延迟(附本次实测时间线:占位 → 几分钟后 latest=0.1.0),
  明确 0.0.0-stage 是新包名保留、不表示发布卡住;bypass-2FA notice 是 2027-01
  的未来策略,与当次成败无关
- 第 4 条补上「409 说 already published 时其实已成功」的本次实例
- 第 8 条同步:占位/404 不构成失败,先等再判定
- 删去「npm whoami 通过不代表能发布」等基于误判的结论

CHANGELOG 改为「已公开发布」,并记录 optional peer 缺失属预期形态。
Ship dsh-session-policy and dsh-agent-rewind 0.5.2, mop-probe 0.1.1; retire obsolete architecture docs and upstream subagent fixtures; keep only native-first tool surfaces and pinned real composition checks.
@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Oct 21, 2026 •

Copy link
Copy Markdown

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-10-21T06:36:26.063808Z f7354d4 PR opened
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@Chillizu
Chillizu merged commit 9fc9252 into main Oct 21, 2026
2 checks passed

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: f7354d430b

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

if (a === b) return true
if (normalizeSessionId(sessions, a) === normalizeSessionId(sessions, b))
return true
return stripSessionPrefix(a) === stripSessionPrefix(b)

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P2 Badge Preserve distinct live IDs before stripping prefixes

When both abc and session-abc are live session IDs, normalization correctly keeps them distinct, but this unconditional fallback strips the prefix and declares them equal anyway. Consequently, agent_rewind(sessionId: "session-abc", ...) can pass the ownership check for a checkpoint belonging to abc and fork the recorded session despite the caller naming a different live session. Only use prefix-insensitive comparison when neither identifier resolves in the live registry.

Useful? React with 👍 / 👎.

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.

1 participant