Repository navigation
[PR] fix: fork cut uses highest live row seq, not live-row COUNT (#4730) - #4754
ranxianglei wants to merge 14 commits into
Conversation
…ment #4316 PR3/3 (restampRefsToLedger) re-homes citation numbers once on every full-mode cold load; goldens pinning exact ref numbers are born-red. Re-pin the 7 storage-lane tests (engine-proofs x6 + orphan-recovery x1) modulo that renumbering — zero production code touched. - golden-storage-drive.ts: per-turn citation-normalized digest (shaCiteNorm) and state digest modulo stripOneTimeAlignment (stateDigestAligned); the deep-sort helper is hoisted into golden-canonical.ts for sharing. - corrupt-index-child.ts: new stripOneTimeAlignment normalizer — strips the refLedgerAligned stamp and re-homes refs onto canonical raw-id order so a clean full-mode read and the legacy fallback load compare equal. - storage-engine-proofs.test.ts: wire legs assert shaCiteNorm equality vs the legacy restart leg and the committed goldens; state legs assert stateDigestAligned; rollback leg now spells BILI_STORAGE_UNIFIED=legacy explicitly (#3818 flip: absent resolves to full, deleting the env would vacate the legacy path). - storage-orphan-recovery.test.ts: pins the content-addressable byRaw->byRef round-trip instead of a counter-era m00003 literal. - golden/storage-render/*.json regenerated with shaCiteNorm/stateDigestAligned. Converges the master-red storage-lane family (#4599 plan A, owner directive).
…dger parity masks The #4316 one-time renumbering restamped messageRefs but left state.tokenSnapshot keyed by the OLD refs, so post-restart bodies carried stale per-message token counts (1.3K vs 1.4K) and the full-mode-restart wire drifted off the legacy baseline (#4599). persist.ts: two-pass remap (stage moves, delete old keys, then write new keys) so entries whose new ref collides with another move's old ref survive; fires only when superseded refs exist. Aligned normalizer (corrupt-index-child.ts): the cacheLedger's segment bookkeeping (be/bl/bs, unfinalized tail line), the derived agg block, and per-line miss-attribution (prov/seam) are restart experience, not content — no-restart and restart legs legitimately differ there. Masked in the aligned view only; raw digests keep full accounting. Goldens regenerated (stateDigest + aligned). storage-engine-proofs 12/12, golden-storage-render 5/5 locally.
The unified store's message seq is append-only (remap/delta anchor at MAX(seq)+1). The fork endpoint cut the cloned prefix at the parent's live-row COUNT minus one, so once any row was retired (a fold tombstones covered rows) the count undershot the newest position and the child silently lost tail messages — one per retired row. With snapshot render live, the child's first append at MAX+1 then fell inside a cloned active block's ledger interval and was pruned. Cut at MAX(seq) WHERE retired_at IS NULL instead (lastLiveSeq, -1 when no live rows -> kernel-only fork). Renamed liveRowCount -> lastLiveSeq across all storage layers (store/mysql/backend/shadow/persist); the fork endpoint now passes it directly as the inclusive throughSeq. No behavior change when nothing is retired (MAX == count-1). Regression test pins the retired-row scenario plus the no-retired and all-retired edges.
📦 Built Package ArtifactBranch: Latest build — install this exact versionThis exact version is immutable and reproducible. The rolling Recent builds (commit → version)
Download artifact
Install instructions are refreshed on each push. |
…persisted state (#4599) The fork-survival test asserted immediately after the compress tool response, but the fold lands in the live session state asynchronously (#3573 replay semantics). Slow CI runners persisted the pre-fold state ('0 block(s) (compressions=0)' cold load) and the deepEqual diverged. Bounded 5s wait on the in-memory fold; fast machines exit on the first iteration. Product semantics unchanged.
The #4316 cold-load alignment reads the unified sidecar; its ingest of just-flushed records completes asynchronously. Slow runners compared the pre-ingest state and saw refLedgerAligned missing while the fold itself had landed. Poll (bounded 5s) until the loaded state carries the flag; fast machines exit on the first probe.
Git-for-Windows autocrlf checks the bundled .md posts out with CRLF; the exact-match '---' fences then failed to parse and every post lost its title/excerpt/date frontmatter (Windows CI: 'bundled meet-bili post found' assertion). Normalize CRLF to LF inside parseFrontmatter when the fence is CRLF-shaped; LF content is byte-identical as before. Regression test with a CRLF fixture.
… storage mode (#4599) The #4316 cold-load alignment sets refLedgerAligned only when the unified store is available; config-clean machines (CI runners) run legacy mode where it is an honest skip. The test asserted the flag unconditionally, so every shard carrying this file was born-red on CI while unified-config machines passed. Expectation now mirrors store.replicasAvailable(); verified 49/49 in BOTH modes locally.
(ai: vllm-qwen/qwen3.8-27b) 查重: 不重复 —— fork 克隆边界这一机制在 open+closed issue/PR 中无其他条目;本 PR 即 #4730 的唯一修复载体(Closes #4730)。 独立审核(重读 diff、独立复现推理,不复用 issue 侧结论)方向判定:#4730 的根因分析成立且修在了决策点上。fork 克隆边界把两个不同的量混为一谈——「活行有多少条」(COUNT)与「最新活行在第几号」(MAX seq)。seq 是 append-only(新行永远 MAX(seq)+1),两者只在「从未 retire 过」时相等;任何一次 fold 都会 retire 行、留下空洞,COUNT(live)-1 从此系统性低于尾行位置。修边界计算本身 = 疏(消除产生缺陷的机制),不是在下游堵症状。✔ 逐层核对(5 层存储 + 唯一调用点):
测试有效性:3 个用例有牙——retired-row 主场景在旧逻辑下断言必挂(count-1=3 会丢掉 e,f);no-retired 边钉住「不变」、all-retired 边钉住 -1 哨兵;幂等 replay 与追加续接(seq 6)也覆盖到了。缺口备注:MySQL/shadow/backend 三个 twin 未直接单测——与仓库对存储 twin 的既有惯例一致(seqByRaw/cloneSessionRows 同样只有 SQLite 侧单测,mysql-contract CI 门禁兜 schema),可接受。一处非阻塞观察:mysql.ts:907 可用文件惯用的 结构化八问
CI 状态与处置原 head 8610db5 上 5 个 test 分片红(u22s3/u24s3/w22s3/w22s4/w22s5)。逐分片拉 job log 核对:失败签名全部是 #4599 在册继承簇(storage-render golden ×4、engine-proofs ×6、orphan-freeze、plugin-fork「HTTP fork revision」——该条虽在本 PR 子系统域内,但报错与在册签名逐字一致:重启后 state 缺 判定代码审查通过,无阻塞项;触碰 fork/session-binding 路径,按 §7.4 属 human-only 合并层——等 CI 重跑绿后请 owner 人工合并。我不自行合并。 |
(ai: vllm-qwen/qwen3.8-27b) 进度更新(接上一条审核结论):
审核结论维持不变:代码审查通过、无阻塞项,等 CI。 |
(ai: vllm-qwen/qwen3.8-27b) CI 重跑分账(run 40230235074,head 7c0b6d0,进行中):
结论不变:代码审查通过;待剩余分片跑完出最终判定。若最终只剩这条在册 flaky,按 #4599 归口处理即可,不阻塞本 PR 的合并判定(该测试与本 diff 无关且 master 面同签名)。 |
(ai: vllm-qwen/qwen3.8-27b) 收工小结(本 issue 全部动作已完成):
|
…mspec wrap on win32 (#4599)
The ci-check lane's expectation change (c496cfb) exposed a real Windows bug: stripInheritedProxy builds inlineEnv as a spread copy of process.env, which keeps the original key casing (ComSpec) — Windows env vars are case-insensitive but plain objects are not. planClientSpawn's exact env.COMSPEC probe then missed it and silently degraded every wrapped spawn to the bare-name 'cmd.exe' fallback (verified by repro on a real win32 box: childEnv.COMSPEC=undefined while process.env.COMSPEC was set). Fix: probe COMSPEC/ComSpec/comspec in planClientSpawn and planDshSpawn. Verified on real Windows (Node 22): launcher-opencode-inline + fix-679 + dsh-refresh 37/37; host tsc clean, 35 pass / 2 win32-skips.
…OMSPEC case-probe c496cfb re-derived the win32 expectation from ambient process.env, which still mismatches production: Node's process.env member access is case-insensitive on Windows while the child env handed to the planner is a plain object whose key keeps the OS casing (ComSpec), so the exact env.COMSPEC probe fell through to the bare-name fallback. The assertion now derives from the child's OWN captured env/options and probes COMSPEC/ComSpec/comspec exactly like planClientSpawn does post-dfeea8a11 — self-contained under any concurrent-test env churn in single-process CI shards — and additionally pins windowsVerbatimArguments=true on the wrap.
🔶 需要决策 查重: 重复 —— 本 PR 修复的 #4730 已经通过 PR #4725 合入 master(commit 本轮核实(全部 live 验证,2026-11-13)
选项
默认(无决策时):A。 理由:修复已发布在 master,本 PR 继续挂着只会持续产生冲突噪音(本轮冲突即其一);它没有任何 master 上没有的东西。 结构化八问
判定:等 owner 拍板(推荐 A:按 duplicate 关闭,指向 #4725 / |
(ai: vllm-qwen/qwen3.8-27b) 状态复核(本轮 live 验证,无新动作):决策仍在等待 owner,状态与上一条「🔶 需要决策」(本线程 2026-11-13 00:46Z)完全一致。
结构化八问
判定:维持上一条决策请求——推荐 A(按 duplicate 关闭,指向 #4725 / |
[ework] CI fix verified green ✓ |
(ai: vllm-qwen/qwen3.8-27b) 进度汇报(本轮 live 验证)——这是「等 owner 决策」的停驻态,不是卡死。
为什么我不能自己解掉这个 dirty:两条解法都不是机械动作——① 全取 master 侧 → PR 变空壳 + 一个必红重复测试;② 保留本 PR API 形态 → 回退 #4911 异步设计,构成回归。二者都需要 owner 拍板(见 floor 12 选项 A/B/C)。按 lane 规则(需要决策 → 停),我停在决策点,未 push、未改正文、未动分支。 请 owner 处置(解除阻塞的唯一动作):推荐 A —— 按 duplicate 关闭本 PR(指向 #4725 / 结构化八问
判定:CI 绿,唯一阻塞是 dirty,需 owner 拍板(推荐 A 关闭)。等 owner 处置;拍板前本 PR 不再触碰。 |
[ework] CI fix verified green ✓ |
Closes #4730
What & why
Forking a plugin-lane session clones the parent's unified-store rows as the child's starting history. The clone boundary was computed from the parent's live-row COUNT (
unifiedLiveRowCount - 1), but messageseqis append-only (remap/delta anchor atMAX(seq)+1). As soon as any row is retired — which every fold does — the count falls below the newest live row'sseq, andcloneSessionRows(parent, child, count-1)cut the prefix before the tail: the child silently lost its newest messages, one per retired row.With snapshot render on, the loss became visible online: the child appends at
MAX(seq)+1, and that new row'sledgerSeqcan land inside a cloned active block's ledger interval, so the prune pass drops it.Fix
Cut at the parent's highest live row seq instead of its live-row count:
lastLiveSeq(sessionId)=MAX(seq) WHERE session_id=? AND retired_at IS NULL, returning-1when there are no live rows (kernel-only fork sentinel). Implemented across all storage layers:store.ts(SQLite),mysql.ts,backend.ts(interface + SqliteBackend),shadow.ts.liveRowCount/unifiedLiveRowCounttolastLiveSeq/unifiedLastLiveSeq(single caller; no dead code left behind).src/plugin.tspassesunifiedLastLiveSeq(parent.id)directly as the inclusivethroughSeq(dropped the-1; sentinel becomes>= 0).Behavior change (old -> new)
COUNT(live)-1->MAX(live seq). Identical when nothing is retired (MAX == count-1); differs only once a row is retired, where the old value undershot and dropped the tail. When cloning happens is unchanged (both trigger on "at least one live row").Tests
New
tests/issue4730-fork-lastliveseq.test.ts: pins the retired-row scenario (parent folds b,d -> child retains the full live prefix incl. tail e,f; append continues at max+1), plus the no-retired edge (boundary unchanged) and the all-retired edge (-1). Targeted run green; adjacentseq-ledger-pr3andstorage-review-p2ssuites green; typecheck green. Full-suite verdict = remote CI.Touches the fork/session-binding path, so flagged for human review/merge per section 7.4.