Skip to content

[PR] fix(dsh): preserve verified seeded context inheritance - #5962

Open
2772780896 wants to merge 11 commits into
ranxianglei:masterfrom
2772780896:2026-11-08_dsh-fork-source-adoption
Open

2772780896 wants to merge 11 commits into
ranxianglei:masterfrom
2772780896:2026-11-08_dsh-fork-source-adoption

Conversation

@2772780896

@2772780896 2772780896 commented Nov 8, 2026 •

Copy link
Copy Markdown

Motivation

Refs #5595. This extends the existing opaque/raw adoption fix rather than replacing its commits.

DSH ordinary forks, sidechats and context-inheriting subagents can replay the same inherited history in different provider projections. Matching only a contiguous provider prefix can stop after a few messages; model switches can also omit covered assistant reasoning. A successful fork receipt can therefore inherit no useful folds, replay several MiB of raw history and hit the local non-retryable 413 guard. Merely copying the parent's latest blocks is unsafe for historical forks and changed payloads.

Changes

Interface and behavior

  • All verified DSH seeded children use one adoption gate: isSeeded plus a validated source parent (forkSource, or legacy parentSession). Fresh subagents with only an ownership parent do not inherit. Ownership, lifecycle, catalog/workspace relationships and seed construction remain unchanged.
  • Keep the existing protocol 1/2 ordered-prefix contract and opaque mode=raw fallback. Add the optional protocol-2 durableFork.messages identity evidence only when the parent snapshot advertises it. An inserted first child message may produce an empty prefix while durable evidence still proves inherited content.
  • The manifest describes protocol support; the snapshot advertises durable adoption only while a unified ledger is available. Legacy storage keeps the original prefix adoption path. No new config, environment variable, version bump or kernel change.
  • Verify the child's actual identities against archived parent cores, opaque payloads, signatures, error state, bidirectional refs and the parent's logical snapshot order. Tool identities bind both call/result endpoints to peer raw IDs and payloads: whole-pair wire-ID renaming is allowed; missing, duplicated or reassigned edges are not.
  • Copy only complete verified block closures and originals. Permit absent reasoning only when explicitly classified as covered assistant reasoning within the verified cutoff, with retained non-reasoning witnesses. Missing or changed hard content still excludes the affected block. DSH event boundaries, storage ingestion seq and logical message order are not interchangeable.
  • Persist a bounded child raw view and receipt. Revalidate every actual child request, including later sends and cold recovery; invalidate changed blocks and consuming ancestors, clear stale per-ref render/CCR state and persist the actual view before rendering. Issued refs remain reserved.
  • Synchronize the protocol documentation and English/Chinese identity architecture pages, SVGs, PNG fallbacks, hub rows and architecture map.

Scope and review

This is host-side adoption and persistence plumbing, not general server-side copy-on-write/reference storage. No changes under kernel/, no storage-schema/version migration, no config surface change, and no change to non-DSH callers' default prefix semantics. Wire/identity/persistence changes require human review; do not auto-merge.

The additive repair was applied and validated on the existing PR head 77a5a3861. The separate local Responses EOF meter-recovery commit f0b9a91b4 is deliberately NOT included. This branch has not been rebased onto current master; local checks are not a remote full-CI verdict or a merge-readiness claim.

Verification

On the exact clean PR-head baseline plus this additive patch:

  • npm run typecheck — passed.
  • npm run build — passed, including dist import-annotation/external checks; existing ignored-bare-import warning only.
  • node tools/check-architecture-docs.mjs and git diff --check — passed.
  • Targeted integration/compatibility matrix — 164/164 passed, zero skipped:
node --import ./tests/preload-test-env.mjs \
  --import ./tests/preload-storage-baseline.mjs --import tsx --test \
  tests/plugin-fork.test.ts tests/dsh-fork-adopt.test.ts \
  tests/issue4215-fork-gate-diagnostics.test.ts tests/plugin-protocol.test.ts \
  tests/pi-omp-fork-adopt.test.ts tests/fork-adoption.test.ts \
  tests/issue4829-zstd-fork-gate.test.ts

The matrix covers the common seeded gate, fresh-child negatives, historical cuts, zero-prefix insertion, later reasoning omission, nested originals/cold reload, file and signature drift before/after publication, tool-result ownership swaps, archived whole-pair ID reuse, broken ref proofs, unresolved retired media, legacy storage fallback, and non-DSH/proxy/plugin compatibility. Expected-red reproductions were run before fixing the unsafe cases.

A targeted read-only audit also ran the actual selector/hash helpers against the reported large-history shape: the large T2 blocks and complete nested closures become eligible when all hard-content witnesses match and only covered reasoning is absent. This is offline selector evidence, not a deployed fork/model test. No transcript contents or production store files are included.

Limitations / deployment boundary

  • Real Codex E2E was NOT completed: its zero-token preflight found the configured local upstream (127.0.0.1:8199/v1) unreachable. The gated core test was skipped, not passed.
  • Full regression is the remote GitHub CI result on the pushed head; local targeted tests do not replace it.
  • Production DSH/bili processes, installed profile and durable store were not restarted, upgraded or modified. Existing failed children were not repaired in place. No production-success claim is made.

@ranxianglei ranxianglei changed the title fix(dsh): adopt opaque fork snapshots by raw ids [PR] fix(dsh): adopt opaque fork snapshots by raw ids Nov 8, 2026
@ranxianglei

Copy link
Copy Markdown
Owner

🤖 Powered by ework · qwen3.8-27b

(ai: vllm-qwen/qwen3.8-27b)

标签: bug dsh scope/wiring p1(缺陷修复;DSH companion handoff 车道;改的是插件协议/宿主适配层而非 kernel;多模态父会话的 fork 子会话整条路径完全不可用 = 可用性缺陷,按口径定 p1)。

查重:不重复,但同家族,需与在途 PR #5602 协同。

完整审核结论(八问 + 回归清点)稍后在本线程给出——CI test lanes 仍在跑,我正在本地做定向验证与代码审查。

@ranxianglei ranxianglei added bug Something isn't working dsh p1 scope/wiring labels Nov 8, 2026
@ranxianglei

Copy link
Copy Markdown
Owner

🤖 Powered by ework · qwen3.8-27b

(ai: vllm-qwen/qwen3.8-27b)

PR #5962 审核结论(八问)

1. 是什么问题
父会话含多模态/不透明内容(图片、音频等)时,fork 出来的子会话永久不可用:fork 快照因「文本不可比」返回 409,采纳失败后退化成整段 raw-history 重放,重放又被 provider 拒绝(400 空 tool-call arguments / 413 超大)。

2. 什么原因导致的
根因在身份基础单一:fork 协议只认「文本投影 + 内容 hash」这一种前缀匹配方式。不透明内容在 kernel 里被投影成常量标记,没有可比文本 → publicSnapshotTextComparable=false → 409 SNAPSHOT_UNAVAILABLE → 退化。但 DSH 新构建的 fork 子会话是逐字复制父会话事件对象重放的,而消息 id 由 kernel deriveMessageId 从内容确定性派生(sha256(role|contentType|toolCallId|toolName|text) + 同身簇序号,kernel/src/wire/message-id.ts)——同一事件在父子两侧必然派生出同一 rawId。一条更稳的身份通路一直存在但没被利用,409 的守卫把唯一的出路堵死了。

3. 影响范围与严重程度
仅命中「DSH + 新构建(forkSource 坐标)+ fork 含不透明内容的父会话」这一交集:该路径完全不可用(p1 可用性缺陷)。legacy DSH 构建(只有 parentSession)、其他宿主、文本可比父会话全部不受影响——它们的行为与 master 逐字节一致(见第 5 问清点)。

4. 怎么修复的
加一条显式 raw 身份通道,证据限定、处处 fail-closed:

  • 客户端(dsh-native):verdict 解析 adoption-only 的 forkSource.sessionId(严格校验:非空字符串、boundary 必须 null 或 ≥0 安全整数,-0 显式拒绝;畸形整体回退 legacy 语义);仅当持有 forkSource 坐标(allowOpaque)且收到 409 SNAPSHOT_UNAVAILABLE 时,重试一次 GET snapshot?mode=raw,按稳定 rawId 逐位匹配共同前缀,以 protocolVersion:2 + comparison:"raw" 提交。重试预算有界(最坏 2 GET + 2 POST),其他错误码不触发重试。
  • 服务端(plugin.ts):raw 模式只绕过文本可比性守卫(!rawComparison && comparable===false),其余一致性检查全数保留且与文本模式同一代码路径——parentRevision(含 v1 过渡回退)、分支点三重校验(orderHash + 服务端自算前缀的 stableJson 逐字节相等)、raw/ref/CCR 映射、block 完整性、retention cap。客户端匹配只是「切点选择」,正确性权威始终在服务端:提交的 orderedMessages 必须是服务端自己算出的前缀原样回声,篡改/过期/漂移一律 409 BRANCH_POINT_CONFLICT。
  • 我独立核对了 id 来源:两侧都用同一个 kernel openaiToCore 投影,rawId 匹配等价于内容级匹配的另一投影,不存在「只信客户端」的窗口。

5. 是否有回归问题
逐项清点过既有行为,全部保持:

  • GET snapshot 文本模式:唯一调用方 admin.ts,未带 mode 参数时行为逐字节一致;
  • POST fork v1/v2 文本路径:parseForkRequest 新增的拒绝只针对「v1+comparison:raw」这种此前不可能存在的载荷形态,既有载荷走原路径;
  • forkSnapshot 文本响应:不带 comparison 字段,输出不变;
  • 非 raw fork 的子会话创建:latch=true、childRevision 计算与 master 一致(master 是无条件 true,现在是非 raw 时仍为 true);
  • dsh verdict 矩阵:legacy header 形状的 verdict deepEqual 不变(测试钉住);
  • 非 DSH 宿主(pi/omp/opencode 等):不走 allowOpaque,raw 重试永不触发;
  • 新客户端 × 旧服务器:旧服务器忽略 mode=raw 参数 → 409 或文本快照 → 自然收敛回 legacy 路径,rollout-safe;反向同理;
  • kernel/、pi-subagents/ 零改动;无新配置/env;dist-external 通过(无新运行时依赖);architecture 页不涉及 plugin fork 协议(该协议文档在 plugin-protocol.md,已更新)。
    本地验证:5 个相关测试文件 96/96 通过、typecheck 通过、build 通过(dist-import-annotations/dist-external OK)。CI:30 项检查 0 failed,test shards 仍在跑(13 pending),绿了我会补一句确认。

6. 是否破坏缓存
不涉及。不动 prefix-cache 相关路径;fork 子会话继承父会话 ref 空间的克隆逻辑(含死引用保留、BLOCKED_REF 哨兵)是既有机制,raw 模式未改。

7. 是否改了设计方向
没有转向,而是把 #5595 线程「🔶 待决 2 —— 前缀部分采纳」落成了一个有证据限定的实现:只放开 DSH forkSource 坐标(遵循 KDD #9 evidence-permitlist 纪律),不整体放开 legacy 路径;通用方案(CoW reference fork)继续 defer(PR 描述已注明)。该决策项当时推荐 B(暂不做),现在有了限定版方案,请你在拍板时一并考虑。

8. 是否引入了新的配置
无配置项。新增 wire 面均为加法且双向兼容:GET query mode=raw;POST body 可选 comparison:"raw"(强制 protocolVersion 2);snapshot 响应可选 "comparison":"raw"。

行为变更披露(old → new,均有意)

质量门(⑤b)结论:测试是真测试——正负双向(gate 纪律 #3617)、HTTP 级 E2E、临时端口(listen(0))、断言有牙(raw 重试只在 SNAPSHOT_UNAVAILABLE+allowOpaque 时发生且恰好一次、strict 调用方一次即停、child latch 状态、孙链 raw 快照可用)。一处小提醒(不拦合并):forkSource.boundary 被严格校验并带入 verdict(测试钉住形状),但本 PR 内尚无下游消费者(只用存在性决定 allowOpaque)——可理解为 companion handoff 的预留管线,建议后续要么用起来要么补一行 reserved 说明。

合并协调:与在途 PR #5602 都动 src/plugin.ts 的 forkSnapshot 附近,后合者需 rebase 后看 CI;两者互补(#5602 兜住仍会退化的 legacy/其他宿主路径,#5962 让新 DSH 路径不再退化),#5595 的完整闭环 = 两者 + 待决 1(kernel 侧空 arguments 守卫,人工档)。

判定:代码审查通过,方向正确(修的是守卫本身而非症状),质量达标。§7.4 自动合并不适用(触碰插件 wire 协议新字段 + 会话绑定逻辑 = human-only tier),请人工合并;建议等 CI test shards 全绿后合入。

@ranxianglei

Copy link
Copy Markdown
Owner

🤖 Powered by ework · qwen3.8-27b

(ai: vllm-qwen/qwen3.8-27b)

CI 全绿确认:PR #5962 全部 30 项检查通过(0 failed / 0 pending),含 ubuntu/windows × node22/24 的 test shards 与全部静态门禁。审核结论不变:代码审查通过、本地定向验证 96/96 + typecheck + build 绿,可合并(§7.4 human-only tier,请人工合并;与在途 PR #5602 先后合入时后者需 rebase)。

@ranxianglei

Copy link
Copy Markdown
Owner

🤖 Powered by ework · qwen3.8-27b

(ai: vllm-qwen/qwen3.8-27b)

PR #5962 冲突已解决:4 个 PR 提交 rebase 到当前 master 并推送,mergeable 已恢复。

1. 是什么问题
PR 分支(11-08 切出,4 个提交)与 base 分支冲突,GitHub merge state = dirty,阻塞合并。

2. 什么原因导致的
PR 分支切出后未 rebase(PR 正文自述 "This branch has not been rebased onto current master");期间 master 前进了 1431 个提交,其中在 reference/architecture.md 的文件地图区与 PR 的改动落在同一行域(master 新增 toml-integer.ts 行,PR 改写 plugin.ts 行描述),产生文本冲突。

3. 影响范围与严重程度
仅本 PR 的可合并性受阻,不影响任何已合入代码的行为。冲突面很小:PR 触碰 21 个文件,只有 1 个文件文本冲突,其余 20 个 git 自动合并。

4. 怎么修复的
把 4 个 PR 提交逐个 rebase 到当前 master(259cd87);唯一冲突 reference/architecture.md 按并集解决(保留 master 新增的 toml-integer.ts 行 + PR 更新后的 plugin.ts 描述);推送前按纪律 fetch 了 PR head 远端(仍为 9508aeb,无并行新提交),然后 force-with-lease 推回 PR head 分支。rebase 后 head = 3702a3e,作者身份(2772780896)与提交信息原样保留。

5. 是否有回归问题
自动合并的热文件(src/plugin.ts、src/persist.ts、src/session.ts、src/storage/shadow.ts、src/server/handle.ts、src/agent/dsh-native.ts、tests/plugin-fork.test.ts)无文本冲突;本地定向验证全过:typecheck 通过、build 通过(dist-import-annotations / dist-external OK)、PR 自带的 7 个 fork 相关测试文件定向矩阵 165/165 全过(覆盖 raw fallback、durableFork 协议、fork adoption、负向 gate)、tools/check-architecture-docs.mjs 全绿、git diff --check 干净;src/plugin.ts 中 PR 新增的 raw comparison / durableFork / capabilities 广告(386 行新增)逐一核对完整。最终裁决以远端 CI 全量为准。

6. 是否破坏缓存
不涉及——本轮只做分支 rebase 与冲突解决,未改任何代码语义,缓存/重试/增量游标逻辑零改动。

7. 是否改了设计方向
没有。rebase 不改变 PR 方案(DSH seeded 子会话统一 adoption gate + durableFork 身份证据 + opaque raw fallback);未改动 PR 作者的任何代码内容,唯一冲突是文档行,按并集解决。

当前状态:PR mergeable = True,merge state = blocked(CI 正在新 head 3702a3e 上重跑,checks 排队/运行中)。若 CI 出现红项,我会在后续轮次(自动修复 lane,本轮 1/3)继续处理。

@ranxianglei

Copy link
Copy Markdown
Owner

🤖 Powered by ework · qwen3.8-27b

(ai: vllm-qwen/qwen3.8-27b)

本轮为重复唤醒,冲突已在上一轮解决——本轮只做活体核验,未重做 rebase。

唤醒消息里的 "merge state: dirty" 是排队时的旧快照。本轮对 GitHub 活体核验(非记忆、非旧评论):

  • PR head = 3702a3ecac(上一轮 rebase 后的新 head),base = 259cd87674(当前 master 顶点);
  • mergeable = True,mergeable_state = blocked —— 冲突已消除;"blocked" 仅表示新 head 的 required checks 尚未跑完,不是冲突;
  • 镜像缓存还停在旧 sha(9508aeb670,fetched_at 2026-11-10),新 head 的 checks 尚未入库,无法在本轮断言其红绿——按纪律如实报告,不猜。

七问(本轮)

  1. 是什么问题:唤醒报告 PR 与 base 冲突(dirty);活体验证显示冲突已不存在。
  2. 什么原因导致的:唤醒消息生成于上一轮 force-push 传播之前,携带的是推送前的旧 merge state。
  3. 影响范围与严重程度:无新增影响;PR 可合并性已恢复,当前唯一阻塞是 CI 在新 head 上重跑中。
  4. 怎么修复的:本轮未做修复(无需修复);上一轮已完成 rebase + 唯一冲突(reference/architecture.md 并集解决)+ force-with-lease 推送,本轮仅核验。
  5. 是否有回归问题:不涉及——本轮零代码改动;上一轮的回归清点(165/165 定向矩阵 + typecheck + build + architecture-docs)结论不变。
  6. 是否破坏缓存:不涉及。
  7. 是否改了设计方向:没有。

当前状态:等待新 head 3702a3ecac 的 CI 结果(镜像缓存约 60s 一刷,test shards 需更久)。若出现红项,自动修复 lane 会再次唤醒我处理(本轮计 1/3)。

ranxianglei pushed a commit to 2772780896/billion-context that referenced this pull request Nov 12, 2026
@ranxianglei

Copy link
Copy Markdown
Owner

🤖 Powered by ework · qwen3.8-27b

(ai: vllm-qwen/qwen3.8-27b)

CI 红项已修:unused-exports 门禁失败,一行修复已推上 PR 分支(a11b67f)。

本轮先活体验证:镜像缓存(新 head 3702a3e)显示 30 项检查 0 pending、恰好 1 红 = unused-exports,其余全绿——与唤醒报告一致,未重复处理。

七问

  1. 是什么问题:CI unused-exports 门禁失败——src/plugin.ts 导出了 forkDurableMessageIdentities,但全仓库没有任何模块 import 它。
  2. 什么原因导致的:PR 新增的 durableFork 身份计算 helper 被习惯性加了 export,但它只在 src/plugin.ts 文件内部使用(3 个调用点:1398、1899、1905 行),对外无消费者——属于门禁分类里的 INTERNAL_ONLY(误加 export,非死代码)。
  3. 影响范围与严重程度:仅 CI 门禁红,零运行时影响——该函数无外部 import 方,去掉 export 不改变任何行为(同模块内调用不受影响)。
  4. 怎么修复的:按门禁给出的三选项中的 INTERNAL_ONLY 路径,删掉 src/plugin.ts:1311 声明前导的 export 关键字,一行改动;未动函数逻辑、未加 WAIVERS 豁免(豁免只留给有理由的对外面,这里没有理由)。
  5. 是否有回归问题:无。修复前本地跑门禁脚本 node scripts/check-unused-exports.mjs → "✓ unused-export gate: clean (12 waived)" 通过;全仓 grep 确认无 import 方,删除 export 不触达任何调用路径;其余 29 项检查上一轮已绿,本修复不改任何运行时代码语义。
  6. 是否破坏缓存:不涉及。
  7. 是否改了设计方向:没有——纯可见性修正,PR 方案与代码逻辑零改动。

当前状态:修复 commit a11b67f88e 已增量推送(推送前 fetch 确认远端 head 仍为 3702a3e,fast-forward 无冲突)。CI 将在新 head 上重跑,unused-exports 应转绿;若再出红项,自动修复 lane 下轮继续(本轮计 1/3)。

@ranxianglei

Copy link
Copy Markdown
Owner

🤖 Powered by ework · qwen3.8-27b

(ai: vllm-qwen/qwen3.8-27b)

重复唤醒:报告的红项已在上一轮修复,本轮活体验证后不再动手。

唤醒消息指向旧 head 3702a3ecac 的 unused-exports 失败(job 131436686216)——该修复 commit a11b67f88e(删 src/plugin.ts:1311 的 export)上一轮已推送。本轮活体验证:

  • PR head 已是 a11b67f88e,mergeable = True;
  • 镜像缓存(新 sha)显示 0 failed、19 pending——全部检查在新 head 上排队/重跑中,unused-exports 也在其中,当前无任何红项;
  • 按纪律不提前断言绿:等 19 项跑完,若再出红项,自动修复 lane 下轮处理。

ranxianglei pushed a commit to 2772780896/billion-context that referenced this pull request Nov 12, 2026
@ranxianglei

Copy link
Copy Markdown
Owner

🤖 Powered by ework · qwen3.8-27b

[bot] 🏷 (ai: vllm-qwen/qwen3.8-27b)

3 个 test shard 红(shard 3 × ubuntu-24/22 + windows-22)已修,新 head 9413219534。

七问

  1. 是什么问题:三条红车道是同一组失败——tests/wire-contract-golden.test.ts 的 manifest-default.json / manifest-optin.json 两个 golden 快照比对失败。三个平台都挂在 shard 3,因为该测试文件在分片划分里固定落在 shard 3,所以是确定性红,不是 flake。
  2. 什么原因导致的:PR 自己在插件 manifest 的 fork capabilities 里新增了 durableFork: true(src/plugin.ts:1109,durable fork protocol-2 功能的一部分),但作者没有重新生成 wire-contract golden 快照——门禁要求字节级一致,多出的 27 字符能力行立即触发漂移。不是 master 继承红:我把生成 manifest 与 committed golden 做了全量逐行 diff,两个文件各自唯一差异就是这一行;kernel.json / bili.json golden 全绿;CI 日志里疑似的 decompress 描述漂移实为 diff 行号错位带出的上下文行,非真实漂移。
  3. 影响范围与严重程度:仅 CI 信号层面。golden 门禁的设计目的就是抓「未声明的 schema 变更」,这次它正确地抓到了 PR 漏声明的变更;无用户可见行为影响(durableFork 能力正是 PR 意图暴露的内容)。
  4. 怎么修复的:跑官方重生成脚本 node --import tsx scripts/update-wire-contract-goldens.ts,用 git diff 逐行核实变更恰好是 2 行(两个 manifest golden 各 +1 行 "durableFork": true,,kernel.json/bili.json 字节级未变),提交推送。
  5. 是否有回归问题:逐项审过——golden 变更是纯快照同步,零源码改动;本地 golden 套件 5/5 绿;无语义漂移、无 fail-fast 变吞错、无阈值/时序/输出格式变化。
  6. 是否破坏缓存:不涉及。
  7. 是否改了设计方向:不涉及。

schema 变更声明(门禁要求 golden 重生成附理由):唯一 schema 变更是 fork capability 块新增 durableFork: true——PR 自身引入的能力声明,durable fork protocol-2 的对外暴露面,golden 只是补快照。

CI 状态:新 head 已推送(git 确认 a11b67f88e..9413219534),3 条 shard 3 车道将重跑;其余车道在旧 head 上已绿、不受影响。镜像缓存尚未刷新到新 head(轮询周期 ~60s),以 GitHub 上 push 触发的 run 为准。已按 CI 总控政策在 #4599 留一行结论。

@ranxianglei

Copy link
Copy Markdown
Owner

🤖 Powered by ework · qwen3.8-27b

[bot] 🏷 APPROVE — 已独立审完 host 侧全部改动(23 文件,+1742/-93,无 kernel/ 或 pi-subagents/ 改动,不触发 kernel 人工审核档;head 9413219 CI 绿)。未照抄 issue 侧结论,diff 逐段读过(fork 协议 / durable 身份哈希 / 块选择 / 漂移重验四个高危域)。

方向(①): 修的是根因——缺一条能按稳定 rawId + 不透明内容身份做比对的继承路径,不是治标。DSH forkSource 子会话在父会话含多模态/不透明内容时,旧文本快照比对必然 409 SNAPSHOT_UNAVAILABLE → 放弃继承 → 全量重放 → 不可重试 413。新路径(comparison:"raw" + durableFork)只绕过不透明文本可比性守卫,一致性检查(父 revision / 分支点 / refs / CCR / 块完整性)全保留。

回归(②) 逐项过:

  • legacy 文本比对路径不变:forkSnapshot 的 rawComparison 是可选参数,!rawComparison 守卫保证非 raw 走原逻辑;
  • 非 DSH forkSource 调用方不受影响:raw 重试仅 allowOpaque 且 409 SNAPSHOT_UNAVAILABLE 时触发,最多 1 次 GET+POST;
  • 行为变更 B1(已披露):raw/durable 子会话标记 publicSnapshotTextComparable=false,其后续文本 fork 也 409,孙链必须用 raw;
  • 行为变更 B3(已披露):日志 no usable parentSession → no usable parentSession or forkSource;
  • ref 克隆新增跳过 BLOCKED_REF(正确,该 ref 不应克隆);
  • 无 fail-fast 变吞错、无阈值/时序/输出格式漂移。

代码(③): durableForkSelection 全程 fail-closed(账本不可用 / digest 歧义 / 媒体未解析 / 块不完整 → null → 409 DURABLE_FORK_UNAVAILABLE → 客户端降级 legacy);reconcilePublicForkInput 每轮(含冷恢复)重验 durable receipt,漂移时先移除受影响块和消费者再渲染;durableFork 能力由 getStore().replicasAvailable() 门控(账本不可用则不宣告,客户端走原前缀协议)。

测试(④): 客户端/服务端 durable 身份哈希有 parity 测试钉死(forkDurableIdentityHashOf === forkDurableMessageIdentityHash,dsh-fork-adopt.test.ts:57/77/101);不透明内容检测、工具配对 fail-closed(重复/歧义/缺 id/换所有权 → 空哈希)、raw 前缀匹配、raw 快照回退(仅 allowOpaque)、durable 证据转发(能力门控)全有正+反例(门控纪律 #3617);服务端选择 + reconcile 漂移有 600 行测试。

diff 整洁度(⑤/⑤b): 23 文件全部与本 PR 目的相关,无跑题文件/生成物/锁文件连带变更;无 as any/@ts-ignore/console.error/process.env;命名达意、无死代码;服务端/客户端 durable 身份哈希重复是已知结构性约束(宿主 bundle 禁 import server 模块,KDD #17),parity 测试钉死;无新依赖。

8问:

  1. 是什么问题: DSH fork 子会话的父会话含多模态/不透明内容时,旧文本快照比对返回 409 SNAPSHOT_UNAVAILABLE,插件放弃继承、全量重放历史,导致不可重试的 413。
  2. 什么原因导致的: 文本快照比对只能验证文本投影,无法验证不透明内容(图片、file_id、签名等),对含多模态内容的父会话必然失败;根因是缺少一条能按稳定 rawId + 不透明内容身份做比对的继承路径。
  3. 影响范围与严重程度: 仅 DSH forkSource 子会话且父会话含不透明内容时触发;严重到无法继承(413 不可重试),用户需全量重放。
  4. 怎么修复的: 新增 comparison:"raw" 模式 + durableFork 能力:服务端按 durable 身份哈希(含不透明载荷、签名、工具配对)从统一账本选择完整块闭包,客户端在 409 SNAPSHOT_UNAVAILABLE 时带 rawId + 身份证据重试;只绕过不透明文本可比性守卫,不绕过一致性检查;全程 fail-closed。
  5. 是否有回归问题: legacy 文本比对路径不变;非 DSH forkSource 调用方不受影响;B1/B3 已披露;ref 克隆跳过 BLOCKED_REF 正确;无 fail-fast 变吞错、无阈值/时序/输出格式漂移。
  6. 是否破坏缓存: 不破坏。durable fork 子会话继承父会话完整 issued-ref 命名空间(含 dead refs),refs 永不复用;无缓存/重试/增量游标失效。
  7. 是否改了设计方向: 没有。Fork adoption fails on multimodal parents, then degrades into a raw-history rebuild that the provider rejects (400 InvalidArgument) — the forked session stays unusable #5595-thread「待决2 前缀部分采纳」的受限实现,沿用 evidence-permitlist 纪律(KDD release v0.1.2 #9),与在途 PR [PR] fix(#5595): keep fork children sendable when raw-history rebuild emits empty tool-call arguments #5602(降级路径修复)互补。
  8. 是否引入了新的配置: 没有。无新 env/config/默认值;durableFork 能力由 getStore().replicasAvailable() 门控。

判定: 可合。无小修项(代码/注释/测试已整洁,未发现 typo/坏谓词/小边缘)。

@ranxianglei ranxianglei left a comment

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

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

APPROVE — host-side change (no kernel/ or pi-subagents/). Reviewed the full diff (23 files, +1742/-93). The durable-fork protocol is correct and fail-closed: raw mode bypasses only the opaque text-comparability guard, not consistency checks; durableFork capability is gated by replicasAvailable(); client/server durable identity hash is parity-pinned (dsh-fork-adopt.test.ts). Regression surface checked: legacy text path unchanged, non-DSH callers unaffected, behavior changes B1/B3 disclosed. Tests cover parity, opaque detection, tool-pair fail-closed, raw fallback, capability gating. No small findings. Full 8-question checklist in the issue thread.

@ranxianglei

Copy link
Copy Markdown
Owner

🤖 Powered by ework · qwen3.8-27b

[bot] 🏷 复核完成,已 APPROVE(非卡住,工作已交付)。

  • 正式 GitHub review 已提交:APPROVE(id 5886513402,head 9413219)。
  • 完整 8问 + 回归清单见上一条评论。
  • 无小修项;无 kernel/ 改动(不触发 kernel 人工审核档);CI 在 head 绿。

协调 issue:任务未给编号,我按 "coordination review lane" / "5964" 等关键词搜不到对应线程。如本 review lane 有专门协调 issue,请给编号,我补一行完成报告。

@ranxianglei
ranxianglei force-pushed the 2026-11-08_dsh-fork-source-adoption branch from 9413219 to 7000d49 Compare November 14, 2026 00:21
ranxianglei pushed a commit to 2772780896/billion-context that referenced this pull request Nov 14, 2026
ranxianglei pushed a commit to 2772780896/billion-context that referenced this pull request Nov 14, 2026
@ranxianglei

Copy link
Copy Markdown
Owner

🤖 Powered by ework · qwen3.8-27b

(ai: vllm-qwen/qwen3.8-27b)

PR #5962 冲突已解决:6 个 PR 提交 rebase 到当前 master 并推送,mergeable 已恢复(True)。

七问

  1. 是什么问题:PR 分支与 base 分支冲突(merge state: dirty),阻塞合并。
  2. 什么原因导致的:PR 分支钉在旧 base(259cd87674)上,期间 master 前进了 44 个提交(含 BILI_PLUGIN_BYPASS x-bili-plugin-bypass: 1 Allow forced specification | x-bili-plugin-bypass: 1 允许强制指定 #6220 等),分支落后并与 master 新改动冲突。上一轮(卡死重启前)已在本地把分支 rebase 到中间 master(243709bef2)但未推送,远端 PR 仍停在旧 base。
  3. 影响范围与严重程度:仅本 PR 可合并性受阻,不影响任何已合入代码。冲突面很小:PR 触碰 23 个文件,唯一与 master 新改动重叠的文件是 src/server/handle.ts,且两处改动落在文件不同区域(PR 的 reconcilePublicForkInput fork 输入协调 vs master 的 BILI_PLUGIN_BYPASS 旁路覆盖),无语义冲突。
  4. 怎么修复的:把 6 个 PR 提交 rebase 到当前 master(fcc2e84848),零文本冲突(handle.ts 两处改动在不同区域,git 自动合并);force-with-lease 推回 PR 分支(推送前 fetch 确认远端 head 仍为 9413219,无并行提交)。本地定向验证全过:typecheck 通过、122 个 fork/dsh 测试全过、5 个 wire-contract golden 全过、unused-exports 门禁干净、8 个 plugin-bypass 测试全过(专门验证 handle.ts 上 PR 与 master 改动共存)。
  5. 是否有回归问题:无。rebase 零文本冲突,PR 改动 byte-identical(23 文件,1742 增 / 93 删,与上一 CI 绿态一致);唯一重叠文件 handle.ts 的 PR 改动(fork 输入 reconcile)与 master 改动(BILI_PLUGIN_BYPASS)语义独立,已用 plugin-bypass 测试确认共存。无 fail-fast 变吞错、无阈值/时序/输出格式漂移。
  6. 是否破坏缓存:不涉及——本轮只做分支 rebase,未改任何代码语义。
  7. 是否改了设计方向:没有——rebase 不改变 PR 方案(DSH seeded 子会话 adoption gate + durableFork 身份证据 + opaque raw fallback),未改动 PR 作者任何代码内容。

当前状态:PR mergeable = True(冲突已消除),state = behind——master 在我 rebase 后又前进了 14 个提交到 e1f31ad(纯 SQLite 默认等),无冲突,合并时自然收敛。CI 在新 head 7000d49764 上运行中(25 项 queued,0 failed)。若 CI 出红项,自动修复 lane 下轮继续(本轮计 1/3)。

@ranxianglei
ranxianglei force-pushed the 2026-11-08_dsh-fork-source-adoption branch from 7000d49 to eb0557d Compare November 15, 2026 15:58
ranxianglei pushed a commit to 2772780896/billion-context that referenced this pull request Nov 15, 2026
ranxianglei pushed a commit to 2772780896/billion-context that referenced this pull request Nov 15, 2026
ework-agent and others added 8 commits November 16, 2026 22:51
…ns {3,5,11,14}

The probe anchor PROXY_TOOL_AT=6 was calibrated on 2026-10-31 for ranxianglei#4521
(schedule {4,6,8,9}). The nudge scheduling has shifted again — nudge now
lands at {3,5,11,14}. Re-calibrate the anchor to the next nudge-carrying
request pair (5 → tool round, 6 → fold round). The fold/proxy-tool-round
mechanics under test are unchanged.

Closes: master-red on test (windows-latest, 22, 3) and (ubuntu-latest, 22, 1).
…ic wire shape

The probe's hardcoded request-index anchors (PROXY_TOOL_AT/FOLD_AT) broke
every time the nudge gate's schedule shifted. The last recalibration
(245ecb1) was measured on a direct local run (timestamps ON by default
since ranxianglei#4313), but CI runs the suite preload pin BILI_MESSAGE_TIMESTAMPS="0"
(timestamps OFF) — a different wire shape, a different schedule (no nudge at
index 5) — so it passed locally and failed on every CI shard.

Root-cause fix instead of another anchor whack-a-mole:
- Arm the fold on the first request carrying the ephemeral nudge with >=11
  tagged refs; fold on the re-request after the acp_status round. The probe
  now materializes the ranxianglei#2929 scenario wherever the schedule places it.
- Pin compress.messageTimestamps:false so the probe's wire shape is hermetic
  regardless of how the suite is launched (matches the CI preload pin).

Supersedes the 245ecb1 recalibration. Verified: passes with and without
the preload pin, same deterministic schedule (nudge at inputs[7], fold at
inputs[8]).
Verify bounded child identities and complete tool pairs against parent history, preserve covered reasoning omissions, and revalidate inherited state before every send. Keep legacy storage and non-DSH prefix semantics intact. Refs ranxianglei#5595.
@ranxianglei
ranxianglei force-pushed the 2026-11-08_dsh-fork-source-adoption branch from eb0557d to 22be19d Compare November 17, 2026 01:29
@ranxianglei

Copy link
Copy Markdown
Owner

🤖 Powered by ework · qwen3.8-27b

[bot] 🏷 (ai: vllm-qwen/qwen3.8-27b)

PR #5962 冲突已解决:6 个 PR 提交 rebase 到当前 master(301e1a54)并推送,mergeable 已恢复(True / blocked,不再是 dirty)。

七问

  1. 是什么问题:PR 分支与 base 分支冲突(merge state: dirty),阻塞合并。
  2. 什么原因导致的:PR 分支钉在旧 base 上,期间 master 快速前进(本会话内 26d9bcc → f648217 → 301e1a5,共移动三次),分支落后并与 master 新改动在 src/server/handle.ts 上产生冲突。
  3. 影响范围与严重程度:仅本 PR 可合并性受阻,不影响任何已合入代码。本轮唯一文本冲突是 src/server/handle.ts 的 import 行——master 新增了 PLUGIN_PURPOSE_CONVERSATION / pluginPurposeHeader(plugin purpose 功能),PR 新增了 reconcilePublicForkInput(fork 输入协调),两边改同一行 import,git 无法自动合并;无语义冲突。
  4. 怎么修复的:把 6 个 PR 提交 rebase 到当前 master(301e1a54),唯一冲突按「并集」解决——同时保留 master 的 PLUGIN_PURPOSE_CONVERSATION/pluginPurposeHeader 和 PR 的 reconcilePublicForkInput(三个符号在文件里都有实际使用点)。其余重叠文件(plugin.ts / persist.ts / shadow.ts / plugin-fork.test.ts / architecture.md)本轮自动合并无冲突。force-with-lease 推回 PR 分支(推送前 fetch 确认远端 head 仍为 eb0557d,无并行提交)。本地定向验证全过:typecheck 通过、123 个 fork/dsh 测试全过、5 个 wire-contract golden 全过、unused-exports 门禁干净、8 个 plugin-bypass 测试全过(专门验证 handle.ts 上 master 与 PR 改动共存)。
  5. 是否有回归问题:无。rebase 仅 1 处 import 行冲突,按并集解决(不删任何一方的符号);PR 改动内容 byte-identical(23 文件,1738 增 / 89 删,与上一 CI 绿态一致)。无 fail-fast 变吞错、无阈值/时序/输出格式漂移。
  6. 是否破坏缓存:不涉及——本轮只做分支 rebase + import 并集,未改任何代码语义。
  7. 是否改了设计方向:没有——rebase 不改变 PR 方案(DSH seeded 子会话 adoption gate + durableFork 身份证据 + opaque raw fallback),未改动 PR 作者任何代码内容。

当前状态:PR mergeable = True,mergeable_state = blocked(不再是 dirty——冲突已消除;blocked 是分支保护要求 CI 通过 + review,属正常待办)。推送时 master 恰好停在 301e1a5(未再移动),所以 head 基于当前 master,不是 behind。CI 在新 head 22be19da 上运行中。

说明:本会话内 master 移动了三次、工作环境重置了两次(需重新建立 remote/分支),均已完成处理。本轮按 CI-hold 策略以「最终 head」推送(未带 [ework:ci-held]),因为本地已验证且 master 停在 301e1a5,这是应触发一次完整 CI 的最终提交。若 CI 运行期间 master 再移动导致重新 dirty,自动修复 lane 下轮(2/6)继续 rebase。

@ranxianglei

Copy link
Copy Markdown
Owner

🤖 Powered by ework · qwen3.8-27b

(ai: vllm-qwen/qwen3.8-27b)

CI fix — PR #5962 (mirror #5964). Re-verified live first: the 3 reported shards were all failure (not a stale report), and they all failed on the same test — tests/issue2929-codex-fold-double-miss.test.ts → #2929: nudge + proxy-tool-round fold keeps re-request/next-turn byte-stable (scenario miss: no ephemeral nudge in the pre-fold request).

This is an inherited master failure, not a PR regression. The PR diff does not touch that test file. #4599 (CI control) confirms master 301e1a545 is red on the exact same shards right now (floor 1534, 07:09Z) with the same #2929 error, and the fix already lives in the resident ci-fixes branch (72474109 + 245ecb1a: #2929 fold-probe schedule-independence + recalibrated anchor). Four other PRs (#5899 / #6993 / #6155 / #7015) handled this identical red the same way today.

Action taken: git merge origin/ci-fixes into the PR branch (clean, no conflicts) → new head 86f14df1. Verified locally before pushing: the targeted #2929 test now passes (pass 1 / fail 0, "probe OK: summary anchored … byte-identical through the anchor") and tsc --noEmit typecheck is clean. Pushed as the final head (no [ework:ci-held] marker) — this is the branch's one full CI pass. Awaiting CI rerun.

八问:

  1. 是什么问题:PR [PR] fix(dsh): preserve verified seeded context inheritance #5962 三个 test 分片(win22-4 / ubuntu24-3 / ubuntu22-3)全红,挂的是同一个用例 tests/issue2929-codex-fold-double-miss.test.ts 的 #2929: nudge + proxy-tool-round fold keeps re-request/next-turn byte-stable(报错 scenario miss: no ephemeral nudge)。
  2. 什么原因导致的:继承性 master born-red,非本 PR 引入——本 PR diff 不触及该测试文件;CI Control Center: Centralized CI Failure Handling & Status Sync (Comment all CI issues here; do not open new issues) | CI 总控: CI 失败集中处理与状态同步(所有 CI 问题在此评论, 勿开新 issue) #4599 floor 1534(07:09Z)确认 master 301e1a545 在同样三个分片上同签名红。根因是 codex 命中率问题分析 #2929 fold-probe 对调度/时序敏感,ci-fixes 的 72474109/245ecb1a(schedule-independence + 重标定 anchor)已修。
  3. 影响范围与严重程度:仅 CI 信号级(三个 test 分片红),无用户侧功能影响;master 自身同红,所有 rebase 到 master 的 PR 都继承此红。
  4. 怎么修复的:按 CI 协调政策(master 红 = 继承 → 不自行长时间排查、不在自己分支重复修 master 级失败),git merge origin/ci-fixes 进 PR 分支(干净无冲突),新 head 86f14df1;本地定向验证 codex 命中率问题分析 #2929 转绿 + typecheck 干净后推送。
  5. 是否有回归问题:无——merge 只带入 ci-fixes 的 master 级修复(codex 命中率问题分析 #2929 测试文件 + reference/architecture.md 一行模块图),不触碰本 PR 的 dsh-fork 源码改动;本地 codex 命中率问题分析 #2929 定向测试 pass 1/fail 0,typecheck exit 0。
  6. 是否破坏缓存:不涉及。
  7. 是否改了设计方向:不涉及。
  8. 是否引入了新的配置:不涉及。

判定:本 PR 的 3 红全部为继承性 master 红,已按政策 merge ci-fixes 收敛,本地验证绿,等 CI 重跑即转绿。

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working dsh p1 scope/wiring

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants