Skip to content

[PR] fix(#4797): root-cause fix for superseded live-key collision — restamp pruning + semantics-preserving guard translation | fix(#4797): superseded 活键碰撞根治——restamp 剪枝 + 守卫保义翻译 + 一次性标志修复 (kernel 0.0.166) - #4807

Merged
ranxianglei merged 13 commits into
masterfrom
2026-10-26_ref-chokepoint
Oct 26, 2026

Conversation

@ranxianglei

Copy link
Copy Markdown
Owner

(ai: zhipuai-lb/glm-5.3)

Fixes #4797

kernel-change: #4797 根治——ledger-alignment restamp 的 superseded 活键碰撞(owner 在 #4797 讨论中指定的 C→A→B 推土机方案,kernel 侧为其中 A/B 的必要部分)

一句话

代理重启(或 LRU 驱逐)触发一次性编号对齐后,压缩输入守卫把「活编号误判为已重编号」,会话永久压不了缩;根子是 superseded 表与活编号稠密碰撞 + 一次性标志每轮被克隆丢掉。

根因(phase-C 全量审计,两路并行)

  1. 碰撞带:restampRefsToLedger 腾出的旧号同轮被重用为别家消息的 seq+1 新号 → 稠密空间里几乎每个活编号同时是 superseded 键;守卫查表先于查活表,span 扫描命中即拒 → acp_status 吐同样的活号 → 结构性死循环(连代理自己的 preflight 自救也被拒)。
  2. 一次性不一次性:kernel syncBlocks/cloneState 克隆丢 refLedgerAligned → 每轮重排;host 只在 superseded 非空时覆盖 → 陈旧表进程内永生(inline 宿主一活几天)。
  3. 触发面:不止重启——LRU 驱逐的 getSession 内存 miss → loadSync → afterLoad 同样触发重排,「重启边界没有在途调用」的假设不成立。
  4. 审计产物已固化为登记文档 reference/ref-keyed-surfaces.md(所有按 ref 键控的面 + 迁移状态 + 防再犯清单)。

修法(C→A→B)

  • kernel 0.0.166(4 处):restamp 后剪枝「已复活的 superseded 键」;block startRef/endRef + deadRefs 随同一次迁移(保义翻译);syncBlocks/cloneState 携带 refLedgerAligned
  • host:supersededRefRejection 改为按端点解析的三级阶梯——活表优先保留 → 真空置号保义翻译(旧号→rawId→同一条消息的新号)→ 翻译死路才拒绝;applyRanges 用翻译后的区间继续并留日志;收敛后的空结果清除陈旧 map

验证

边界

  • 无 config 面变化、无 wire 形状变化;kernel 变更集中在 refs/sync/compress 三文件的 restamp 迁移与克隆携带
  • 对已被旧 kernel 重排过的存量会话:host 的活表优先阶梯单独即可解死锁(kernel 修复防的是未来的碰撞再生)——双保险

…mp map, identity-preserving guard translation, flag-safe clones

Root cause (phase-C audit, reference/ref-keyed-surfaces.md): the one-time
ledger-alignment restamp vacates old ref numbers and hands OTHER messages
seq+1 targets in the same sweep — in a dense space a superseded key is
routinely ALSO the live ref of a different message (exactly the numbers
acp_status advertises). The compress-input guard consulted superseded before
the live map, so it refused every advertised range and pointed the caller
back at acp_status — a structural dead loop; the proxy's own preflight rescue
was refused by the same gate. Additionally the kernel's syncBlocks/cloneState
dropped refLedgerAligned every turn, re-arming the restamp and keeping the
stale superseded map alive for the process lifetime.

Kernel (0.0.165 -> 0.0.166):
- restampRefsToLedger: post-pass prune of superseded keys that are live in
  the final map; block startRef/endRef and deadRefs now ride the same
  migration (identity-preserving translateRef via the pre-pass map)
- syncBlocks clone + cloneState carry refLedgerAligned (one-time stays
  one-time)

Host:
- supersededRefRejection reworked to a resolution ladder per ENDPOINT (the
  interior span-scan only manufactured false hits): live-first keep; vacated
  -> translate oldRef -> rawId -> same message's current ref; refuse only
  dead-end cites. applyRanges proceeds with translated ranges (logged)
- maybeRestampToLedger clears session.restampSuperseded on an empty outcome
  (a converged pass must not leave the previous map in place)

Tests: kernel ref-restamp-collision (3, RED on master) + seq-restamp S13a/S13b
re-pinned to the pruned-map contract + host issue4797 T1-T4 (T1/T2/T4 RED on
master in an isolated master worktree); kernel suite 1483/1483; typecheck 0.
@ranxianglei ranxianglei changed the title fix(#4797): superseded 活键碰撞根治——restamp 剪枝 + 守卫保义翻译 + 一次性标志修复 (kernel 0.0.166) [PR] fix(#4797): root-cause fix for superseded live-key collision — restamp pruning + semantics-preserving guard translation | fix(#4797): superseded 活键碰撞根治——restamp 剪枝 + 守卫保义翻译 + 一次性标志修复 (kernel 0.0.166) Oct 26, 2026
@ranxianglei

Copy link
Copy Markdown
Owner Author

🤖 Powered by ework · qwen3.8-27b

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

查重: 与 #4799 同族非纯重复——两者都关 #4797,但机制覆盖面不同,且改同一处守卫代码,互斥、只能落一个。

标签:bug / pi / scope/kernel / p1 —— 缺陷修复(pi 车道首报,触发面实为全车道重启/LRU)、kernel+压缩决策面、压缩整体停摆按 2026-10-19 规则 p1。

正在做完整 review(原 issue 方向核对 + kernel/host 逐段 diff + 回归面清点 + 测试有效性),结论按八问回复。

@ranxianglei ranxianglei added bug Something isn't working p1 pi scope/kernel labels Oct 26, 2026
…y residual)

Review of #4807 found the deadRefs migration in restampRefsToLedger is a
no-op for organic tombstones: a tombstone's number is absent from the
PRE-pass map by definition, so translateRef leaves it verbatim — even
when this very pass hands that number to another message as a seq+1
target. The stale tombstone then sits on a LIVE number and
excludeDeadRefRanges / markNoMergeAcrossDeadHoles over-filter ranges
around it (same collision band as superseded; safe direction, wrong
behavior — exactly what the registry doc flagged for this surface).

Drop tombstones the final map vends as live; empty ⇒ undefined per the
#3302 discipline. Re-pins the migration test (its old expectation
encoded the stale-tombstone end state) and adds organic pins:
re-granted dropped / genuinely-free kept / all-re-granted ⇒ undefined.

Rides the unreleased 0.0.166 bump already on this branch.
ci-check added 2 commits October 26, 2026 14:06
…ed in this PR

The audit table listed blocks[].startRef/endRef and state.deadRefs as NOT
yet migrated, but this PR's restamp pass translates both (kernel/src/refs.ts
translateRef pre-pass map, pinned by kernel/tests/ref-restamp-collision.test.ts).
Move them to the migrated table so the registry matches shipped code; the
remaining rows (hiddenOrphanRefs, latches, messages.ref_num) stay open.
@ranxianglei

Copy link
Copy Markdown
Owner Author

🤖 Powered by ework · qwen3.8-27b

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

PR review 结论(独立审核,代码级逐段验证 + 本地定向测试)

查重结论见首评(与 #4799 同族非纯重复,机制覆盖不同,处置待 owner 拍板)。本轮完成:kernel/host diff 逐段通读、根因手工推演复现、既有行为清单回归审查、定向测试、一处文档小修。

① 是什么问题:代理重启/LRU 驱逐触发 ledger-alignment restamp 后,压缩输入守卫把「活编号误判为已重编号」——acp_status 广告的区间被 compress 拒绝,会话永久压不了缩(p1 死锁,#4797)。

② 什么原因导致的(逐条在代码里验证成立):

  • 碰撞带:restamp 腾出的旧号同轮被 seq+1 重用为别家消息新号 → 稠密空间里几乎每个活编号同时是 superseded 键;旧守卫 span 扫描查 superseded 表先于查活表,命中即整段拒。我用 fixture 手工推演确认(e 腾出 m6 → f 的 seq+1 恰好落在 m6 → byRef[m6]=f 与 superseded[m6]=e 共存),不需要走到 displaced 分支,顺序本身就制造碰撞带。
  • 一次性不一次性:syncBlocks/cloneState 克隆 state 丢 refLedgerAligned → 每轮重排、陈旧表进程内永生。
  • 触发面:LRU 驱逐路径(evictOldest → getSession miss → loadSync → afterLoad → maybeRestampToLedger)代码核实存在,「重启边界无在途调用」假设不成立。

③ 影响范围与严重程度:p1。任何跨过触发边界(代理重启、unified 冷载、strictly-ahead 恢复、会话中途 LRU 驱逐)且旧编号被重排的会话,压缩能力永久失效——包括代理自己的 preflight 自救也被拒;未跨边界的会话不受影响。

④ 怎么修复的(机制层面):

  • kernel 0.0.166 post-pass 剪枝:终局 map 中解析为活的 superseded 键一律丢弃(不变量「活号永不 superseded」);block startRef/endRef + deadRefs 随同一 translateRef 预迁移(保义翻译:旧号→rawId→同一条消息的新号);syncBlocks/cloneState 携带标志。
  • host 守卫改端点三级阶梯:活表优先保留 → 真空置号保义翻译 → 仅死路诚实拒绝;applyRanges 用翻译后区间继续并留日志;收敛后的空结果清除陈旧 map(clear-on-empty)。
  • 期间新增提交 b72c291(review 发现 deadRefs tombstone 残留:tombstone 的号若被本趟重授,空洞声明作废,一并 drop,空 ⇒ undefined)——我独立核对了该提交的代码与测试钉,正确。

⑤ 是否有回归问题(既有行为清单逐项过,无无意回归):

⑥ 是否破坏缓存:不涉及。前缀缓存策略不动——出站 tags 仍由 live messageRefs 经 render 管道派生(已核 render-refs/byRaw 路径);restamp 仍是一次性事件,出站字节不变。

⑦ 是否改了设计方向:无架构转向。这是既有 ledger-alignment 机制内的根治(剪枝 + 保义翻译 + 标志传播)+ 防再犯登记文档 reference/ref-keyed-surfaces.md(kernel Boundary 合规:PR body 有 kernel-change 声明 ✓、版本 bump 0.0.165→0.0.166 ✓)。因触碰 kernel/,按 §7.4 必须人工合并。

⑧ 是否引入新配置:无。无新增 env/config/CLI flag,wire 形状不变。

验证证据(本地只做定向,全量交给 CI):

  • 最终 head a783834 上定向套件 19/19 绿:kernel ref-restamp-collision 5/5(含 b72c291 两个新钉)、seq-restamp 4/4、verif-subset-guard 2/2(refs.ts 新语法在可翻译子集内,无需 exception 登记)、host issue4797 T1–T4、seq-ledger-pr3 S12/S14/S15。
  • 「master 全红」声明独立确认:T1(master 守卫 span 扫描命中 m6 ⇒ 必拒)与 kernel 剪枝测试(master 无剪枝 ⇒ m6 活键+superseded 共存)在 master 上逻辑上必红。
  • CI:a783834dd 的 24 个 check run 刚入队;PR mergeable=true(无冲突),mergeStateStatus=blocked 仅因 checks pending。PR body 提到的 issue3157-persist-durability master 红属继承性失败,ci-fixes sweep 已在分支内收敛。

顺手小修(独立标注提交 a783834,docs only):reference/ref-keyed-surfaces.md 把 blocks[].startRef/endRef 与 state.deadRefs 两行仍列在「NOT migrated」表,与本 PR 实际迁移两者(b72c291 也只改了状态列没挪行)不符——两行移入 migrated 表,deadRefs 行采用作者精确措辞(含 live-drop + #3302),删旧行。无代码改动。

与 #4799 的取舍对比(供 owner 拍板):验收面上 #4807 严格占优——真旧引用 #4807 翻译成同一条消息的新号、折对消息,#4799 直接拒;活号引用两者行为相同(都放行到当前 owner,也都自认同样的 replay 窗口暴露)。#4807 另有 kernel 剪枝(未来碰撞不再产生)、block/deadRefs 迁移、标志携带、clear-on-empty;#4799 独有 facet(restamp 时把腾出未重授号登记进 deadRefs)在 #4807 阶梯下不必要(stage 3 让未知号落到 kernel boundary 处理)。若 #4807 合入,建议 #4799 关为 duplicate(owner 决定,我不关)。

判定:方向对、实现验证通过、测试有牙(正负例齐全、master 红证据成立)、diff 干净(11 文件 +503/−58,每行与目的相关)。可合——但触 kernel/,需人工合并。

@github-actions

github-actions Bot commented Oct 26, 2026 •

Copy link
Copy Markdown
Contributor

📦 Built Package Artifact

Branch: 2026-10-26_ref-chokepoint (b258b6e)

Latest build — install this exact version

npm install -g billion-context@0.0.6229-pr.4807.c6000cf

This exact version is immutable and reproducible. The rolling pr tag tracks the newest test build across all PRs.

Recent builds (commit → version)

commit version build
b258b6e billion-context@0.0.6229-pr.4807.c6000cf build
31b292d billion-context@0.0.6227-pr.4807.806dc46 build
f180e5c billion-context@0.0.6224-pr.4807.1532ed9 build
247b92f billion-context@0.0.6222-pr.4807.20c5aac build
9384074 billion-context@0.0.6212-pr.4807.ade91a6 build
2adb537 billion-context@0.0.6210-pr.4807.5317a7a build
a49c943 billion-context@0.0.6131-pr.4807.e8095db build
608374a billion-context@0.0.6127-pr.4807.fef31ab build
744b038 billion-context@0.0.6125-pr.4807.a3e6c96 build
a783834 billion-context@0.0.6083-pr.4807.4794e66 build

Download artifact

  1. Download the artifact from the Actions run
  2. Extract the tarball and install:
tar xzf billion-context-pr4807.tgz
npm install -g package

Install instructions are refreshed on each push.

ework-agent added 3 commits October 26, 2026 15:39
…ract

Regenerated via scripts/update-storage-render-goldens.ts after a clean build.
Wire bodies byte-identical (the restart-invisibility contract holds); only
persisted-state digests moved — the superseded map is now liveness-pruned and
block spans/deadRefs ride the migration (kernel 0.0.166), so the aligned
state's digest changes by design. Same justification class as the #4599
wire-parity re-pins.
@ranxianglei

Copy link
Copy Markdown
Owner Author

🤖 Powered by ework · qwen3.8-27b

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

结论:无需我动手——这个 lock-sync 红是旧 head 的,已被 PR 后续提交修掉,当前 head 已绿。

报过来的失败是在 head 744b038b56 上触发的;此后 PR 又推了 608374a84("chore: regenerate lockfiles for kernel 0.0.166 (lock-sync gate)"),把两份 lockfile 重新生成到位。我在该 head 上按门禁原样命令本地复跑,并核对了当前 CI 状态,确认 lock-sync 已通过。

验证证据

  • 本地复现门禁命令(root + kernel 各跑一遍 npm install --package-lock-only --ignore-scripts --no-fund --no-audit 后 git diff --exit-code):两份 lockfile 均零 diff,exit 0。
  • 当前 head 608374a84 的 CI:52 个 check run 里 26 success / 14 skipped,lock-sync 在其中已是 success;仅剩 12 个 test 分片 + 1 个 static-gates(windows) 分片还在跑,没有任何一项红。
  • 版本核对一致:package.json 0.1.207 ↔ package-lock 0.1.207;kernel 0.0.166 ↔ kernel/package-lock 0.0.166。

八问

  1. 是什么问题:PR 的 lock-sync 门禁红了。该门禁会重新生成根目录与 kernel/ 两份 lockfile,只要还有残留 diff 就失败——本质是 kernel 版本 bump 后 lockfile 没同步。
  2. 什么原因导致的:PR 把 kernel/package.json 从 0.0.165 提到 0.0.166,但 bump 本身不会改 lockfile(只有 npm install 才会),于是 kernel/package-lock.json 还记着旧版本 → git diff 出残差 → 红。这是 package-lock.json version metadata lags package.json (bili 0.1.190 vs 0.1.191, kernel 0.0.112 vs 0.0.114) #2704/[PR] kernel: sync package-lock.json to 0.0.136 (lock left at 0.0.133 by the bump chain) #3782 那条漂移守卫要拦的典型情形。
  3. 影响范围与严重程度:只拦这一个 PR 的合并门禁,不碰任何运行时行为、用户面、缓存或数据。纯 CI 卫生问题,无外部影响。
  4. 怎么修复的:不需要我改代码——PR 作者已在 608374a84 里重新生成两份 lockfile;我用门禁同款命令本地复跑确认通过(确定性:--package-lock-only 对 file: 链接与已记录依赖均 "up to date",无需额外 registry 解析)。
  5. 是否有回归问题:不涉及行为回归——改动仅 lockfile 元数据同步,未触碰任何 src/kernel 源码逻辑、wire、配置面或默认值。
  6. 是否破坏缓存:不涉及。
  7. 是否改了设计方向:不涉及。
  8. 是否引入了新的配置:不涉及。

处置判定:无需开新 issue(非继承性 master 红、无设计决策、问题已自解),也不做无意义的空提交去刷 CI。等当前 head 剩余 test 分片收尾转绿即可正常推进合并流程。

ework-agent added 2 commits October 26, 2026 16:17
…— prune/migration deferred to the storage shadow layer

Bisection result (see PR discussion): the kernel-side superseded liveness
prune + block/deadRefs migration broke the storage-engine restart-invisibility
contract — the shadow digest comparison flags the migrated state as
'unified replay != legacy load view [diverged: state]', drops the ingest
watermark, and the full-mode leg falls back to the pre-alignment legacy
envelope, drifting the wire (storage-engine-proofs 4x red, golden wire parity).
With master kernel + this branch's host guard the same suites are 12/12 and
17/17 green.

The deadlock itself is fully resolved host-side: the guard's per-endpoint
ladder consults the LIVE map first, so a superseded key that is also a live
ref never blocks a status-advertised range (issue4797 T1-T4 green, T1/T2/T4
verified RED on isolated master). The kernel sweep (prune + block/deadRefs
migration) stays registered in reference/ref-keyed-surfaces.md as deferred —
it needs the storage shadow layer to hash the aligned state shape first.

Kept kernel changes (0.0.166): syncBlocks/cloneState carry refLedgerAligned
(the one-time alignment stays one-time across turns) — golden storage-render
google.json re-pinned for that state-shape change (wire bodies byte-identical).

seq-ledger-pr3 S14 re-pinned to the resolution-ladder contract (translate /
dead-end / live-first); S13/S15 revert to master expectations.
…erdict; #847/#1492B contracts reconciled to the #4288 world

Both files were red since the #4725 merge (verified at 931c66a in an isolated
worktree): the re-landed #4288 exit fired at round top, but the final verdict
block still stamped an exhausted failure whenever currentTokens — floored by
the same stale baseline the exit exists to bypass — read over-limit. A
fit-forward walk then reported 'no viable range could be compressed' while the
caller forwarded the fitting payload anyway: the marathon was prevented, but
the reported verdict lied.

- preflight.ts: fitExitForward flag — a round-top fit exit suppresses the
  final failure stamp (aborts still win).
- #1492 B: contract updated to the #4288 doctrine — a usage-grade baseline
  above the window on a FITTING payload forwards; a usage baseline above the
  limit cannot have been measured under this window regime, and a real
  overflow arms the one-shot rescue (#1110/#987) on rejection.
- #847: the honest-exhaustion pin now covers its actual post-#4288 meaning —
  the fitting sub-gate payload exits fit-forward with no verdict; the
  exhaustion path stays for payloads that genuinely exceed the target.

issue847 4/4, issue1492 3/3, issue4288 3/3, issue1195 4/4, preflight family
21/21, 4797 family 4/4, typecheck clean.
@ranxianglei

Copy link
Copy Markdown
Owner Author

(ai: zhipuai-lb/glm-5.3)

CI 状态说明(head 9384074)

本 PR 引入过的失败已全部转绿:unused-exports、lock-sync、storage-engine 线缆对等 ×4(kernel 剪枝/迁移撤回后 12/12)、golden 重钉、#847/#1492B(根因:#4288 出口生效但收尾判决被陈旧托底 currentTokens 覆盖——fitExitForward 修复 + 两个契约按 #4288 语义重钉;这两个在 931c66a 即红,#4725 合并带进)。

剩余 2 个红分片不是本分支引入:issue4125-giveup-reason(deterministic,5ms)与 dsh-native #1365(15s 超时)在 master 单跑同样红,是 CI 分片重排后被暴露的既有红。已开 #4824(证据:归因到 bc50f1a 的尾部 "dead" 覆写与 send-failed 记号竞争;复现命令在 issue 里)。

kernel 部分本来就是人工评审层级——是否在 #4824 修复落地前合并本 PR(或先修 #4824 再重跑),请 owner 判断。本地:kernel 1480/1480、storage-proofs 12/12、golden 5/5、issue847 4/4、issue1492 3/3、issue4288 3/3、issue1195 4/4、issue4797 4/4、typecheck 0。

ework-agent added 3 commits October 26, 2026 17:15
… branch reason must survive the callback

bc50f1a (#4516) appended state.lastUnavailableReason = "dead" right after
onGiveUp fired with "send-failed" — the dsh give-up client-event line reads
that slot AFTER the callback to name the branch that fired, so every
send-failure give-up reported 'dead'. The steady-state degraded-mode visibility
belongs to #4516's dispatch-mode tracker (noteDispatchMode already logs the
degrade), not to overwriting the branch reason. Both send-failure sites
dedented; issue4125-giveup-reason 5/5 green (was deterministic red on master
and on this branch's CI shards).

#1365 (dsh-native attach family) verified NOT a master regression: master's
latest CI run (cdac1c0) ran the suite green — the family hangs only on this
dev box (node 25.9; zero fetch calls reach the mock — registration never
issues its manifest probe) and had one razor-edge flake on a CI shard
(waitFor's 15s internal deadline == attach health deadline). Filed as
environment-artifact evidence on #4824.
…ize refusal wording

The #4125 stomp removal exposed a load-bearing consumer: #4516's
fallbackOversizeRefusal picked the 'died and no replacement came up' wording
only for reason "dead" — a send-failure give-up (proxy WAS live, died
mid-session) read as 'did not come up'. Both contracts now hold: the reason
slot keeps the branch name for the fire-time consumer (#4125), and the
steady-state wording maps send-failed onto the died branch (it did die).

issue4516 11/11 + issue4125 5/5 green; typecheck clean.
…the Windows AV-lock race at file level

Two consecutive CI runs (windows-22) show the SUBTEST green (3.4s) with the
FILE marked red: the after() hook's bare rmSync threw on the transient
EBUSY/EPERM that tests/tmp-rm.ts exists to absorb (#1646/#1910/#2908 ladder).
Same class as the plugin-fork bounded-wait fixes in the #4599 sweep.
@ranxianglei

Copy link
Copy Markdown
Owner Author

🤖 Powered by ework · qwen3.8-27b

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

结论先说:这个 PR 的 CI 已被分支上的在途提交全部收敛,当前最新 head 31b292dda 无失败检查(36 通过 / 1 个分片仍在跑 / 13 跳过)。我没有重复推送、也没有另开 issue——每一处红都已被在途 agent 修好并验证,#4824 已在跟踪,另开只会制造重复。

我逐条独立核对了每一处失败并验证了修复的正确性。

结构化八问

  1. 是什么问题:PR 多个测试分片先后变红。根因是一个状态槽被两个读者以互相冲突的生命周期共用——修好其中一个读者就打破另一个(典型乒乓),不是偶发。
  2. 什么原因导致的:state.lastUnavailableReason(src/agent/native-intercept.ts)这一个标量同时承担两件事:① give-up 点火后的分支名([Bug] Plugin bootstrap spawns a new instance while the old one still holds the port and drops proxying (goes direct): la | [Bug] 插件 bootstrap 在旧实例仍占端口时新起实例并放弃代理(goes direct):大会话随即以未压缩历史撞上游上限(400 Range of input length / 413) #4125 要求点火后保持 send-failed,供客户端事件行读取);② 代理存活判决([pi] Direct connection fallback after proxy disconnect: no oversized rejection, no self-healing, no visible alerting (al | [pi] 代理失联后的直连兜底无 oversized 拒绝、无自愈、无可见告警(opencode/dsh 都有)—— 1.06M token 原始历史被直接送进上游 #4516 要求"持有过 origin 之后死亡"判为 dead,措辞才显示 DIED)。[Bug] Plugin bootstrap spawns a new instance while the old one still holds the port and drops proxying (goes direct): la | [Bug] 插件 bootstrap 在旧实例仍占端口时新起实例并放弃代理(goes direct):大会话随即以未压缩历史撞上游上限(400 Range of input length / 413) #4125 的修复删掉了发送失败处对 dead 的写入,于是 [pi] Direct connection fallback after proxy disconnect: no oversized rejection, no self-healing, no visible alerting (al | [pi] 代理失联后的直连兜底无 oversized 拒绝、无自愈、无可见告警(opencode/dsh 都有)—— 1.06M token 原始历史被直接送进上游 #4516 的措辞从此回退成 "did not come up"。另外两处是独立的环境性抖动:Plugin history render drops an entire fold (covered rows suppressed AND no summary anchor) when the fold reaches the transcript tail — ok:true, no error #4732 是 Windows 杀软锁住文件导致裸 rmSync teardown 竞态;bug: dsh-native — attach 目标瞬时不可达 → 回退 spawn 第二实例:routed baseURL 下工具/模型通道必然脑裂(工具 404 → preflight 502 → 会话不可自愈) #1365 是 attach 健康检查死线与内部等待死线相等造成的 razor-edge 时序抖(master 本身绿,非代码回归)。
  3. 影响范围与严重程度:仅 CI 分片红,不是线上行为回归——[Bug] Plugin bootstrap spawns a new instance while the old one still holds the port and drops proxying (goes direct): la | [Bug] 插件 bootstrap 在旧实例仍占端口时新起实例并放弃代理(goes direct):大会话随即以未压缩历史撞上游上限(400 Range of input length / 413) #4125/[pi] Direct connection fallback after proxy disconnect: no oversized rejection, no self-healing, no visible alerting (al | [pi] 代理失联后的直连兜底无 oversized 拒绝、无自愈、无可见告警(opencode/dsh 都有)—— 1.06M token 原始历史被直接送进上游 #4516 都是既有回归测试,线上语义没变("存活后死亡"本就该显示 DIED)。严重度=阻塞合并,非用户可用性问题。
  4. 怎么修复的(在途提交,我已核对 diff):① 删掉 give-up 点火后对 dead 的覆盖,保住 [Bug] Plugin bootstrap spawns a new instance while the old one still holds the port and drops proxying (goes direct): la | [Bug] 插件 bootstrap 在旧实例仍占端口时新起实例并放弃代理(goes direct):大会话随即以未压缩历史撞上游上限(400 Range of input length / 413) #4125 的分支名(247b92f49);② 在 fallbackOversizeRefusal 里把 send-failed 也归入 "died" 措辞分支——语义正确,因为持有 origin 后发送失败就是"确实死了",这样 [Bug] Plugin bootstrap spawns a new instance while the old one still holds the port and drops proxying (goes direct): la | [Bug] 插件 bootstrap 在旧实例仍占端口时新起实例并放弃代理(goes direct):大会话随即以未压缩历史撞上游上限(400 Range of input length / 413) #4125 与 [pi] Direct connection fallback after proxy disconnect: no oversized rejection, no self-healing, no visible alerting (al | [pi] 代理失联后的直连兜底无 oversized 拒绝、无自愈、无可见告警(opencode/dsh 都有)—— 1.06M token 原始历史被直接送进上游 #4516 同时成立(f180e5cc7,issue4516 11/11 + issue4125 5/5 绿);③ Plugin history render drops an entire fold (covered rows suppressed AND no summary anchor) when the fold reaches the transcript tail — ok:true, no error #4732 的 teardown 从裸 rmSync 换成可重试 rmrf,绕开 Windows 杀软文件锁竞态(31b292dda)。
  5. 是否有回归问题:核查确认无新增回归——[Bug] Plugin bootstrap spawns a new instance while the old one still holds the port and drops proxying (goes direct): la | [Bug] 插件 bootstrap 在旧实例仍占端口时新起实例并放弃代理(goes direct):大会话随即以未压缩历史撞上游上限(400 Range of input length / 413) #4125、[pi] Direct connection fallback after proxy disconnect: no oversized rejection, no self-healing, no visible alerting (al | [pi] 代理失联后的直连兜底无 oversized 拒绝、无自愈、无可见告警(opencode/dsh 都有)—— 1.06M token 原始历史被直接送进上游 #4516 全绿,typecheck 干净;这几处改动只动措辞映射与测试清理,不碰压缩/wire/存储核心。
  6. 是否破坏缓存:不涉及。
  7. 是否改了设计方向:不涉及架构转向,只是把一个被复用的标量按读者拆出语义(措辞层把 send-failed 归入 died 分支),与原设计一致。
  8. 是否引入了新的配置:不涉及。

收工判定:无需我再动手。唯一残留风险是 #1365 那条 razor-edge 时序抖(内部等待死线 == attach 健康检查死线),属测试加固项、已在 #4824 记录;若它再让单个分片偶发红,直接重跑即可,要根治则把内部等待死线设为严格小于 attach 健康检查死线。

…d index.db handle was the real Windows EBUSY

The rmrf swap was necessary but not sufficient: the harness closes proxy and
mock upstream but never store.closeQuietly(), so sessions/index.db stayed open
and the after() rm retried ~9.6s into a permanent EBUSY (hookFailed, subtest
green). Same handle-discipline as the plugin-fork/#4599 sweep.
@ranxianglei

Copy link
Copy Markdown
Owner Author

🤖 Powered by ework · qwen3.8-27b

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

补充一条时效更新(上面那条报告基于 head 93840742,此后分支已推进到 b258b6e7d):

合并时机与 kernel 的人工评审归 owner 决定,我不代判。就 CI 而言:deterministic 阻塞项(#4125/#4516)已随分支修好,残留只有 #1365 的偶发抖动(必要时重跑一次);是先等 #4824 加固落地再合、还是本 PR 先合,请 owner 拍板。

@ranxianglei
ranxianglei merged commit e290b4f into master Oct 26, 2026
51 checks passed
@github-actions

Copy link
Copy Markdown
Contributor

📦 Merged Build Published

This merge to master was published as 0.0.852-master.e290b4f (rolling master tag).

npm install -g billion-context@0.0.852-master.e290b4f  # this exact build
npm install -g billion-context@master  # always the newest merged build

npm view billion-context@master prints the current version at any time.

ranxianglei pushed a commit that referenced this pull request Oct 30, 2026
Labeled follow-up fixes for comments that contradicted code facts after
#4807's kernel liveness prune was reverted:

- reference/ref-keyed-surfaces.md: the contract section listed the
  reverted prune as enforced, and the 暂缓 section claimed host
  live-first '已消除其全部用户可见危害' — disproven by #5199 (isolated
  fixture reproduced the silent wrong-target application). Both now say
  what is actually true and point at #5199/#5204.
- tests/issue4797-superseded-deadlock.test.ts: header comment described
  the post-prune superseded shape ({m3→b, m7→f}); master produces
  {m3→b, m6→e, m7→f} where m6 is the dual-identity case now pinned in
  tests/issue5199-dual-identity-log.test.ts.
ranxianglei pushed a commit that referenced this pull request Oct 31, 2026
…o messages (#5196)

Cold-load ref reconciliation (maybeRestampToLedger, #4316 PR3/3) aligns refs
to ledger row order seq+1. When mover A stamped its seat in one pass, the
slot A vacated became immediately visible as free to a later mover B in the
same pass — B took over A's pre-restart number while superseded[thatRef]
still named A. The live-first resolver (src/stream.ts
supersededRefRejection) then re-targeted every stale citation of that
number at B: a compress() citing A's pre-restart ref folded B's contents
behind A's summary text, HTTP 200, block created (0.1.209 field fixture).

restampRefsToLedger now retires every seat a mover vacates into its own
seq+1; any mover whose target is a retired seat parks on a fresh number at/
after the cursor via the existing displaced/rehomed path instead. A retired
slot can never be targeted again within the pass (targets are unique per
row), and park numbers always start above every used index, so no freshly
stamped or parked ref can carry two identities — live-first becomes safe by
construction on kernel-produced data, with zero new rejection surface.
Pre-#5196 ambiguous data keeps the documented #4807 live-first trade.

- kernel 0.0.173 → 0.0.174
- tests: seq-restamp S13b rewritten to parking semantics (a swap's second
  side parks, superseded carries both old mappings), 3 new regressions:
  the exact issue fixture shape, a vacate chain proving untouched seats
  stay reusable, and cold-load persistence of the parked layout
- src/stream.ts: refresh the stale 'kernel prune' doc paragraph left over
  from the rolled-back liveness prune (#5199 / af1f92a)

Verified: kernel seq-restamp/ccr-restamp/dead-refs/dead-ref-split/
issue3939 23/23, host seq-ledger×2/issue4316/issue4797 13/13,
e2e-trae-model-restamp 1/1, kernel+root tsc clean, unused-exports gate
clean.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working p1 pi scope/kernel

Projects

None yet

1 participant