Repository navigation
Conversation
(ai: vllm-qwen/qwen3.8-27b) 查重:不重复。 本 PR 是已关闭的 #1737(顺序 stale-merge)/ #1724 / #3397 的并发发布后续——机制不同:那一批修的是「单进程顺序读→改→写」,这里修的是「两个进程同时对同一个共享 初步判断(完整结构化八问结论随后补): 方向正确、实现质量高。核心机制把 affinity/order 两个快照从「单一 接下来按规范逐项核:①机制正确性(回收守恒 / 崩溃边界 / 目录屏障失败)②相对既有行为的回归(重点是磁盘布局变更)③外部提交质量门槛 ④测试有效性(并发与崩溃注入是否真有断言牙齿)⑤CI。 已先行确认一点:生产代码里除 |
|
Follow-up at
Verification: 25/25 focused tests, typecheck, file-size, and diff checks passed. Filesystem capability is tested explicitly; unsupported barriers do not produce a power-loss durability claim. |
(ai: vllm-qwen/qwen3.8-27b) 已对跟进提交 查重(重申):不重复。 本 PR 是已关闭的 #1737(顺序 stale-merge)/ #1724 / #3397 的并发发布后续,机制不同(不可变发布日志 vs 顺序读改写),open+closed 无同机制条目。 结构化八问1. 是什么问题 2. 什么原因导致的 3. 影响范围与严重程度 4. 怎么修复的 5. 是否有回归问题 6. 是否破坏缓存 7. 是否改了设计方向 8. 是否引入了新的配置 CI 与验证
两点非阻塞观察
判定外部提交质量门槛(⑤b)通过:命名清晰、无死代码、公共逻辑抽到 |
…ies already present in master The branch's original changelog edit copied the two most recent master entries (ranxianglei#5412 async-storage self-heal, ranxianglei#5415 absorb-debt nudge); after the branch re-merged master they existed twice in CHANGELOG.md. Merging would have shipped duplicate release-notes entries for changes that are already in master (code included). Removes the two added copies plus the separating blank line; no other change.
ranxianglei
left a comment
There was a problem hiding this comment.
(ai: vllm-qwen/qwen3.8-27b)
APPROVE — 独立审完全部 9 个文件(+1850/−193,base be611a856 → head a3d6a94)。机制正确、测试有牙、行为变更已披露。一处小问题已顺手修掉(见「已顺手修」)。
结构化八问
- 是什么问题:两个持久化快照(prefix-affinity / session-order)在同一 state 目录被多实例并发写时,共享单个
<name>.json.tmp+ 进程本地读写协调,后 rename 者用自己的合并结果整文件覆盖先写者的结果——丢更新(#1724 家族;#1737 只修了顺序场景的 stale-merge,没解决并发 RMW 本身)。 - 什么原因导致的:可变单文件 + 整文件替换的发布模型没有跨进程互斥;即使 tmp 名唯一,两个陈旧视图各自 rename 仍互相覆盖。根因是发布模型,不是锁不够多。
- 影响范围与严重程度:仅多实例共享同一 state 目录的部署(单实例无感知);严重度 = 特定条件下丢亲和链/会话顺序(前缀缓存退化、排序骨架丢失),不崩溃不阻断——本 PR 是该类 p2 缺陷的根治。
- 怎么修复的:换成不可变发布日志——私有 staging 目录写满并 fsync → 原子 rename 到唯一
pub-*目录 → fsync 父目录 → 仅当「新输出逐键支配且旧叶经字节复核仍在盘上」才回收该输入;读取端取所有存活叶与冻结基线的并集。丢更新在结构上不可能:每轮输出都是新叶,旧叶只在被证明覆盖后消失。 - 是否有回归问题(逐项清点既有行为):合并规则/深度优先/LRU 1024/8MiB 字节上限/500ms 去抖/5s 最大延迟——逐行核对未变;hydrate 并集语义保持;wire/配置面/env/依赖/kernel/ /update.ts/version 均未触碰。fail-fast 未变差(parse 从「过滤坏条目导入其余」改为「整份抛错」,更严);无吞错(不可读输入保留+有界告警);日志措辞变化见下方披露。有意行为变更逐条列于披露节。
- 是否破坏缓存:不破坏。亲和链内容语义不变(同一会话同一链),只是落盘位置变化;多实例下反而消除了互相覆盖引起的前缀缓存抖动。
- 是否改了设计方向:是,局部且合理——状态文件从「可变电文」改为「不可变日志 + 冻结基线」,与仓库账本式身份哲学一致;纯持久化层内部,未跨架构边界。
- 是否引入新配置:无新 env/config/CLI。磁盘布局变化(备份需含
.journal/)已在 PR 正文与 CHANGELOG 披露。
行为变更披露(旧值→新值)
- 落盘布局:
<name>.json每轮重写 → 升级时刻冻结为基线、永不改写;新状态进<name>.json.journal/pub-*/。全新安装从此不再创建该 JSON 文件。备份/清理必须连同.journal/(只删.journal/= 回退基线,不是损坏)。旧版本读者看不到 journal 写入(PR 已披露)。 - 损坏文件处理:旧 = 过滤坏条目导入其余 + 下次 flush 重写自愈;新 = 整份永久保留原样、贡献零记录、每次 census 一条有界告警(
incomplete粘滞)。刻意的「守恒优先于自愈」取舍,模块文档与测试均已钉死。 - 无断电安全文件系统(Windows/部分网络挂载):每次发布走非耐久分支,回收恒为 0 →
pub-*目录随写累积、永不删除(旧实现为单个有界 ≤8MiB 文件)。作者已披露;见观察项 O1。 - 等值 tie-break 方向:旧 mergeWithDisk 平局本进程胜 → 新 mergeEntries 平局磁盘侧胜。实际不可观测(平局即同记录;变异必带严格更新的 lastSeen)。
观察项(非阻塞,不建议在本 PR 处理)
- O1 非耐久文件系统上的无界累积:频率受去抖限制(持续流量 ≤ ~1 目录/5s),但长期运行会涨盘;建议后续单独跟踪(配额/周期压实策略),不扩大本 PR 范围。
- O2 sticky incomplete + 每轮告警:一个损坏叶或一次半删崩溃会使
incomplete粘滞、此后每次写都打告警——有界但持续的排障噪音,同样建议后续单独跟踪。 - O3
Record<string, any>子进程裁决类型:仓库内已有 ≥5 处同类先例(tests/fix-806-malformed-body.test.ts 等),放行。
测试有效性
真多进程并发(4 writer 经 IPC 共同读屏障,逐 writer 断言 consumed===1——核心丢更新回归的钉子);构造态崩溃注入(rename 前/后/半删,不依赖真实 kill 时机);EPERM/EIO 屏障故障注入(reclaimed=0、uncovered 如实上报、旧输入一字不动);能力探测驱动双向断言(dirFsyncWorks() 按实际 FS 能力而非平台名分叉——两种平台都不跳过也不豁免删除);真实 store 集成(1024 上限越界的叶必须留存可读、后续更宽 census 仍可见、真正覆盖后才回收)。issue3397 用例从「flush 自愈」翻转为「基线不可变 + journal 承载」,守恒语义钉死。判定:真测试,断言有牙。
已顺手修
已顺手修:CHANGELOG.md 重复条目 #5412/#5415(两行在 master CHANGELOG.md:16-17 已存在、代码也已在 master;分支早期基于旧 master 写入副本,两次 merge 后成双份——合并会让发布说明重复)commit a3d6a94(3 行,无其他改动)
CI
审查时镜像缓存显示原 head 83c097f 的检查运行中(0 failed / 19 queued / 2 skipped),车道判定绿。本修复 commit 触发新一轮 CI,合入以新一轮为准。
结论:可合(APPROVE) — 新 head CI 绿后即可直接合并。
review 完成:APPROVE 已提交(新 head a3d6a94,review 5799891897);已顺手修:CHANGELOG.md 重复条目 #5412/#5415(master 已有、代码也已在 master,分支两次 merge 后成双份)+ commit a3d6a94(3 行);无 kernel/ 触碰、无需决策;行为变更(落盘布局/损坏处理/非耐久 FS 累积/tie 方向)已在 review 中逐条披露,两项非阻塞观察(O1 Windows 无界累积、O2 sticky incomplete 噪音)建议后续单独跟踪。CI 在新 head 重跑中,绿后即可合。 |
ranxianglei
left a comment
There was a problem hiding this comment.
(ai: vllm-qwen/qwen3.8-27b)
APPROVE(新 head a3d6a94 复审)
自上一轮批准以来分支上只有一个提交:a3d6a94(本审查车道的顺手修复——删除 CHANGELOG.md 中重复的 #5412/#5415 两行,共 3 行)。逐项核实:
- 远端 head 与上一轮完整审过的内容逐字节一致(对本地审查分支
git diff为空); - 相对 public master 的真实 diff = 9 文件 +1847/−193(即上轮 +1850/−193 减去这 3 行),无任何其他变化;
- CHANGELOG.md 中 #5412 / #5415 各恰好出现一次;
- 作者此后无新提交、无新讨论。
八问(简版,完整分析见上方首轮 review)
- 是什么问题:共享 state 目录快照(prefix-affinity / session-order)并发写丢更新的根治(#1724 家族)。
- 什么原因:可变单文件 + 整文件替换的发布模型没有跨进程互斥,两个陈旧视图互相覆盖。
- 影响与严重度:仅多实例共享 state 目录;特定条件下丢亲和链/会话顺序(前缀缓存退化),不崩溃不阻断。
- 怎么修:不可变发布日志——staging 写满 fsync → 唯一
pub-*目录原子 rename → 父目录 fsync → 仅被证明覆盖且字节复核仍在盘上的输入才回收;读取端取存活叶与冻结基线并集。 - 回归:合并规则/深度优先/LRU 1024/8MiB 上限/去抖时序逐行未变;wire/配置面/env/kernel/ /update.ts/version 未触碰;有意行为变更(落盘布局、损坏处理、非耐久 FS 累积、tie 方向)已在首轮正文逐条披露(旧值→新值)。
- 缓存:不破坏;多实例下反而消除互相覆盖引起的前缀缓存抖动。
- 设计方向:局部转向「可变电文 → 不可变日志 + 冻结基线」,与仓库账本式身份哲学一致,纯持久化层内部。
- 新配置:无;磁盘布局变化(备份需含
.journal/)已披露。
CI
镜像缓存 @ head a3d6a94:30 项检查全部 completed,0 failed,0 pending——绿。
结论:可合。 唯一发现(changelog 重复条目)已顺手修掉并验证,CI 绿,待人工合并。
ranxianglei
left a comment
There was a problem hiding this comment.
(ai: vllm-qwen/qwen3.8-27b)
Round-3 re-review — APPROVE. The only change since the last approved head (a3d6a94, reviews 5799891897 / 5800098467) is a single merge commit 0f0b59f that syncs the branch with current master tip 406193b. No new author commits, no file edits, no PR-body changes. Verified against the live tree:
- Structure:
git log -1 --format=%P→ parentsa3d6a94(approved head) +406193b(current public master tip, fetched independently). First-parent chain confirms the branch adds nothing beyond that merge. - True PR delta vs current master: exactly the same 9-file feature set,
+1847/−193— byte-for-byte the content reviewed and approved in rounds 1–2. - Merge integrity: the six core files (
src/snapshot-journal.ts,src/affinity-persist.ts,src/order-persist.ts,tests/snapshot-journal.test.ts,tests/affinity-persist.test.ts,tests/issue3397-persona-restart-stability.test.ts) are byte-identical to the approved head; the three files master also touched (CHANGELOG.md,reference/architecture.md,scripts/live-files.mjs) merged cleanly — all four changelog entries, the architecture row, and the live-files entry survived, and#5412/#5415each appear exactly once (the round-1 dedup fix held through the merge). - Import sources moved on master:
src/prefix-affinity.tscarries a comment-only doc-path update;src/session-resolve.tshas no export/signature change to the symbolsorder-persistconsumes. - Authorization: PR's own delta touches no
kernel/; nokernel-changedeclaration in the body; human-tier gate not triggered. - CI at new head: mirror cache shows 30 checks, 0 failed (6 success + 11 skipped completed, 13 still running at review time); lane reports green.
结构化八问
- 是什么问题:两个共享同一 state dir 的实例对亲和链/会话顺序快照做进程本地读改写,唯一 tmp 名也挡不住 stale-view 丢失更新;本 PR 用不可变发布日志(私有暂存→fsync→原子 rename 到唯一发布名→按覆盖+字节复核回收输入)根治。详见 R1/R2 完整分析。
- 什么原因导致的:旧路径共享
<name>.json.tmp+ 进程内 RMW 协调,两个 stale 视图先后落盘即丢更新;根因是「可变单一文件 + 非原子读改写」,不是 tmp 命名。 - 影响范围与严重程度:多实例同机部署(dsh profile/多宿主)下的数据静默丢失;单实例无感。属 p2 级正确性缺陷,修复后消除。
- 怎么修复的:不可变发布 + 覆盖门控回收(
covers(output,input)对该叶 census 私解析数据判定,字节复核后才 unlink)+ 耐久门控(目录 fsync 失败则零回收、如实报uncovered)+ 损坏/半删输入永久保留(sticky incomplete)。 - 是否有回归问题:R1 已逐条清点既有行为——合并规则/深度优先/LRU 1024/字节上限/500ms 去抖 5s 最大延迟全部未变;tie 方向翻转(mine-wins→disk-wins)实际不可观测;损坏处理从「过滤+flush 自愈」改为「整份保留」是有意的守恒取舍,已披露并有测试钉死。本轮同步合并未引入任何新行为变化。
- 是否破坏缓存:不涉及(prefix cache/重试/游标均不受影响;快照文件不是缓存层)。
- 是否改了设计方向:持久化布局变更(legacy 基线冻结 +
.journal/不可变叶)是披露过的有意变更,备份须含.journal/;非架构转向。 - 是否引入了新的配置:无新 env/config/默认值。
平台限制(非耐久 FS 上叶目录累积、sticky incomplete 告警噪音、Windows/网络文件系统不承诺)在 PR 正文、CHANGELOG 与模块文档中均有披露并由测试钉住,属作者明确接受的边界,不再作为待办项重列。
Verdict: APPROVE — the PR's contribution is unchanged from the twice-approved content; the new head is a clean sync with current master. Merge remains human-only.
Round-3 review complete (new head |
Resolve the ranxianglei#5480 (immutable snapshot journals) vs master (ranxianglei#5753 kv_store unified stores) conflict by union of intent: - src/affinity-persist.ts / src/order-persist.ts: keep BOTH the ranxianglei#5480 census/publish writer (under master's writeSnapshotLegacy call-site name) and master's kv machinery; re-add the readDiskEntries/mergeWithDisk disk-view helpers master's kv path calls, reworked journal-aware (baseline ∪ published leaves) because ranxianglei#5480 never rewrites the baseline file again. - tests/*-unified-store.test.ts: the pre-hydration fallback now publishes a durable journal leaf instead of rewriting the legacy file — assert the leaf, not the baseline's existence. - CHANGELOG.md / scripts/live-files.mjs / reference/architecture.md: union of both sides' entries.
(ai: vllm-qwen/qwen3.8-27b) Conflict resolved and pushed. Merged Why it conflicted: since this PR branched, master landed #5753 ("move six JSON sidecar states onto the unified kv_store"), which rewrote the same regions of Resolution — union of intent, no behavior unification:
Verification (local, targeted): CI state (live-checked via mirror cache): the old head 中文八问(审核清单)
判定:冲突已解决并推送(c49a46d),等待 GitHub 对新 head 的重算与 CI 复跑(镜像缓存本周期尚未刷新到新 sha)。 |
…d pass) Master moved +100 commits past c49a46d; conflicts were import hunks only in src/affinity-persist.ts and src/order-persist.ts (both sides added different imports at the same spot). Resolved as union: openSnapshotJournal (ranxianglei#5480) + persistDebounceMs/persistMaxDelayMs (ranxianglei#6058/ranxianglei#6062) + kvStore (ranxianglei#5753). Master's ranxianglei#6058 change (hardcoded PERSIST_DEBOUNCE_MS/PERSIST_MAX_DELAY_MS constants replaced by the shared persist.* knobs in schedule*Persist) auto-merged clean on top of the journal writers. tests/affinity-persist.test.ts + tests/order-persist.test.ts: master's new ranxianglei#6058 knob timing tests asserted the legacy baseline file appearing on disk; since ranxianglei#5480 the legacy writer publishes immutable journal leaves and never rewrites the baseline, so those assertions could never hold here. Adapted the landing checks to journal pub-* leaves (same disclosed adaptation class as c49a46d's unified-store test fixes). The knob wiring under test is unchanged; the tests now pin it through the real publication path.
(ai: vllm-qwen/qwen3.8-27b) Second conflict pass done and pushed: What the live check found this run. Yesterday's merge commit Resolution (union of intent). Merged Stale assertions caught and fixed (disclosed adaptation). Master's new #6058 knob timing tests — 2 added to Verification. CI state, honestly. The mirror-cache entry for this PR is stale ( 中文八问(供人工审核)
结论:冲突已解、已推送 |
[ework] CI fix verified green ✓ |
ranxianglei
left a comment
There was a problem hiding this comment.
(ai: vllm-qwen/qwen3.8-27b)
Round-4 review — head bd5c613 (two master-sync merges on top of the approved 0f0b59f).
What changed since round 3. No new feature commits. c49a46def (first pass) and bd5c613 ("second pass") merge public master (58a8796, current tip) into the branch. Master had meanwhile changed the exact modules this PR rewrites — #6062 wired the new persist.debounceMs / persist.maxDelayMs knobs, and #5753 moved both snapshots onto the unified kv_store carrier (the file becomes the pre-hydration fallback / legacy-only / post-demote path, with one-time migration and writeSnapshot → writeSnapshotLegacy). These merges are therefore a semantic union of two features touching the same functions, not mechanical catch-up — reviewed as such: both merged source files were read in full, plus all three adapted test files.
Verdict on the union: clean.
src/snapshot-journal.ts,tests/snapshot-journal.test.ts,tests/issue3397-persona-restart-stability.test.ts: byte-identical to the twice-approved content.src/affinity-persist.ts/src/order-persist.ts: the journal mechanism (immutable publication, coverage-gated reclaim, durability gate, conservation-law parse) is intact line-for-line; master's kv carrier layers on top without touching it. Routing in bothschedule*andflush*iskvReady && kvStore() !== null→ unified chained RMW, else the journal file path — which preserves the #5548 carrier rule (a hydrated unified instance never writes the file again), so the pre-kv fallback is exactly where the journal now publishes. The deliberate parser asymmetry survives too: the kv-row parser filters invalid entries (row rewritten wholesale each time) while the file/journal parser throws (retention law — a later publish must not be able to reclaim records a corrupt input still holds).- Debounce wiring uses the new knobs (
min(persistDebounceMs(), persistMaxDelayMs() − elapsed)); defaults keep the historical 500 ms / 5 s. Those knobs arrived via master's #6062 — inherited by merge, not introduced by this PR. - Test adaptations (
tests/order-persist.test.ts,tests/affinity-unified-store.test.ts,tests/order-unified-store.test.ts): assertions repointed from "legacy file exists" to "apub-*leaf exists under<name>.json.journal/", with a comment explaining why (the baseline is never rewritten). Timing semantics (default cadence, knob windows) are unchanged; the late-hydration-import assertions now additionally prove that migration reads the journal union. No assertion was weakened, and none still asserts the old rewrite/heal behavior. - Docs: all four CHANGELOG entries survive verbatim; the #5412/#5415 dedup held through both merges (one occurrence each); the
reference/architecture.mdrow and thescripts/live-files.mjsspawn-tripwire entry are present. - No
kernel/files in the PR delta, nokernel-changedeclaration → no authorization boundary engaged.
CI. Mirror cache at bd5c613: 30/30 completed, 0 failed.
APPROVE. Merge remains human-only.
中文八问
- 是什么问题:多个并发持久化进程会互相覆盖快照文件(丢更新);本 PR 用不可变发布日志替代共享临时文件名方案。
- 什么原因导致的:旧实现所有进程写同一个
<name>.json.tmp再 rename,后写者用自己的陈旧视图合并结果覆盖先写者的内容;进程内协调挡不住跨进程竞态。 - 影响范围与严重程度:多实例/重启竞态下亲和链与会话顺序记录丢失(#1724/#3397 家族);单实例单进程用户无感。数据完整性缺陷,非可用性缺陷。
- 怎么修复的:私有暂存目录写满并 fsync 负载与目录 → 原子 rename 到唯一
pub-*名 → fsync 父目录;回收仅在「已落盘输出逐键覆盖该叶自解析数据」且目录屏障成功时发生;损坏/不可读输入原样保留并报告;读端取全部有效叶与冻结基线的并集(沿用原合并策略)。本轮新增面:与 master 同期落地的 kv 载体/去抖旋钮特性做语义合并——kv 水合后走统一存储,未水合或降级时才走本日志文件路径,两套机制互不干扰。 - 是否有回归问题:已审既有行为——合并规则、深度优先、LRU 1024 上限、字节上限、500ms/5s 去抖节奏(现经旋钮解析,默认值未变)、水合语义均保持;损坏文件处理从「过滤无效项+下次落盘自愈」改为「整份保留、不再自愈」是有意变更(守恒优先,已在 CHANGELOG/PR 正文披露并有回归钉住);非持久文件系统上
pub-*叶只增不减为作者披露的已知边界(失败屏障诚实性有故障注入测试)。无意外回归。 - 是否破坏缓存:不涉及模型前缀缓存;会话状态文件的读取方(同步水合、kv 一次性迁移)全部改走 census 并集,迁移断言已验证早期写入仍能被导入。
- 是否改了设计方向:磁盘布局由「单文件原地改写」转为「冻结基线 + 不可变发布日志」,备份需连同
<name>.json.journal/一起处理;这是本 PR 的核心设计变更,已披露并由回归测试钉住。 - 是否引入了新的配置:本 PR 自身未引入新配置;
persist.debounceMs/persist.maxDelayMs(默认 500ms/5s,保持历史值)来自 master #6062,经合并继承。
Round-4 review complete (head |
[ework] CI fix verified green ✓ |
(ai: vllm-qwen/qwen3.8-27b) Third trigger arrived claiming merge-state "dirty" — live verification this run found no real conflict and no red CI, so I took no action on the branch. Evidence, all gathered fresh in this run:
What master's +37 did to the touched files: one commit ( Why I didn't merge master again: "behind" is not a merge blocker (GitHub re-merges head into whatever master is at merge time, and that merge is provably clean right now), master has moved ~137 commits across these two days so chasing it is whack-a-mole until a human merges, and piling another merge commit onto an external contributor's PR adds noise without changing mergeability. If a genuinely dirty state or a red check appears, the next trigger gets a real pass. The PR is ready for human review/merge. 中文八问(供人工审核)
结论:PR |
[ework] CI fix verified green ✓ |
Problem
Affinity/order snapshots used a shared temporary filename and process-local read/merge/write coordination. Unique temporary filenames alone would still permit lost updates from two stale views.
Change
Node20-standard-library immutable publications: fsync payload -> fsync private staging directory -> atomic rename to a unique publication directory -> fsync journal parent -> reclaim only exact valid consumed inputs -> fsync parent. Readers union valid leaves with the unchanged legacy baseline using the existing merge policy. Corrupt/unreadable inputs and crash-left staging directories are retained, not age/PID-reaped or recursively removed. Failed/unsupported directory barriers never authorize reclaiming inputs.
Verification
Candidatefb0ccf72:33 focused journal/affinity/restart runtime checks passed, plus TypeScript, unused-export and test-import-graph gates. Separate stale-view publication smoke preserved both independent updates through compaction and reopen. Coverage includes real concurrent writers and injected crash/barrier failures, not a power-loss certification.
Limits and migration
No SQLite/native dependency or kernel/wire change. The payload format remains compatible, but the disk layout changes: backups must include the baseline AND its journal. Older readers do not see post-journal updates. An unsupported barrier may leave a visible publication without proven power-loss durability. Corrupt inputs and abandoned staging debris are not globally disk-bounded. No Windows/network-filesystem runtime result is claimed.
Related work
#1737 fixed a sequential stale-merge case; it does not serialize simultaneous processes. This is the concurrent-publication follow-up, related to#1724/#3397, not a claim to explain every historical restart incident.