Repository navigation
fix: #2976 跟进(部分):canonFp lane gate (#2973) + dsh-lane atomic/case (#2972 M1/L3) - #2978
Conversation
📦 Built Package ArtifactBranch: Option A — Install this exact build (recommended)npm install -g billion-context@0.0.3374-pr.2978.cafb9dcThis exact version is immutable and reproducible. The rolling Option B — Download artifact
tar xzf billion-context-pr2978.tgz
npm install -g packageInstall instructions are refreshed on each push. |
#2973) settleUsageReport read METADATA_CANONICAL_SYS_FP unconditionally and passed it to recordCacheSample on every lane, but its sole writer is prepare-responses. Session metadata persists across turns AND lanes, so after a session switched responses->anthropic/openai/google the slot still held the last responses request's fp, mis-bucketing the #2867 host-rewrite-vs-proxy-projection attribution on every subsequent sample. Gate the read on the current request's wire (protocol === 'responses') via a pure helper; this settle path is the only reader of the slot. Regression test pins the lane gate off-Windows.
…profile match (#2972) M1: syncDshProfileManifestSpec wrote the host-owned dsh profile package.json with a bare writeFileSync - a crash/power-loss mid-write could leave a torn manifest with no self-heal path. Write atomically (tmp sibling + rename, same discipline as persist.ts #2674).\n\nL3: isDshDesktopBiliCopy matched the DSH_HOME anchor with a byte-exact startsWith; on Windows a DSH_HOME spelled with different casing than the resolved install dir silently skipped the #2894 manifest sync and misread the copy as pnpm-owned. Compare case-insensitively on win32 via an extracted pure predicate (unit-testable off-Windows).
…ire too (#2973) Same stale-slot family as the canon fp gate in c9cb878: the mode stamp's sole writer is prepare-responses, but settle read it for every lane, so a session that switched off the responses wire kept stamping its inert pm line field with the last responses request's label. The existing comment already documented the intent ('responses lane only; other lanes omit both') — this makes the code match it. pm has no consumers; diagnostic-only change.
…ane gate The suite's turn() helper defaulted to proto='openai' while modeling the Responses self-heal degrade — pre-gate that worked because settle read the canon slot unconditionally; post-gate 7 of 9 scenarios lost their canon fp and degraded to 'prompt' attribution (CI red on all four test jobs). - helper default proto -> 'responses' (the lane these scenarios model); the sparseness test's non-responses part now passes 'anthropic' explicitly - 'projection flip outranks a co-occurring wire switch': the old openai->anthropic shape is unreachable under the gate (a flip can only fire ON the responses lane) — reshaped as baseline-on-responses -> one-round anthropic detour -> return-to-responses co-firing the mode flip; the priority pin survives and the detour now books its own (zero-token, warm) wire event - new regression: stale canon + mode slots must not leak into a non-responses settle — a host edit on the anthropic wire after a responses history books 'prompt', never 'projection', and pm stays empty
69ca288 to
4fe8732
Compare
Review 完成。结论先行:三项修复方向都对,但 CI 是红的 —— lane gate 打破了 7 个既有 #2867 回归测试。已定位根因、当场修复(2 个标注 commit 推到分支,并 rebase 到最新 master),等 CI 转绿。 CI 红因(以及为何本地「全绿」没抓到)
我推的改动(原 2 commit 之上 +2,rebase 到含 #2971/#2979 的最新 master,零文件重叠、干净)
本地验证:typecheck 干净;定向三文件( 结构化八问
行为变更披露(补充 PR 正文):非 responses ledger 行的 判定:方向、diff 整洁度、测试有效性均通过;唯一余项是新 head 的 CI 结果。转绿后即可由 owner 合并(agent 不代合)。 |
📦 Merged Build PublishedThis merge to master was published as npm install -g billion-context@0.0.360-master.7ad3c1f # this exact build
npm install -g billion-context@master # always the newest merged build
|
Part of #2976(release v0.1.196 非阻塞跟进伞)。本 PR 处理其中自包含、低风险、诊断/约定类的三项;其余三项按性质分别延后/阻塞,均仍在 #2976 追踪(见「不在本 PR」)。分支从 v0.1.196(origin/master
d64139f9c)切出并 rebase 到当前 master,非陈旧基。本 PR 修复(3 项,2 commit)
#2973(C-F1)— cache-ledger canonicalSysFp 跨 wire 残留
settleUsageReport对所有 lane 无条件读METADATA_CANONICAL_SYS_FP并传给recordCacheSample,但该槽的唯一写入点是prepare-responses(仅 responses lane)。metadata 跨 turn/lane 持久,会话从 responses 切到 anthropic/openai/google 后槽里残留最后一次 responses 请求的 fp,把投影记账算进错误桶,削弱 #2867 的 host-rewrite vs proxy-projection 归因。修法:在唯一读取点(settle)按当前请求 wire(protocol === "responses")门控,抽成纯函数canonicalSysFpForSettle便于 off-Windows 单测。#2972-M1 — dsh profile manifest 非原子写
syncDshProfileManifestSpec用裸writeFileSync直写宿主(dsh)拥有的 package.json,写一半崩溃/断电 → 清单永久 malformed 且无自愈路径。改为 tmp sibling + rename(与 persist.ts #2674 同一纪律)。成功路径无可见变化,仅增强崩溃安全。#2972-L3 — isDshDesktopBiliCopy 大小写敏感(继承自 0.1.195)
前缀匹配用字节级
startsWith;Windows 上 DSH_HOME 大小写与解析出的安装目录不一致时会静默跳过 #2894 manifest 同步并误判为 pnpm-owned。win32 下改为大小写不敏感比较(抽成纯谓词dshDesktopCopyPathMatches可单测);POSIX 保持字节精确不变。不在本 PR(按性质分流,均在 #2976 追踪)
/__bili/status+/__bili/overview(用户可见输出面)暴露,涉及展示语义决策 → 建议方案已备,待 owner 拍板后再做。--frozen-lockfile调用,外部确认前置,无法单方面改代码。验证
npm run typecheck干净(kernel + pi-subagents 预构建通过,tsc --noEmit无错)。tests/cache-ledger.test.ts+tests/update-desktop-inplace.test.ts全绿(47 pass,含 3 个新增回归用例)。全量回归交 CI。配置面(八问第 8 项)
未新增任何 env/config/CLI flag —— 不涉及。