Skip to content

[PR] fix(#5236): sessions rm must not full-VACUUM under a live foreign writer - #5330

Open
ranxianglei wants to merge 4 commits into
masterfrom
2026-10-31_rm-full-vacuum-live-writer-guard
Open

ranxianglei wants to merge 4 commits into
masterfrom
2026-10-31_rm-full-vacuum-live-writer-guard

Conversation

@ranxianglei

Copy link
Copy Markdown
Owner

Refs #5236 — post-merge supplement to PR #5213 / owner ruling 3a6ab628 (via PR #5294).

What

bili sessions rm <id> defaults to a full VACUUM after the deletion. While another bili process (e.g. a running proxy) holds index.db, that full VACUUM can win the exclusive write lock and starve the other instance's writes across the whole O(db-size) rewrite — exactly the hazard class #4612 fixed for storage gc --vacuum full. After the owner ruling 3a6ab62 (2026-10-31: a live foreign writer never blocks startup), per-operation guards are the sole defense line — and runRm was missing its guard while runGc kept its (#4612).

Found while closing out #5236 on current master (caaab21): the ruling's commit message names runGc's store.unifiedActiveWriter() guard as the surviving enforcement point; a call-site audit shows four full-VACUUM sites, three already guarded (runGc CLI refusal, admin.ts panel 409, store.gc internal), one not (runRm).

Fix

runRm checks store.unifiedActiveWriter() before the shrink (same source of truth as runGc's refusal): live foreign writer ⇒ skip ONLY the shrink up front, with an actionable pid-named note (shrink skipped: another process (pid N) is actively writing index.db — … or run 'bili storage gc --vacuum incremental'). The deletion itself is a short transaction and stays committed — same graceful shape as the pre-existing SQLITE_BUSY path in the same function. No-writer and --no-vacuum paths unchanged. JSON lane carries vacuumed=false + vacuumNote (fields pre-existed; no schema change).

Behavior change (old → new)

  • OLD: sessions rm <id> with a live external writer attempted the full VACUUM anyway — either it won the exclusive lock and starved the co-resident instance's writes for the whole rewrite (minutes on multi-GB dbs), or it lost the race with SQLITE_BUSY and skipped the shrink with a generic "database busy" note.
  • NEW: deterministic upfront skip of the shrink with an actionable pid-named note whenever a live foreign writer is detected; the deletion always commits. Unchanged when no foreign writer is present.

Tests

New tests/issue5236-rm-vacuum-writer-guard.test.ts: positive gate (skip + pid-named note + deletion-committed proof + json honesty) and both negative gates per #3617 discipline (no writer ⇒ vacuum runs; dead holder ⇒ vacuum runs). Local: typecheck clean, suite 3/3 green on caaab21. Full-suite verdict = CI on this head.

Single-module scope (src/storage-maintenance.ts + one new test file); no config surface, no kernel/, no wire changes, no version touch.

@ranxianglei ranxianglei changed the title fix(#5236): sessions rm must not full-VACUUM under a live foreign writer [PR] fix(#5236): sessions rm must not full-VACUUM under a live foreign writer Oct 31, 2026
@github-actions

github-actions Bot commented Oct 31, 2026 •

Copy link
Copy Markdown
Contributor

📦 Built Package Artifact

Branch: 2026-10-31_rm-full-vacuum-live-writer-guard (99bfd2a)

Latest build — install this exact version

npm install -g billion-context@0.0.11039-pr.5330.d842c36

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
99bfd2a billion-context@0.0.11039-pr.5330.d842c36 build
d59f6ae billion-context@0.0.10799-pr.5330.8082d39 build
ad41155 billion-context@0.0.10704-pr.5330.c7d0900 build
98789cc billion-context@0.0.10277-pr.5330.5dbdb90 build
53f49f5 billion-context@0.0.9368-pr.5330.4291215 build
4932575 billion-context@0.0.9077-pr.5330.ebe6adf build
24bfdb0 billion-context@0.0.9061-pr.5330.834037b build
f97b257 billion-context@0.0.7477-pr.5330.98655df build
8eb0e37 billion-context@0.0.7461-pr.5330.057e735 build

Download artifact

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

Install instructions are refreshed on each push.

@ranxianglei

Copy link
Copy Markdown
Owner Author

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

CI 状态说明:首跑三条红全部为继承性 master 失败,与本 PR diff 无关——

@ranxianglei ranxianglei added bug Something isn't working p2 scope/storage labels Oct 31, 2026
@ranxianglei

Copy link
Copy Markdown
Owner Author

🤖 Powered by ework · qwen3.8-27b

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

查重:不重复——与 #4612/#5236 同属「活的外写者下 full-VACUUM 饿死共驻实例」机制家族,但 #4612 只覆盖了 gc 侧三个守卫位(runGc CLI 拒绝、admin 面板 409、store.gc 内部);本 PR 修的是 owner 裁决 3a6ab62 点位审计里唯一漏网的第四处 runRm,是本家族的收尾修复,跟踪 issue 即 #5236。

标签:bug、scope/storage、p2(存储车道 CLI 缺陷;特定并发条件下共驻实例写入被饿死,有 --no-vacuum 绕行,无数据丢失 → p2 非 p1)。

代码审查结论(独立重审,非复读 issue):

CI 现状(head f97b257,已 merge origin/ci-fixes 0371089):

八问:

  1. 是什么问题:bili sessions rm <id> 默认删后做 full VACUUM;另一个 bili 进程正在写 index.db 时,这次 VACUUM 可能抢到独占写锁,把共驻实例的写入在整个 O(db-size) 重写期间(多 GB 库=分钟级)全部饿死。
  2. 什么原因导致的:owner 裁决 3a6ab62 之后,逐操作守卫是唯一防线;storage gc full VACUUM holds the write lock across the whole O(db) rewrite with no progress — online proxy shadow disabled mid-run | storage gc 全量 VACUUM 全程持写锁且无进度:在线代理影子层被降级 #4612 给 gc 侧三处加了守卫,runRm 这处在点位审计中漏掉,仍无条件尝试 full VACUUM。
  3. 影响范围与严重程度:触发条件=sessions rm 恰好撞上另一进程活跃写入(如运行中的 proxy)。后果=共驻实例写入被阻塞整个重写时长,或竞态失败得一句泛化 busy note;删除本身(短事务)始终提交,无数据丢失。特定并发条件下的可用性降级,体验受损但有绕行(--no-vacuum)→ p2。
  4. 怎么修复的:shrink 前用与 runGc 同一事实源查活外写者,有则确定性跳过 shrink 并给出带 pid 的可操作提示,删除不受影响;把「赌锁竞争」变成「先问再动」。
  5. 是否有回归问题:无。逐项过既有行为:无写者路径(vacuum 照跑,负门钉住)、死持有者路径(负门钉住)、--no-vacuum(不变)、JSON 输出字段(预存在,未改)、删除语义(恒提交)、SQLITE_BUSY 兜底(保留)。高危模式(语义漂移/吞错/阈值时序/输出格式)逐项无命中;不涉及两种压缩模式(wire 无关)。
  6. 是否破坏缓存:不涉及(不动前缀缓存/重试/去重键)。
  7. 是否改了设计方向:否——沿用 storage gc full VACUUM holds the write lock across the whole O(db) rewrite with no progress — online proxy shadow disabled mid-run | storage gc 全量 VACUUM 全程持写锁且无进度:在线代理影子层被降级 #4612 既定守卫模式补第四处,同机制家族内收尾。
  8. 是否引入新配置:无。

收工判定:代码与测试达到可合并标准;当前两条红均为继承性 master 门禁失败(根因与修法证据已交 #4599 哨兵),待 ci-fixes 收敛后重跑转绿即可合并——本 PR 侧无需再做任何改动。

@ranxianglei
ranxianglei force-pushed the 2026-10-31_rm-full-vacuum-live-writer-guard branch from f97b257 to 24bfdb0 Compare November 11, 2026 04:52
ranxianglei pushed a commit that referenced this pull request Nov 11, 2026
…ES (PR #5330 red CI)

The suite spawns one bare `node -e` dummy child (live PID holder for the
<db>.lock fixtures); SPAWN_RE matched it but it was never registered, so the
pretest tripwire aborted all 11 test shards before any test ran
(run 42962029584). Concurrency reviewed per #1248: no ports bound, no
network I/O, mkdtemp-isolated per test — same shape as the #4612/#5046-B
entries; appended last so existing slot indices are untouched.
@ranxianglei

Copy link
Copy Markdown
Owner Author

🤖 Powered by ework · qwen3.8-27b

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

CI lane attempt 1/3 — conflict resolved AND the red-CI root cause found and fixed this run. Summary of everything done:

1. Conflict resolution. The branch (2026-10-31_rm-full-vacuum-live-writer-guard, head f97b257cd4) was built from the Oct-31 master snapshot plus a now-stale ci-fixes merge; master had moved 1159 commits past it. Its real content is ONE commit (8eb0e37fd9: src/storage-maintenance.ts + new tests/issue5236-rm-vacuum-writer-guard.test.ts). Rebased onto current master tip 33104b1f95: zero conflicts (master's five later commits to storage-maintenance.ts never touched the runRm vacuum region), the redundant ci-fixes merge dropped (its content is 100% inside master — verified 0 commits ahead via rev-list), then force-with-lease pushed f97b257cd4 → 24bfdb031e after confirming the remote head was untouched (no concurrent agent on the branch). GitHub now reports mergeable: true — the dirty state is cleared.

2. Red-CI root cause (found while waiting for the rerun). All 11 test shards on the rebased head failed. A single job-log fetch confirmed every shard died at the pretest tripwire before running any test:
process-spawning test files missing from LIVE_FILES in scripts/live-files.mjs: tests/issue5236-rm-vacuum-writer-guard.test.ts
This is a PR-side defect, not inherited: the PR's new suite spawns one bare node -e dummy child (live-PID holder for the <db>.lock fixtures) but was never registered in scripts/live-files.mjs.

3. Fix. Independent labeled commit 4932575239 (test(ci): register issue5236 rm-vacuum-writer-guard suite in LIVE_FILES): appended the entry last (append-only, existing slot indices untouched) with the #1248 concurrency note — no ports bound, no network I/O, mkdtemp-isolated per test, same shape as the existing #4612/#5046-B entries. Verified locally: tripwire scan now 0 offenders, LIVE_FILES existence check OK, the PR suite still 3/3 green. Plain push (remote head verified unchanged first): 24bfdb031e..4932575239. One-line conclusion posted to #4599 per the CI-coordination policy.

Live status honestly stated: the mirror check-cache still reflects the previous head (poller lag); the fresh run on 4932575239 is pending, so I am NOT asserting green yet. If the unblocked shards surface further failures, they'll be triaged by signature next run (my targeted local runs of the touched area are green; full-suite verdict belongs to remote CI). No design decisions needed, nothing escalated.


八问(中文结构化结论)

  1. 是什么问题:PR 分支与 master 冲突(dirty)无法合并;rebase 后新 head 的 CI 又全红——11 个 test 分片在跑任何测试前就退出。
  2. 什么原因导致的:① 冲突=分支基于 10-31 旧快照(master 已前进 1159 commits)+ 一个过期 ci-fixes 合并提交;② CI 红=本 PR 新增的 spawn 子进程测试套件未登记进 scripts/live-files.mjs 的 LIVE_FILES 表,pretest tripwire(tests/claude-native.test.ts linux live-E2E subtests fail/hang in shared multi-agent sandboxes #1248 门禁)逐字报错杀掉全部测试分片——是 PR 自身缺陷,非继承自 master。
  3. 影响范围与严重程度:仅本 PR 的合并性与 CI 信号;无用户侧运行时影响。严重度=阻塞合并,属流程级。
  4. 怎么修复的:rebase 到 master tip(零冲突,丢弃内容已全部并入 master 的 ci-fixes 合并,force-with-lease 推送);另以独立标注 commit 把新测试套件 append 登记进 LIVE_FILES(slot 索引不动,tests/claude-native.test.ts linux live-E2E subtests fail/hang in shared multi-agent sandboxes #1248 并发假设复核:不绑端口、无网络 I/O、每测试 mkdtemp 隔离)。
  5. 是否有回归问题:无。rebase 后对 master 的净 diff 与原修复逐字节一致(2 文件,+174/-8);LIVE_FILES 登记纯追加、只影响 CI 调度不影响运行行为。本地验证:typecheck 绿、build 绿、PR 回归套件 3/3、相邻 storage-maintenance-cli 套件 7/7。高危模式逐项过:无语义漂移、无阈值/时序/输出格式变化、无 fail-fast 变吞错。
  6. 是否破坏缓存:不涉及(纯 git 历史操作 + CI 登记,未触碰缓存/重试/游标/去重键)。
  7. 是否改了设计方向:没有。
  8. 是否引入新配置:没有。

判定:冲突已清(mergeable: true),红根因已修并推送(4932575239),等远端 CI 在新 head 上出结果;本轮无需 owner 决策。

@ranxianglei

Copy link
Copy Markdown
Owner Author

🤖 Powered by ework · qwen3.8-27b

[bot] 🏷 (ai: vllm-qwen/qwen3.8-27b) Status update (full run summary is in my previous comment above): conflict resolved via rebase onto master tip 33104b1f95 (zero conflicts; stale ci-fixes merge dropped) → head 24bfdb031e; red-CI root cause fixed — the PR's new spawn-based suite was missing from LIVE_FILES, registered in independent commit 4932575239 → pushed. Just re-verified against the live mirror check-cache (fetched 05:58Z, sha 4932575239): 0 failures — 12 success, 11 skipped, 7 still running (test shards in flight). Not asserting final green until those land; if any shard fails, it'll be triaged by signature next run. No owner decision needed.

@ranxianglei

Copy link
Copy Markdown
Owner Author

🤖 Powered by ework · qwen3.8-27b

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

CI lane run — verified live, no action was needed this time. The "merge state: dirty" in the trigger is stale mirror data predating last run's rebase; live sources say otherwise:

Verified in THIS run (not from memory):

  1. Merge state — not dirty. GitHub API (single PR read): state: open, mergeable: true, mergeable_state: behind. Local fetch cross-check: origin/master tip = 33104b1f95 — exactly the PR's base sha, i.e. master has moved zero commits past my rebase target; branch head = 4932575239, remote head unchanged (no concurrent agent pushed). There is nothing to rebase against — re-running a force-push would only churn the branch. ("behind" is a stale state label from before the rebase landed.)
  2. CI on head 4932575239 — no reds. Mirror check-cache (fetched 06:31Z): 18 success / 11 skipped / 1 in_progress / 0 failures. Last run's LIVE_FILES tripwire fix is confirmed working: the test shards now actually execute tests instead of all 11 dying at pretest. The one in-flight shard is test (ubuntu-latest, 22, 3); if it fails it'll be triaged by signature next run — I'm not asserting final green until it lands.

So this run: zero git operations, zero pushes, zero new commits — the blockers were already cleared by last run (24bfdb031e rebase + 4932575239 tripwire registration), and both now verify clean against live sources. No design decisions needed, nothing escalated.


八问(中文结构化结论)

  1. 是什么问题:系统触发称 PR 与 base 冲突(dirty),需 rebase 解决。
  2. 什么原因导致的:触发信息是过期数据——上一轮已完成 rebase(force-with-lease 推送 24bfdb031e)并修掉了红 CI 根因(4932575239);本轮实时核对后确认不存在冲突。
  3. 影响范围与严重程度:无实际影响——PR 可合并性完好(mergeable: true),master 自 rebase 目标以来零前进。
  4. 怎么修复的:无需修复。本轮做的是实时核验(GitHub API 单次读 + 本地 fetch 比对 + 镜像 check-cache 单次读),确认触发条件已不成立,故不做任何 git 操作/推送(避免无谓扰动分支)。
  5. 是否有回归问题:不涉及(未触碰任何代码或历史)。
  6. 是否破坏缓存:不涉及。
  7. 是否改了设计方向:没有。
  8. 是否引入新配置:没有。

判定:PR 当前唯一待办 = 最后一个 test 分片跑完出结果(0 failed / 1 in_progress);若绿即可合并,若红下轮按签名分账。本轮无需 owner 决策。

@ranxianglei

Copy link
Copy Markdown
Owner Author

🤖 Powered by ework · qwen3.8-27b

[ework] CI fix verified green ✓

2 similar comments
@ranxianglei

Copy link
Copy Markdown
Owner Author

🤖 Powered by ework · qwen3.8-27b

[ework] CI fix verified green ✓

@ranxianglei

Copy link
Copy Markdown
Owner Author

🤖 Powered by ework · qwen3.8-27b

[ework] CI fix verified green ✓

@ranxianglei
ranxianglei force-pushed the 2026-10-31_rm-full-vacuum-live-writer-guard branch from 4932575 to 53f49f5 Compare November 12, 2026 16:45
ranxianglei pushed a commit that referenced this pull request Nov 12, 2026
…ES (PR #5330 red CI)

The suite spawns one bare `node -e` dummy child (live PID holder for the
<db>.lock fixtures); SPAWN_RE matched it but it was never registered, so the
pretest tripwire aborted all 11 test shards before any test ran
(run 42962029584). Concurrency reviewed per #1248: no ports bound, no
network I/O, mkdtemp-isolated per test — same shape as the #4612/#5046-B
entries; appended last so existing slot indices are untouched.
@ranxianglei

Copy link
Copy Markdown
Owner Author

🤖 Powered by ework · qwen3.8-27b

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

CI lane run — this time the dirty state was REAL and is now resolved. Summary of everything done:

1. Verified live (not from memory). GitHub API: mergeable: false, mergeable_state: dirty — confirmed this run. Local fetch: origin/master had moved 128 commits past my previous rebase target (33104b1f95 → 259cd87674); two of those commits appended entries to the tail of scripts/live-files.mjs (ba57b829aa pack-install registration, 65f036c424 ci-janitor-fork-heads registration) — exactly where my commit also appends, hence a genuine append-only conflict. Remote branch head was still 4932575239 (no concurrent agent).

2. Rebase + conflict resolution. Rebased onto master tip 259cd87674: the fix commit (src/storage-maintenance.ts) applied cleanly; the LIVE_FILES commit hit ONE conflict hunk, resolved as union — kept both master entries in their order plus my tests/issue5236-rm-vacuum-writer-guard.test.ts entry last (append-only convention preserved). New head: 53f49f5953.

3. Verification on the rebased tree. LIVE_FILES: 67 entries, existence check OK, tripwire scan 0 offenders; npm run typecheck clean; targeted suites 10/10 green (PR regression suite 3/3 + adjacent storage-maintenance-cli 7/7). (Workdir had been reset since last run — reinstalled deps and rebuilt kernel/pi-subagents before verifying.)

4. Push. Force-with-lease 4932575239 → 53f49f5953 (remote head verified unchanged immediately before; commit-message secret scan clean). GitHub now reports mergeable: true, mergeable_state: blocked — i.e. mergeable, waiting on the required checks re-running on the new head (not a conflict).

5. Risk note, honestly stated. The previous head 4932575239 was fully green (mirror cache 2026-11-11 17:53Z: 18 success / 12 skipped / 0 failed). The only delta on 53f49f5953 is the union of three LIVE_FILES registrations plus master's own 128 commits — so the rerun is expected green, but I'm not asserting it until the checks land. No design decisions needed, nothing escalated.


八问(中文结构化结论)

  1. 是什么问题:PR 分支再次与 master 冲突(dirty)——master 前进 128 commits 后,两个新提交与本 PR 在同一位置(scripts/live-files.mjs 数组尾部)追加条目,产生真实的 append-only 冲突。
  2. 什么原因导致的:LIVE_FILES 是各 PR 追加登记的共享热文件,「都往尾部追加」的惯例在并发 PR 下必然在尾部撞车;本 PR 上次 rebase(11-11)之后 master 又合入了 pack-install 与 ci-janitor 两个登记提交,撞点即此。
  3. 影响范围与严重程度:仅本 PR 的合并性;无用户侧运行时影响。严重度=阻塞合并,流程级。
  4. 怎么修复的:rebase 到 master tip 259cd87674,唯一冲突 hunk 按 union 解(三方条目全保留,master 顺序在前、本 PR 条目殿后),force-with-lease 推送新 head 53f49f5953。
  5. 是否有回归问题:无。fix 提交(src/storage-maintenance.ts)干净重放、逐字节不变;冲突解为纯追加 union,未动任何既有 slot 语义;rebase 后本地 typecheck 绿 + 定向套件 10/10 绿。高危模式逐项过:无语义漂移、无阈值/时序/输出格式变化。
  6. 是否破坏缓存:不涉及。
  7. 是否改了设计方向:没有。
  8. 是否引入新配置:没有。

判定:冲突已清(mergeable: true),等远端 CI 在新 head 53f49f5953 上重跑出结果(前 head 全绿,预期绿);本轮无需 owner 决策。

@ranxianglei

Copy link
Copy Markdown
Owner Author

🤖 Powered by ework · qwen3.8-27b

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

CI lane run — the one red shard is a known flake, not a defect in this PR. Verified and handled:

1. Re-verified live first (per policy). Mirror cache was stale (snapshot taken at the job's start second), so I confirmed via a single job read: test (windows-latest, 22, 2) — run 43262051627, job 131343799891, head 53f49f5953, conclusion failure (completed 2026-11-12 17:07Z). All other shards on this head are green or were still queued — no other reds.

2. Root cause from the job log (single fetch). Exactly 1 of 2740 tests failed:
not ok 2622 - abort x proxy-openai-sse: client abort mid-stream destroys the upstream request
error: 'upstream socket(s) must be destroyed after the client abort (closed=0)' — tests/wire-exit-matrix.test.ts:273, duration 21,298ms while its sibling abort cells took 92–418ms (2623/2624/2625 all ok). That shape — closed=0 after a ~21s teardown wait on windows-node22 — is the documented load-starvation flake family in the #4599 sentinel (floors 1228–1231; most recently floor 1287/1288, 16h ago, same test, same line, same 22.1s/closed=0 signature, rerun attempt 2 = success).

3. Not this PR's fault. The PR diff touches src/storage-maintenance.ts + scripts/live-files.mjs + its own test file — zero intersection with the relay/abort/teardown path this test exercises. Master is green (no inherited red; ci-fixes not needed).

4. Action taken. Triggered rerun-failed-jobs on run 43262051627 (HTTP 201, accepted). Per the sentinel's standing protocol for this family: if the rerun goes green → closed; if it fails again with the SAME signature → it flips to a real issue and gets deep-dived. One-line conclusion posted to #4599. No branch changes, no new commits — there is nothing to fix in code for a flake.

Remaining / risk: the rerun verdict is outstanding (in flight now). Risk while waiting: none functional — the test asserts a real invariant, so if it reproduces deterministically the rerun will surface it and the escalation path is already defined.


八问(中文结构化结论)

  1. 是什么问题:PR 唯一红项 test (windows-latest, 22, 2)——2740 个测试中仅 1 个失败:wire-exit-matrix 的「abort x proxy-openai-sse」断言 closed=0(客户端中断后上游 socket 未销毁)。
  2. 什么原因导致的:windows-node22 负载饥饿 flake 族(在档,非新机制):该格耗时 21.3s(兄弟格 92–418ms),teardown 等待超预算后 socket 仍未关闭即断言失败;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 1228/1229/1230/1231/1287 为同款签名,windows-node22 分片在 CI 负载下偶发。
  3. 影响范围与严重程度:仅 CI 信号;无用户侧影响;PR 代码无缺陷(该测试路径与本 PR diff 零交集)。严重度=CI 噪音级,不挡代码正确性,挡合并信号。
  4. 怎么修复的:不改代码(flake 无可修之物)——按哨兵在档协议触发 rerun-failed-jobs(run 43262051627,HTTP 201);绿则收工,同签名再红即翻转深挖。
  5. 是否有回归问题:无——零代码改动;本 PR diff 不触碰 relay/abort/teardown 路径;master 绿,非继承红,未动 ci-fixes。
  6. 是否破坏缓存:不涉及。
  7. 是否改了设计方向:没有。
  8. 是否引入新配置:没有。

判定:红项已定性为在档 flake 并触发重跑,等重跑判决;若同签名再红将按协议升级深挖,届时可能需要 owner 决策(测试预算/负载硬化)。本轮无需 owner 决策。

@ranxianglei

Copy link
Copy Markdown
Owner Author

🤖 Powered by ework · qwen3.8-27b

[ework] CI fix verified green ✓

@ranxianglei
ranxianglei force-pushed the 2026-10-31_rm-full-vacuum-live-writer-guard branch from 53f49f5 to 98789cc Compare November 15, 2026 23:21
ranxianglei pushed a commit that referenced this pull request Nov 15, 2026
…ES (PR #5330 red CI)

The suite spawns one bare `node -e` dummy child (live PID holder for the
<db>.lock fixtures); SPAWN_RE matched it but it was never registered, so the
pretest tripwire aborted all 11 test shards before any test ran
(run 42962029584). Concurrency reviewed per #1248: no ports bound, no
network I/O, mkdtemp-isolated per test — same shape as the #4612/#5046-B
entries; appended last so existing slot indices are untouched.
@ranxianglei

Copy link
Copy Markdown
Owner Author

🤖 Powered by ework · qwen3.8-27b

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

Conflict resolved — branch rebased onto current master, force-pushed.

This run, verified against live sources before touching anything:

  1. Live state: GitHub API confirmed the dirty state was real (mergeable: false); the mirror cache (fetched 2026-11-13 10:54Z) showed the previous head 53f49f5953 was fully green (27 success / 3 skipped / 0 failed) — the windows-22-2 flake rerun from 11-13 passed, so there was no red CI to fix, only the conflict.
  2. Master moved 481 commits (259cd87674 → f648217cb8). Three of them touched src/storage-maintenance.ts (runRm dbRowsReleased accounting, runForeignBlocks failure exit code) — all in hunks that do not overlap this PR's writer-guard hunk, so the fix commit applied clean.
  3. One conflict in scripts/live-files.mjs: master appended two new suite registrations (web-logs-query, content-encoding-zstd) at the same array tail where this PR's entry was appended. Resolved as union — master's entries kept, this PR's issue5236 entry after them.
  4. New head 98789cc520 (fix 114440422e + LIVE_FILES 98789cc520 on master f648217cb8). Net diff vs master unchanged in shape: 3 files, +179/−8.
  5. Verification on the rebased tree: typecheck clean; LIVE_FILES 70 entries all exist, SPAWN_RE tripwire replica scan → 0 unregistered spawners; targeted suites 10/10 green (tests/issue5236-rm-vacuum-writer-guard.test.ts 3/3, tests/storage-maintenance-cli.test.ts 7/7). Full-suite verdict belongs to remote CI.
  6. Push: remote head verified unchanged (53f49f5953) before a --force-with-lease push → 98789cc520. Post-push: mergeable: true, mergeable_state: blocked = required checks pending on the new head, not a conflict. I am not asserting green — the fresh run is in flight; if anything goes red I'll pick it up next run.

(Operational note: the workdir had been reset, so my first rebase attempt was a no-op on a branch that never carried the PR commits; I reset the local branch to the remote PR head and redid the rebase properly.)


中文八问

  1. 是什么问题:PR 分支与 master 再次脱节(落后 481 个提交),合并状态 dirty——这次只有合并冲突,没有红 CI(上一 head 已全绿)。
  2. 什么原因导致的:master 持续前进,其中两个提交往 LIVE_FILES 数组尾部追加了新的测试注册项,与本 PR 的注册项落在同一位置 → 追加型文本冲突;storage-maintenance.ts 的三处 master 变更与本 PR 的 hunk 不重叠,无冲突。
  3. 影响范围与严重程度:仅 PR 分支自身;master 与用户均不受影响;属保持 PR 可合并状态的例行操作。
  4. 怎么修复的:rebase 到最新 master(f648217);唯一冲突(LIVE_FILES 尾部)按并集解决——保留 master 新增两项,本 PR 条目置于其后;fix 提交原样干净应用。
  5. 是否有回归问题:审过的既有行为——本 PR 的 runRm vacuum 守卫逻辑未变;master 新增的 dbRowsReleased 核算与 runForeignBlocks 失败退出码均未触碰本 PR hunk,原样保留;typecheck 干净、定向套件 10/10;全量回归以远程 CI 为准。
  6. 是否破坏缓存:不涉及。
  7. 是否改了设计方向:不涉及(纯冲突解决,无语义变更)。
  8. 是否引入了新的配置:不涉及。

判定:冲突已解,分支可合并;新 head 98789cc 的 CI 运行中,未断言绿;若红,下轮继续处理。

@ranxianglei ranxianglei left a comment

Copy link
Copy Markdown
Owner Author

Choose a reason for hiding this comment

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

APPROVE — correct, minimal, well-tested; closes the runRm gap left by #5236 / owner ruling 3a6ab62.

What it does

  • runRm (bili sessions rm) now checks store.unifiedActiveWriter() before the shrink — the same source of truth as runGc's refusal (#4612).
  • Live foreign writer ⇒ skip ONLY the shrink up front, with an actionable pid-named note; the deletion (short txn) still commits.
  • No-writer and --no-vacuum paths unchanged; the JSON lane carries vacuumed=false + vacuumNote.

Why it's correct

  • unifiedVacuum("full") (src/persist.ts:2456) has no internal guard, so the per-call-site guard is necessary, not redundant — consistent with the four full-VACUUM sites (runGc CLI, admin panel, store.gc, runRm).
  • The guard fires on unifiedActiveWriter() (src/persist.ts:2357 → src/storage/store.ts:786-802): the union of the open-time foreignLockHolder (re-validated for liveness) and a fresh read of <db>.lock pointing at another live pid.
  • Deletion is committed BEFORE the vacuum block (src/storage-maintenance.ts:125), so the rm always succeeds; only the expensive shrink is skipped.

Tests

  • tests/issue5236-rm-vacuum-writer-guard.test.ts (new): positive gate (live dummy writer ⇒ skip + pid note + deletion-committed proof + JSON honesty) and two negative gates (no writer ⇒ vacuum runs; dead holder ⇒ vacuum runs). Follows the #3617 both-directions discipline; meaningful assertions, not tautologies.
  • scripts/live-files.mjs: registers the new suite for the SPAWN_RE tripwire (the test spawns a dummy child). Correct.

Behavior change (disclosed in PR body)

  • OLD: sessions rm with a live foreign writer attempted a full VACUUM anyway → either won the lock and starved the co-resident proxy, or lost the race with SQLITE_BUSY.
  • NEW: deterministic up-front skip with an actionable pid-named note; deletion always commits.

No regressions

No-writer / --no-vacuum / legacy paths byte-identical. Single-module diff; no kernel/config/wire/version touch.

One pre-existing observation (raised separately as 🔶 需要决策, NOT a blocker on this PR)

The shared <db>.lock "last-opener-wins" discipline can be clobbered by an intermediate CLI invocation, defeating the unifiedActiveWriter() guard (and thus both runGc and runRm). Pre-existing (equally affects #4612's runGc), design-level, out of scope here — see the separate 🔶 需要决策 comment below.


8问

  1. 是什么问题:bili sessions rm 删除会话后会对 index.db 做全量 VACUUM;当另一进程(常驻代理)正写同一 index.db 时,全量 VACUUM 长时间持写锁,饿死共驻写者(#5236/#4612 同源)。runGc 有守卫,runRm 漏了。
  2. 什么原因导致的:unifiedVacuum("full")(persist.ts:2456)无内部守卫,每个调用点须自查 unifiedActiveWriter();runGc 查了(#4612),runRm 在 #5213 降级语义落地时漏查。
  3. 影响范围与严重程度:触发条件 = 同一 index.db 有活跃外部写者时执行 sessions rm;严重度 = 饿死共驻代理(特定条件下有问题),删除本身不受影响(短事务先提交)。
  4. 怎么修复的:runRm 在 shrink 前查 unifiedActiveWriter()(与 runGc 同一事实源);活跃外部写者 ⇒ 只跳 shrink + 带 pid 可操作提示,删除照常提交;JSON 车道带 vacuumed=false + vacuumNote。
  5. 是否有回归问题:无。无写者 / --no-vacuum / legacy 路径字节级不变;单模块 diff,不碰 kernel/配置/线协议/版本。
  6. 是否破坏缓存:不涉及(纯存储维护路径,不碰压缩/缓存/重试/去重)。
  7. 是否改了设计方向:不涉及(沿用 owner 裁决 3a6ab62「按操作守卫」防线,补齐 runRm 这个漏掉的调用点)。
  8. 是否引入了新的配置:不涉及(无新 env/config/默认值)。

@ranxianglei

ranxianglei commented Nov 16, 2026 •

Copy link
Copy Markdown
Owner Author

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

🔶 需要决策

发现(非本 PR 引入,设计级,需 owner 拍板):共享的 <db>.lock「最后开者胜」纪律可被中间 CLI 调用覆盖,导致 unifiedActiveWriter() 守卫失效——同时削弱 runGc(#4612,已合入)与本 PR 的 runRm 守卫。

机制(已逐行核对 src/storage/store.ts):

  1. 代理(pid 100)启动,开 index.db,<db>.lock = {pid:100}。
  2. 用户跑任意 CLI(如 bili sessions ls,pid 200):构造 SessionStore → UnifiedStore.open 读 lockfile(100 存活)→ foreignLockHolder={100} → 覆盖 lockfile 为 {pid:200}(store.ts:634)。CLI 退出 → close() 因 foreignLockHolder!==null 不删 lockfile(store.ts:764)→ lockfile 残留 {pid:200}(已死)。
  3. 用户跑 bili storage gc --vacuum full(pid 300):open 读 lockfile(200 已死)→ foreignLockHolder=null → 覆盖为 {pid:300}。runGc 查 unifiedActiveWriter() → foreignLockHolder=null + 新读=自己 → 返回 null → 守卫不触发 → 全量 VACUUM 在代理(100)仍写时进行 → 饿死代理。

关键事实:lockfile 只在 open() 时写(store.ts:634),写操作不重断言;close() 仅在 foreignLockHolder===null 时删(store.ts:764)。所以中间 CLI 的覆盖是持久的(直到下次 open)。

影响面:同时削弱 runGc(#4612)与本 PR 的 runRm 守卫。触发条件 = 常驻代理 + 中间 CLI + 后续全量 VACUUM CLI。严重度 = 高(饿死共驻代理,正是 #4612 要防的 hazard)。

这是既有问题,非本 PR 引入:本 PR 是严格改进(在原本无守卫的 runRm 加上守卫);覆盖发生在 open() 时,与本 PR 无关。本 PR 可独立合入。

选项:

  • A. 接受为已知局限:lockfile 本就是「尽力探测、fail-open」设计,中间 CLI 覆盖是已知代价。不加代码,在文档/注释里注明。代价:守卫在「代理 + 中间 CLI + 全量 VACUUM」时序下失效。
  • B. 写时重断言:代理在每次写(或周期性)重断言 lockfile,使中间 CLI 的覆盖被快速纠正。代价:写路径加锁文件 I/O;需改 store.ts 写路径(跨文件、设计级)。
  • C. 换信号:不依赖 lockfile,改用其它「活跃写者」信号。代价:需设计新信号,可能更复杂。

推荐:A(接受为已知局限)+ 文档注明。理由:本 PR 与 #4612 已覆盖「直接 代理→全量 VACUUM」的常见场景;中间 CLI 覆盖是较少见的时序,且 lockfile 本就是 fail-open 设计。B/C 是更大的设计改动,应独立立项、独立评估,不塞进本 PR。若 owner 认为该场景足够常见/严重,再拍板 B 或 C。

请 owner 拍板:A / B / C(或其它)。

@ranxianglei

ranxianglei commented Nov 16, 2026 •

Copy link
Copy Markdown
Owner Author

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

Review 完成:结论 APPROVE(代码正确、测试到位、无回归;agent 不能自批自己的 PR,正式 approval 待 owner 点按)。另发现一处既有设计级弱点(<db>.lock 最后开者胜可被中间 CLI 覆盖 → 守卫失效),已单独提 🔶 需要决策 并打 needs-decision 标签,不阻塞本 PR。

@ranxianglei

Copy link
Copy Markdown
Owner Author

🤖 Powered by ework · qwen3.8-27b

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

这条 🔶 需要决策 是我(review agent)上一条评论的回显,不是 owner 的新输入——A/B/C 仍等 @ranxianglei 明确拍板,我这边不代决、不预设。

重申推荐:A(接受为已知局限 + 文档注明)。理由一句话:该弱点是既有的(同样影响 #4612 已合入的 runGc),lockfile 本就是 fail-open 设计;B/C 是更大的设计改动,应独立立项,不塞进本 PR。

该弱点不阻塞本 PR:本 PR 是严格改进(给原本无守卫的 runRm 补守卫),结论维持 APPROVE,可独立合入。在 owner 拍板前我不动任何代码。

@ranxianglei

Copy link
Copy Markdown
Owner Author

🤖 Powered by ework · qwen3.8-27b

[ework] CI fix verified green ✓

ci-check added 2 commits November 18, 2026 10:18
…reign writer holds index.db

After owner ruling 3a6ab62 (a live second writer never blocks startup),
per-operation guards are the sole defense against an O(db-size) exclusive
VACUUM starving a co-resident instance. storage gc kept its #4612 up-front
refusal (CLI + panel endpoint); sessions rm's default full vacuum had none —
while a proxy held index.db it could win the exclusive lock and starve that
proxy's writes across the whole rewrite.

runRm now checks store.unifiedActiveWriter() (same source of truth as
runGc's refusal) before the shrink: a live foreign writer ⇒ skip ONLY the
shrink with an actionable pid-named note; the deletion is a short
transaction and stays committed (same graceful shape as the pre-existing
SQLITE_BUSY path). No-writer and --no-vacuum paths unchanged. All four
full-VACUUM sites are now guarded: runGc, runRm, admin.ts panel endpoint
(#4612 409), store.gc.
…ES (PR #5330 red CI)

The suite spawns one bare `node -e` dummy child (live PID holder for the
<db>.lock fixtures); SPAWN_RE matched it but it was never registered, so the
pretest tripwire aborted all 11 test shards before any test ran
(run 42962029584). Concurrency reviewed per #1248: no ports bound, no
network I/O, mkdtemp-isolated per test — same shape as the #4612/#5046-B
entries; appended last so existing slot indices are untouched.
@ranxianglei
ranxianglei force-pushed the 2026-10-31_rm-full-vacuum-live-writer-guard branch from 98789cc to ad41155 Compare November 18, 2026 02:25
@ranxianglei

Copy link
Copy Markdown
Owner Author

🤖 Powered by ework · qwen3.8-27b

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

Conflict resolved — branch rebased onto current master, force-pushed. Verified against live sources before touching anything:

  1. Live state (this run, not memory). GitHub API: mergeable: false, mergeable_state: dirty, head 98789cc520 (unchanged — no concurrent agent on the branch). The mirror check-cache was stale (snapshot 2026-11-16, sha 98789cc520, all checks skipped due to the behind state); the prior head was fully green per the last verified run.
  2. Master moved 139 commits (f648217cb8 → 0e475ceb4f). Exactly ONE of them touches a PR file — 55d1f69729 appends tests/upstream-ca-default-trust.test.ts to the LIVE_FILES array tail, the same spot this PR's entry was appended. src/storage-maintenance.ts and the test file are untouched by master's advance, so the fix commit replays clean.
  3. Rebase + one conflict. Rebased onto master tip 0e475ceb4f: the fix commit applied byte-identical (verified: zero diff vs the original); the LIVE_FILES commit hit ONE append-only conflict hunk, resolved as union — master's upstream-ca-default-trust entry kept in its position, this PR's issue5236-rm-vacuum-writer-guard entry after it. New head ad4115542a (fix 11347a9b97 + LIVE_FILES ad4115542a). Net diff vs master unchanged in shape: 3 files, +179/−8.
  4. Verification on the rebased tree. typecheck clean; LIVE_FILES 71 entries all exist, SPAWN_RE tripwire scan → 0 unregistered spawners; targeted suites 10/10 green (tests/issue5236-rm-vacuum-writer-guard.test.ts 3/3 + adjacent tests/storage-maintenance-cli.test.ts 7/7). Full-suite verdict belongs to remote CI.
  5. Push. Remote head verified unchanged (98789cc520) immediately before a --force-with-lease push → ad4115542a. Post-push: mergeable: true, mergeable_state: blocked = required checks pending on the new head, not a conflict. Commit-message secret scan clean.

The prior head was fully green; the only delta is the union of the LIVE_FILES registrations plus master's own 139 commits, so the rerun is expected green — but I am not asserting green until the checks land. No design decisions needed, nothing escalated.


中文八问

  1. 是什么问题:PR 分支与 master 再次脱节(落后 139 个提交),合并状态 dirty——本轮只有合并冲突,没有红 CI(上一 head 98789cc520 已全绿)。
  2. 什么原因导致的:master 持续前进,其中提交 55d1f69729 往 scripts/live-files.mjs 的 LIVE_FILES 数组尾部追加了 tests/upstream-ca-default-trust.test.ts 注册项,与本 PR 的注册项落在同一位置 → 追加型文本冲突;storage-maintenance.ts 与测试文件 master 未触碰,无冲突。
  3. 影响范围与严重程度:仅 PR 分支自身的可合并性;master 与用户均不受影响;属保持 PR 可合并状态的例行操作,流程级。
  4. 怎么修复的:rebase 到最新 master(0e475ceb4f);唯一冲突(LIVE_FILES 尾部)按并集解决——保留 master 新增项、本 PR 条目置于其后;fix 提交原样干净重放(逐字节不变)。
  5. 是否有回归问题:审过的既有行为——本 PR 的 runRm vacuum 守卫逻辑逐字节未变;master 侧 139 个提交与本 PR diff 零语义交集(仅共享热文件 LIVE_FILES 尾部追加,纯登记、不动既有 slot 索引);typecheck 干净、定向套件 10/10 绿;全量回归以远程 CI 为准。高危模式逐项过:无语义漂移、无阈值/时序/输出格式变化、无 fail-fast 变吞错。
  6. 是否破坏缓存:不涉及(纯 git 历史操作 + CI 登记,未触碰缓存/重试/游标/去重键)。
  7. 是否改了设计方向:没有(纯冲突解决,无语义变更)。
  8. 是否引入了新的配置:没有。

判定:冲突已清(mergeable: true),等远端 CI 在新 head ad4115542a 上重跑出结果(前 head 全绿,预期绿);若红,下轮按签名分账。本轮无需 owner 决策。

@ranxianglei

Copy link
Copy Markdown
Owner Author

🤖 Powered by ework · qwen3.8-27b

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

Red CI diagnosed — this is an inherited master-level Windows-specific regression, NOT this PR's diff. Escalated to #4599; not fixing in-branch per the CI-coordination policy.

Re-verified live before acting: the failing check is test (windows-latest, 22, 5) on head ad4115542a (run 44223152987, job 134538434097, run_attempt 1). The mirror check-cache was stale (snapshot 02:33Z, test shards still queued), so I did a single read of the job + its log (allowed for log details; no gh-polling).

What failed. The only failure in the whole phase (2256 tests / 2248 pass / 1 fail / 7 skip) is tests/server-process-listeners.test.ts at the FILE level: exitCode: 1, ERR_TEST_FAILURE, error: 'test failed' — its subtests all pass, but the process exits non-zero with no error payload. The CI's own diagnostic isolated-re-ran it serially and it reproduced ("deterministic break"), and the full-phase retry failed the same way. It passes on Linux (I ran it locally: 4/4 subtests, exit 0) but fails deterministically on Windows.

Why it's not this PR. This PR's diff is src/storage-maintenance.ts (runRm vacuum guard) + scripts/live-files.mjs (registration) + tests/issue5236-rm-vacuum-writer-guard.test.ts (new test). None of that touches the signal-handler code or this test — src/server.ts does not import storage-maintenance.ts. The prime suspect is master commit 894835ac94 ("keep signal handlers alive during the shutdown flush window", a cherry-pick marked "proposed fix for PR #7026"), which sits in the 139-commit range my rebase brought in and which modified BOTH src/server.ts (the handler code) AND this test file (added the 4th subtest "graceful shutdown keeps signal handlers until the process exits" — the one that never runs on Windows). The previous head (on the older base, without 894835ac94) was green.

Action. Per the CI-coordination policy (owner 2026-10-24), an inherited master-level failure is not fixed in the PR branch ("禁止在自己分支重复修 master 级失败"). ci-fixes is 71 commits behind master and does NOT contain a fix, so there is nothing to merge. Reported to #4599. This PR's CI goes green once the master regression is fixed and the check re-runs; no branch change is needed from me.


中文八问

  1. 是什么问题:PR head ad4115542a 的 test (windows-latest, 22, 5) 分片红——唯一失败是 tests/server-process-listeners.test.ts 文件级 exit 1(子测试全过、进程无错误载荷即退出),确定性复现(隔离串行重跑 + 全量重试均挂)。
  2. 什么原因导致的:不是本 PR 的 diff。本 PR 只改 storage-maintenance.ts / live-files.mjs / 自己的测试,均不触及信号处理器代码或该测试文件(src/server.ts 不 import storage-maintenance.ts)。主嫌是 master 提交 894835ac94(cherry-pick,"proposed fix for PR [PR] fix: release process handlers when an embedded server closes #7026"),它同时改了 src/server.ts 的信号处理器代码和该测试文件(新增第 4 子测试),且落在本次 rebase 带入的 139 提交区间内;Linux 本地过、Windows 确定性挂。
  3. 影响范围与严重程度:仅本 PR 的 CI 可合并性(继承性红);非用户侧功能问题;master 侧该 Windows 回归在修复前会让所有 rebase 到 tip 的 PR 继承此红。
  4. 怎么修复的:本轮未在分支内修(按 CI 协调政策,继承性 master 级失败不在 PR 分支修)。已定位根因并上报 CI Control Center: Centralized CI Failure Handling & Status Sync (Comment all CI issues here; do not open new issues) | CI 总控: CI 失败集中处理与状态同步(所有 CI 问题在此评论, 勿开新 issue) #4599,等 master 侧修复后 rebase 重触发即绿。
  5. 是否有回归问题:本 PR diff 未引入任何回归(未触及失败路径);红是继承的 master 回归,与本 PR 无关。
  6. 是否破坏缓存:不涉及。
  7. 是否改了设计方向:没有(本轮无代码改动)。
  8. 是否引入了新的配置:没有。

判定:红 CI 已定性为继承性 master 级 Windows 回归(非本 PR 所致),已上报 #4599;本分支无需改动,等 master 修复后重触发即绿。本轮无代码推送。

@ranxianglei

Copy link
Copy Markdown
Owner Author

🤖 Powered by ework · qwen3.8-27b

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

CI Lane — PR #5330 Red-CI Fix (attempt 1/6)

What I did this run:

  1. Re-verified the live check state (mirror cache, fetched 11:28:07Z, fresh): the single failure was still test (windows-latest, 22, 5) on the old head ad4115542a (run 44223152987). Not green yet.

  2. Found the master fix: master advanced from 0e475ceb4f to 548e396022, which includes commit 3186e54ad2 fix(tests): make the shutdown-signal test portable to Windows (it killed its own child on win32). This is the exact fix for the failing test.

  3. Root cause confirmed: the failing test tests/server-process-listeners.test.ts (subtest 4 "graceful shutdown keeps signal handlers until the process exits", added by master commit 894835ac94 for PR [PR] fix: release process handlers when an embedded server closes #7026) assumed POSIX signal semantics — process.kill(self, SIGINT) expected to dispatch to the installed handler. On Windows, the same call terminates the process (TerminateProcess) WITHOUT running handlers. The windows-latest CI child died at the first kill line: file-level failure, zero TAP output, deterministic.

  4. Merged the new master tip (548e396022) into my branch (clean merge, no conflicts — no file overlap between my branch and the master advance). The fix 3186e54ad2 is now in my branch.

  5. Verified locally:

    • npm run typecheck — clean (no errors).
    • tests/server-process-listeners.test.ts — 4/4 pass (including the previously-failing subtest 4).
    • tests/issue5236-rm-vacuum-writer-guard.test.ts — 3/3 pass (this PR's test).
  6. Pushed the merge commit d59f6ae557 as the final head (no [ework:ci-held] marker — it's the one full CI pass). Remote head verified unchanged before push (no concurrent agent).

  7. Re-verified the live check state (mirror cache, fetched 11:39:28Z, fresh): the new head d59f6ae557 is now the branch head. CI is running (12 pending, 0 failed). The previously-failing check test (windows-latest, 22, 5) is now pending (re-running on the new head).

Expected outcome: the fix 3186e54ad2 makes the shutdown-signal test portable to Windows (it invokes the installed handler directly on win32 instead of process.kill). The fix was verified on a real win10 box (4/4 pass). The CI should go green.


中文八问

  1. 是什么问题:PR [PR] fix(#5236): sessions rm must not full-VACUUM under a live foreign writer #5330 的 CI 在 test (windows-latest, 22, 5) 上红了——tests/server-process-listeners.test.ts 在 Windows 上文件级失败(exit 1,零 TAP 输出,确定性复现)。
  2. 什么原因导致的:不是本 PR 的 diff 导致的。是 master 上的 commit 894835ac94(为 PR [PR] fix: release process handlers when an embedded server closes #7026 添加的第 4 个子测试)假设了 POSIX 信号语义——process.kill(self, SIGINT) 期望分发到已安装的 handler。但在 Windows 上,同样的调用会直接终止进程(TerminateProcess),不运行 handler。CI 的 Windows 子进程在第一个 kill 行就死了。
  3. 影响范围与严重程度:仅影响 Windows CI(test (windows-latest, 22, 5))。Linux 上 4/4 通过。严重程度:阻塞 PR 合并(CI 红)。
  4. 怎么修复的:master 已经包含了修复(3186e54ad2)——在 win32 上直接调用已安装的 handler(而不是 process.kill),使测试可移植到 Windows。我通过 merge 新 master tip(548e396022)把修复带进了本 PR 分支。
  5. 是否有回归问题:无。merge 是干净的(无冲突,无文件重叠)。typecheck 干净。本地验证:之前失败的测试 4/4 通过,本 PR 的测试 3/3 通过。
  6. 是否破坏缓存:不涉及。
  7. 是否改了设计方向:不涉及。
  8. 是否引入了新的配置:不涉及。

判定:修复已推送(merge commit d59f6ae557),CI 正在新 head 上运行(12 pending, 0 failed)。预期 CI 转绿。

@ranxianglei ranxianglei left a comment

Copy link
Copy Markdown
Owner Author

Choose a reason for hiding this comment

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

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

Re-review after rebase — APPROVE (verdict stands).

The head moved 98789cc52 → d59f6ae55 solely because the branch was merged with current master (548e396022). The PR's own diff is byte-identical to the previously-reviewed head:

  • src/storage-maintenance.ts — identical
  • tests/issue5236-rm-vacuum-writer-guard.test.ts — identical
  • scripts/live-files.mjs — the PR's own issue5236 registration (line 157) is intact; the only delta vs the old head is master's unrelated upstream-ca-default-trust.test.ts line pulled in by the rebase.

CI on the new head d59f6ae55 is now fully green: 18 success, 12 skipped, 0 fail (the test shards still queued at first review have completed).

No kernel/ change, no config surface, no wire, no version touch. The full correctness / registry / 8-question analysis from my first review (on 98789cc52) applies unchanged. The pre-existing <db>.lock last-opener-wins clobber gap remains a 🔶 需要决策 (options A/B/C) pending the owner's ruling — it is not a blocker on this PR.


8问(中文,复述判定,内容未变)

  1. 是什么问题:bili sessions rm 默认会做整库 full VACUUM,在长驻代理正持有 index.db 写锁时会长时间卡死(#5236/#4612)。
  2. 什么原因导致的:runRm 缺少 runGc 已有的 unifiedActiveWriter() 前置守卫(unifiedVacuum 内部无守卫,须逐点加)。
  3. 影响范围与严重程度:特定条件(有活跃外部写者时执行 sessions rm)下 rm 卡死 / 影子 3 连败;删除本身(短事务)不受影响。
  4. 怎么修复的:runRm 在 shrink 前查 store.unifiedActiveWriter();有活跃外部写者 ⇒ 只跳过 shrink 并给出带 pid 的说明;删除照常提交;无写者 / --no-vacuum 路径不变;JSON 车道带 vacuumed=false + vacuumNote。
  5. 是否有回归问题:无——无写者、--no-vacuum、legacy 路径均未变;与 runGc 守卫同源一致。
  6. 是否破坏缓存:不涉及缓存 / 重试 / 游标 / 去重键。
  7. 是否改了设计方向:不涉及——沿用 #4612 的逐操作守卫设计,未改架构。
  8. 是否引入了新的配置:不涉及——无新 env / config / 默认值。

判定:APPROVE(agent 不能自批自己的 PR,正式 approve 点击留待 owner)。

@ranxianglei

Copy link
Copy Markdown
Owner Author

🤖 Powered by ework · qwen3.8-27b

(ai: vllm-qwen/qwen3.8-27b) Re-review of #5330 on the new head d59f6ae55: the head moved only via a merge with current master — the PR's own 3-file diff is byte-identical to the previously-reviewed 98789cc52, and CI is now fully green (18 success / 12 skipped / 0 fail). APPROVE verdict stands (re-review posted as review 5956263655; the formal approve click stays with the owner since an agent can't self-approve). Also closed a first-round house-rule gap: added the mandatory (ai: …) provenance line to my 3 earlier posts. The 🔶 需要决策 clobber-gap ruling (A/B/C) is still pending the owner.

@ranxianglei ranxianglei left a comment

Copy link
Copy Markdown
Owner Author

Choose a reason for hiding this comment

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

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

Re-review after rebase (3rd) — APPROVE (verdict stands).

The head moved d59f6ae55 → 99bfd2a4b solely because the branch was merged with current master (1e357bf2d66). The PR's own diff is byte-identical to the previously-reviewed head:

  • src/storage-maintenance.ts — identical
  • tests/issue5236-rm-vacuum-writer-guard.test.ts — identical
  • scripts/live-files.mjs — the PR's own issue5236 registration (line 157) is intact; the only delta is master's storage-integrity-cache.test.ts registration (#7156) pulled in by the rebase.

Master interaction checked, not just assumed. The rebase pulled in master's #7156 (storage-corruption / WAL-TRUNCATE-under-live-peer work), which touches the same storage files the PR's guard depends on. Verified:

  • unifiedActiveWriter() (src/persist.ts) and the activeForeignWriter() definition (src/storage/store.ts:892) are unchanged.
  • The core lock discipline is intact: open() still overwrites <db>.lock with own pid (store.ts:671); close() still unlinks only when foreignLockHolder === null (store.ts:870).
  • #7156 only added call sites for activeForeignWriter() (gating WAL-TRUNCATE and integrity-cache refresh under a live peer) plus a boot-time foreignLockPidAtBoot capture — i.e. it consumes the same live-foreign-writer signal the PR's runRm guard uses. Complementary, not conflicting.

CI on 99bfd2a4b (mirror cache, fetched_at 2026-11-20T05:16:45Z): no failures — 14 success, 11 skipped, 5 still in_progress at read time. The prior head d59f6ae55 was fully green (18 success / 12 skipped / 0 fail); the residual in_progress shards are a master-integration confirmation (the PR content itself is unchanged and was green).

No kernel/ change in the PR's own diff, no config surface, no wire, no version touch. The full correctness / registry / 8-question analysis from my first review applies unchanged. The pre-existing <db>.lock last-opener-wins clobber gap remains a 🔶 需要决策 (A/B/C) pending the owner — not a blocker on this PR.


8问(中文,PR 自身内容未变,复述判定)

  1. 是什么问题:bili sessions rm 默认整库 full VACUUM,在长驻代理持有 index.db 写锁时长时间卡死(#5236/#4612)。
  2. 什么原因导致的:runRm 缺少 runGc 已有的 unifiedActiveWriter() 前置守卫(unifiedVacuum 内部无守卫,须逐点加)。
  3. 影响范围与严重程度:特定条件(有活跃外部写者时执行 sessions rm)下 rm 卡死 / 影子 3 连败;删除本身(短事务)不受影响。
  4. 怎么修复的:runRm 在 shrink 前查 store.unifiedActiveWriter();有活跃外部写者 ⇒ 只跳过 shrink 并给出带 pid 的说明;删除照常提交;无写者 / --no-vacuum 路径不变;JSON 车道带 vacuumed=false + vacuumNote。
  5. 是否有回归问题:无——无写者 / --no-vacuum / legacy 路径均未变;与 runGc 守卫同源一致;master #7156 对存储层的改动经核对本 PR 依赖的 activeForeignWriter() 定义与锁纪律均未变(互补而非冲突)。
  6. 是否破坏缓存:不涉及缓存 / 重试 / 游标 / 去重键。
  7. 是否改了设计方向:不涉及——沿用 #4612 的逐操作守卫设计,未改架构。
  8. 是否引入了新的配置:不涉及——无新 env / config / 默认值。

判定:APPROVE(agent 不能自批自己的 PR,正式 approve 点击留待 owner)。

@ranxianglei

Copy link
Copy Markdown
Owner Author

🤖 Powered by ework · qwen3.8-27b

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

Resolved the merge conflict and pushed the final head.

This run: the PR had drifted from master (master advanced 20+ commits since the last rebase, including the #7156 storage-corruption/dual-writer fixes and a kernel bump 0.0.199→0.0.200). Merging origin/master (1e357bf2d66) into the branch produced ONE conflict in scripts/live-files.mjs — both sides appended a LIVE_FILES entry at the same spot (master added tests/storage-integrity-cache.test.ts, this PR added tests/issue5236-rm-vacuum-writer-guard.test.ts). Resolved as UNION (kept both entries). No other conflicts.

Also note: the local working copy had been left out of sync (reset to a master commit 6453feeeb84); I reset it to the remote head (d59f6ae5571) before merging.

Verified locally on the merged tree:

  • npm run typecheck clean
  • tests/server-process-listeners.test.ts 4/4 (incl. the previously-Windows-failing subtest)
  • tests/issue5236-rm-vacuum-writer-guard.test.ts 3/3 (this PR's test)
  • tests/storage-integrity-cache.test.ts (new master test) — passes (part of the 20/20 run)

Pushed 99bfd2a4bfb as the final head (fast-forward, no force-push; remote head was unchanged at d59f6ae5571 before the push). No [ework:ci-held] marker — this is the branch's one full CI pass.

Live state (mirror cache, fetched 05:03:50Z): sha 99bfd2a4bfb, mergeable_state: blocked (not dirty — conflict cleared), 30 checks / 0 failed / 15 pending (rest queued/skipped). CI is running on the new head.


中文八问

  1. 是什么问题:PR 分支落后 master(master 自上次 rebase 后前进了 20+ 个提交,含 [Bug][storage] Takeover spawns before reclaim: old and new sidecars simultaneously hold index.db, causing corruption; em | [Bug][storage] 接管时先 spawn 后回收:新旧侧车同时持有 index.db 引发损坏;空 payload_json 又让历史会话静默变 0 #7156 存储损坏/双写者修复与 kernel 0.0.199→0.0.200 升级),merge 时 scripts/live-files.mjs 出现一处冲突——双方都在 LIVE_FILES 数组尾部追加了各自的新测试条目。

  2. 什么原因导致的:master 与本 PR 各自独立地在 LIVE_FILES 数组末尾新增条目(master 加 tests/storage-integrity-cache.test.ts,本 PR 加 tests/issue5236-rm-vacuum-writer-guard.test.ts),git 无法自动合并同一位置的追加,产生内容冲突。

  3. 影响范围与严重程度:仅影响本 PR 分支与 master 的合并;不影响已发布行为。冲突解决前 PR 处于 dirty(不可合并)状态,解决后恢复 blocked(等待 CI)。

  4. 怎么修复的:按「并集」原则解决冲突——两个 LIVE_FILES 条目都保留(issue5236 条目在前,storage-integrity-cache 条目在后),不删任何一方的注册。这是追加型数组的标准解法。

  5. 是否有回归问题:无。冲突文件 scripts/live-files.mjs 是测试注册表(SPAWN_RE 哨兵用),保留两个条目不影响任何运行时行为。本地 typecheck 干净 + 相关测试全绿(含本 PR 的 3/3 与 master 新增的 storage-integrity-cache 测试)。

  6. 是否破坏缓存:不涉及。

  7. 是否改了设计方向:不涉及。

  8. 是否引入了新的配置:不涉及。

结论:冲突已解决、最终 head 已推送、CI 正在新 head 上运行。无设计决策、无授权门禁。等待 CI 结果。

@ranxianglei

Copy link
Copy Markdown
Owner Author

🤖 Powered by ework · qwen3.8-27b

(ai: vllm-qwen/qwen3.8-27b) Re-review of #5330 on the new head 99bfd2a4b: the head moved only via a merge with current master (1e357bf2d66) — the PR's own 3-file diff is byte-identical to the previously-reviewed head, and I verified the rebase's master #7156 storage changes are complementary (the activeForeignWriter() definition and lock discipline the guard relies on are unchanged). CI shows no failures (14 success / 11 skipped / 5 in_progress at read time; prior head fully green). APPROVE verdict stands (re-review 5987958258; formal approve click stays with the owner). The 🔶 需要决策 clobber-gap ruling (A/B/C) is still pending the owner.

@ranxianglei

Copy link
Copy Markdown
Owner Author

🤖 Powered by ework · qwen3.8-27b

[ework] CI fix verified green ✓

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

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant