Skip to content

[PR] release v0.1.214 - #6552

Merged
ranxianglei merged 14 commits into
masterfrom
2026-11-13_release-v0.1.214
Nov 14, 2026
Merged

ranxianglei merged 14 commits into
masterfrom
2026-11-13_release-v0.1.214

Conversation

@github-actions

@github-actions github-actions Bot commented Nov 13, 2026 •

Copy link
Copy Markdown
Contributor

Auto-fallback from the one-click release workflow: direct push to master was blocked by branch protection. Merging this PR publishes via the standard release.yml flow.

Changes since v0.1.213

…nstall dir

The pure-SQLite storage default (owner decision 2026-11-13, 5a80e2b) stopped
writing JSONL session envelopes by default. Five hermetic client e2e lanes
(native-pi / native-dsh / native-opencode / pi-codex-ws / subagent-sessions)
assert those envelopes and were not updated with the default flip: they now
fail with 'proxy must persist the session (got 0 sessions)' (reproduced
locally with the CI-pinned pi-stable 0.83.6 and on the PR head). Pin
BILI_STORAGE_JSON_WRITER=1 in the spawned-client env: these lanes cover
proxy/session semantics, not the storage default — the pure-SQLite path stays
covered by unit tests and the real-model gate.

Also: the advisory-rollback waitFor probes crashed with ENOENT when the
updater's uninstall->reinstall half-deletes the install dir (npm drops
package.json before the directory; reproduced locally). New
pkgVersionOrAbsent() helper treats that window as 'not there yet'; non-ENOENT
errors still throw. This was the ubuntu flake behind the 'hermetic registry
e2e' red on 16b8d9b (run 43454198949).
The CI-only baseline preload (tests/preload-storage-baseline.mjs) pins
BILI_STORAGE_UNIFIED=legacy for the legacy-default corpus. The
sqlite-default notice test asserts the production default (absent
spelling => pure-sqlite), so without an explicit unpin it passes locally
(no preload) and reds every CI test shard carrying this file. Also unpin
BILI_STORAGE_JSON_WRITER for the same predicate.
@github-actions

github-actions Bot commented Nov 13, 2026 •

Copy link
Copy Markdown
Contributor Author

📦 Built Package Artifact

Branch: 2026-11-13_release-v0.1.214 (acc7944)

Latest build — install this exact version

npm install -g billion-context@0.0.9896-pr.6552.7889c0c

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
acc7944 billion-context@0.0.9896-pr.6552.7889c0c build
be980cc billion-context@0.0.9891-pr.6552.b09429f build
0db3305 billion-context@0.0.9858-pr.6552.5171283 build
b604ff1 billion-context@0.0.9840-pr.6552.82aa23a build
09577a2 billion-context@0.0.9833-pr.6552.e50750a build
c337b3d billion-context@0.0.9811-pr.6552.243a9c2 build
7c152dc billion-context@0.0.9670-pr.6552.02569f4 build
d252543 billion-context@0.0.9637-pr.6552.c115f7e build
fdf4644 billion-context@0.0.9621-pr.6552.b963bbf build

Download artifact

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

Install instructions are refreshed on each push.

tests/e2e/e2e-native-dsh-persona.test.ts asserts JSONL session envelopes
('the raw conversation key persisted a session') but its spawned env missed
the same pin as the other client lanes — red in the e2e-dsh lane.
…EBUSY)

The dual-write pins added with the pure-sqlite default flip make
persist-zstd and persist-metadata-fold-gate open index.db; the suites
never closed their stores, so the tmp-dir teardown raced a still-open
SQLite handle — Windows cannot unlink an open file, and the retry
budget in tmp-rm.ts lost deterministically (EBUSY unlink .../index.db
on windows 22/1, 22/3, 24/1, 24/3; same suites green on v0.1.213).

Close every store (closeQuietly: cancel pending writes + sidecar
close) before rmrf. closeQuietly is idempotent-safe where
flushAll already closed the sidecar.
@ranxianglei

Copy link
Copy Markdown
Owner

v0.1.214 release review(master ← 2026-11-13_release-v0.1.214,616 files / +54981 / -12993)

这是啥问题

按"上一版本 v0.1.213 → 本版本"的大 diff 整体 review(不是逐 PR 看),重点查 dsh/性能/缓存、session msgid、存储四块的回归。结论:发现 3 个回归,全部已在本分支修复并验证;其余 dsh/性能/缓存、session msgid、存储主线均确认无回归。真模型回归门(bili gate,A 压缩 / B 切换 / U registry / restart / plugin 五段)对照 v0.1.213 基线跑,结论见文末。

根因与修复(3 个回归)

1. e2e 客户端车道全挂:pure-SQLite 默认值把 JSONL 会话文件停了,但 e2e 断言还在读 JSONL

  • 本版本 commit 5a80e2b8e 把存储默认从"双写(JSON envelope + index.db)"翻成"只写 index.db"。它更新了单测,没有更新 e2e:5 条客户端车道(native-pi / native-dsh / native-opencode / pi-codex-ws / subagent-sessions)的 harness 都用 cleanEnv() 清空环境变量后启动客户端,新默认下 proxy 只写 index.db,车道断言 sessions/**/*.json 一律拿到 0 个文件。
  • 本地复现:native-pi 7/8 失败(全部 "proxy must persist the session")、dsh 1/3、opencode 2/4、pi-codex-ws 5/6,与 CI 红完全一致。
  • 修复(见 fix PR):在 6 条车道的被启动客户端 env 里显式钉回双写 BILI_STORAGE_JSON_WRITER=1(这些车道测的是 proxy/会话语义,不是存储默认本身;pure-sqlite 语义由单测 + 真模型门的 restart 段覆盖)。

2. Windows 单测分片确定性挂:测试打开 index.db 后从不关句柄

  • 同一个 5a80e2b8e 给 tests/persist-zstd.test.ts 和 tests/persist-metadata-fold-gate.test.ts 顶部加了 BILI_STORAGE_UNIFIED=full 钉(保证双写、envelope 照写),但这两个套件建了 store 从不 close就删临时目录。之前它们跑 legacy 模式没有 index.db 所以没事;钉了 full 之后每个 store 都打开 index.db,Windows 无法 unlink 打开着的 SQLite 文件 → EBUSY unlink .../index.db,retry 预算耗尽,4 个 windows 分片(22/1、22/3、24/1、24/3)全挂。v0.1.213 同分片全绿,是本版本引入。
  • 修复:teardown 前对每个 store 调 closeQuietly()(取消未决写入 + 关 sidecar 句柄)。本地 20/20 通过。

3. ubuntu 单测挂:notice-registry 测试没防 CI 专属 storage preload

  • tests/notice-registry.test.ts(本版本新增,钉 "storage-sqlite-default" 通知)假设"全新安装"。但 CI 单测有 tests/preload-storage-baseline.mjs 前置注入 BILI_STORAGE_UNIFIED=legacy([PR] fix: make full-mode storage tests deterministic (#4004) #4011 教训文件),导致通知判定 sqliteDefaultNoticeActive() 为假,2 个用例确定性失败;本地不注入所以绿,CI 必红。
  • 修复:该文件在 hermetic env 设置后显式删除这两个变量,并注释说明为什么(本地/CI 双绿)。

dsh / 性能 / 缓存(专项,无确认回归)

session msgid / block 生命周期(专项,无回归)

存储(专项,无 P0 回归;3 条建议关注)

  • 向后兼容:老 JSON 会话 boot 时 union 读回(persist.ts:912/1690),旧索引库 auto_vacuum=0 保持到下次全量 VACUUM(e6e746a 只修新建文件的 pragma 顺序)—— 文档已知行为。
  • 6 个 JSON sidecar 迁入 kv_store,带 demote-to-file 兜底 + 5s 退出冲刷;原子归档替换;simhash Int8→Int16 有样例集 pin。
  • 建议关注(不阻塞合入):① index.db 运行中坏掉 = 静默状态丢失直到进程死(3-strike envelope 回退 2026-10-30 已按 owner 策略移除,boot 时失败仍正确回退);② 老 JSON envelope 永不清理(index gc 只归档索引行,文件只靠 opt-in BILI_SESSION_GC);③ kv_store 跨车道读改写竞态(进程内有 kvChain 串行,跨进程输家车道会丢 affinity 链/顺序骨架 —— 可自学习状态,非会话数据)。

真模型回归门(bili gate,本机 2 模型,qwen/glm 双端点,五段:压缩 / 切换 / registry / install+update / restart)

对照组 v0.1.213 vs 候选 v0.1.214,两轮均完整跑完(约各 4.5h)。总体 verdict 两侧都是 RED —— 但逐段拆开看,RED 完全来自基线自身的既有失败(模型服务间歇空回复 / 超时),v0.1.214 没有任何新增回归,且多数段严格更优:

段 v0.1.213 (对照) v0.1.214 (候选) 判定
A 压缩 3/9(连 fold/nudge/preflight 整条链路都没触发) 7/9(fold、nudge、preflight、S40 全部真实触发并答对) 更优;仅剩 2 项与对照同因的既有失败(折叠后 S07 召回模型返回空、cache report 探针无输出)
B 模型切换 5/6 6/6(双 marker 切换后都召回) 更优
U registry 2/2 2/2 平
I install / X auto-update 3/3 / 4/4 3/3 / 4/4 平
plugin 车道 23/66 48/78 同因失败、数量减半
restart 段 32/42 27/42 失败逐项核对(见下)

restart 段 27 vs 32 的逐项人工核对(这是唯一"变少"的段,不能只看数字):

  • 候选侧新增的失败全部是模型服务侧的既有病:pi P2 干净退出对照组自己 120s 挂死(无 proxy 参与的控制行)、dsh S40 模型空回复(t1 corpus read 同一探针在 pi 车道通过,证明 proxy 转发无恙)。
  • 两侧共同失败同机制:dsh 小窗口 fold 后转发字节数与 raw 相同(对照 138218 vs 138218,候选 148242 vs 148242)、R0/R1/R2 续跑字节略超 raw fiber、t3/t4 CONTEXT_WINDOW_EXCEEDED(pi-ai 客户端侧溢出检测)。
  • 候选侧最难的持久化检查反而通过:pi P2 "resumed outbound compact after clean — 40757 bytes vs raw fiber 129631" ✅、"cache recovered across restarts ≥50% — cached=10176 ≈ 99% of prior" ✅ —— 纯 SQLite 默认下重启恢复 + 缓存恢复链路验证通过。

唯一需要说明的 gate 侧发现(非 proxy 回归):plugin 车道 "plugin lane claimed" 断言在候选侧失败(gate 脚本扫 JSONL 会话文件找 metadata.pluginAgent,纯 SQLite 默认不再写 JSONL)。已人工核验 index.db 里该行完好:"pluginAgent":"pi", "lastWindowSource":"plugin", "storageMode":"full" —— 数据一个没丢,是 gate 脚本的载体断言需要跟上存储默认变化(可选后续:gate 脚本钉 BILI_STORAGE_JSON_WRITER=1 或改读 index.db)。

结论:可以合并吗

可以。 三个回归全部修复(本分支 af49339 / cc47215 / 7c152dc 三个 cherry-pick,另见配套 fix PR),全部 e2e 车道 + ubuntu/windows 单测 + build 在最终 head 全绿;真模型门相对 v0.1.213 基线无新增失败(见上)。合并由人工执行(禁非人类合并)。

URL

最终状态(发评时)

ranxianglei added a commit to bluesmilery/billion-context that referenced this pull request Nov 14, 2026
…ing the latest run at the sha (ranxianglei#6552)

v0.1.214 one-click release: after the bot opened the fallback PR ranxianglei#6552, GitHub
auto-created pull_request runs at the publish sha. Because the PR author is the
github-actions app, those runs sit behind manual approval (ranxianglei#772) and complete
'action_required' without executing a single job — but with run ids NEWER than
the workflow_dispatch compensation runs fired by release-manual.yml.

latestRunAt() sorted by run id and returned runs[0], so the gate picked the
approval noise as 'the latest run at the publish sha'. classify() has
'action_required' in RED_CONCLUSIONS, so --wait refused 26 seconds after the
PR opened and the 60-minute supervision never ran; --dispatch would equally
have skipped lanes whose only run was an action_required run.

Treat terminal action_required runs as non-runs: the gate falls through to the
run that actually executed, or to 'missing', which dispatches. per_page 5->10
so a stack of approval noise cannot mask a real run. Three regression tests
against the mock API.
@ranxianglei

Copy link
Copy Markdown
Owner

🤖 Powered by ework · qwen3.8-27b

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

我独立核验了这份 review 的关键结论,并发现一个 review 发布后分支已前移 的情况,需要说明。

已核验(review 结论成立)

关键新发现:review 发布后分支已前移

  • review 发评时(09:02 +0800)head 是 7c152dc08a,声称"最终 head 全部 workflow success"。
  • 但发评之后(09:11、09:28)release 分支又合入了 master:PR #6482(29 个碎片修复 batch)、PR #6568(release gate 修 approval-pending 误杀 26s)、kernel 0.0.197、pi-subagents 0.2.4,head 现在到 c337b3dd21。
  • 这 110 个文件 / +5451 是 review 窗口之外新增的 master 内容(各自合入 master 前已单独 review)。
  • 当前 head c337b3dd21 的 CI 仍在跑(30 checks:26 pending / 0 failed / 0 success)。所以 review 的"CI 全绿"是针对旧 head 7c152dc08a 的,尚未在当前 head 复确认。

新增高危内容抽查(非全量重审,只点高危域)

结论(可合判定)

  • review 的分析与 3 个修复独立核验成立。
  • 但"可以合并"是针对旧 head 7c152dc08a 的;当前 head c337b3dd21 还差 CI 绿。新增内容是已单独 review 的 master 内容,预期无新 release 回归,但需 CI 在当前 head 确认。
  • 建议:等 c337b3dd21 的 CI 全绿后再由人工合并(禁非人类合并)。CI 一绿我再确认一次并回报。

…mark fastpath (#5403/#5418 regression)

The #4753 input-release (bodyText = undefined before streaming) made the
fastpath gate in prepare-openai (bodyText !== undefined && ...) unreachable:
the watermark fastpath silently never fired, and plugin wire sessions paid
the full reparse+rehash on every turn. Release the text only on the slice
where the fastpath cannot fire (non-openai wire or flag off); the strict
gate (pluginMode + !titleGen) in prepare-openai stays authoritative.

Also update the A/B pin: #5687 moved the dsh single-shot sidecar distinction
from "tool-less" to the sidecar budget (hasSingleShotBudget, <=8192), so the
test's 64K tool-less turn-0 is now (correctly) a main turn — model the real
sidecar with a 4K budget to keep pinning "side lane never stamps".
The five 'HTTP CCR ... fails closed after cold disk restore' tests corrupt
and re-read a .content-store.json envelope, which the pure-SQLite default
writer (2026-11-13) never emits — ENOENT on sessions/<protocol> turned the
e2e-dsh-plugin-lane red on this branch. Pin BILI_STORAGE_JSON_WRITER=1
(restore in finally) like the other e2e lanes (d252543/74a925db); the
tests still delete index.db before the cold restore, so the fail-closed
409 contract is unchanged.
@ranxianglei

Copy link
Copy Markdown
Owner

CI fix: e2e-dsh-plugin-lane was red (run 43548669714) because of the pure-SQLite storage default (2026-11-13): the five 'HTTP CCR … fails closed after cold disk restore' tests in tests/plugin-fork.test.ts corrupt and re-read a .content-store.json envelope, but the default writer no longer emits JSON envelopes, so readdirSync(sessions/anthropic) hit ENOENT.

Fix in b604ff1: pin BILI_STORAGE_JSON_WRITER=1 (dual-write, restored in finally) in exactly those five tests — same pattern the other e2e lanes already got in 74a925d / d252543. The tests still delete index.db before the cold restore, so the fail-closed 409 contract they assert is unchanged; pure-sqlite-only semantics remain covered by the storage unit tests. Verified locally: 57/57 pass (was 52/5 with the same 5 ENOENT failures as CI).

This fix also lands on master automatically when this PR merges (branch = master + release commits).

@ranxianglei

Copy link
Copy Markdown
Owner

🤖 Powered by ework · qwen3.8-27b

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

更新:当前 head c337b3dd21 的 CI 已经跑完,是红的,不是绿。 我上一条说"还在跑、等绿再确认"——现在能确认了,结论要改。

CI 实测(直接查 GitHub check-runs,镜像缓存当时是旧的没刷新)

  • 88 个 check-run 全部 completed:75 success / 7 failure / 6 skipped。
  • 7 个失败全是 test (…, 3) 分片 3,且跨平台全中:ubuntu 22/3、ubuntu 24/3、windows 22/3、windows 24/3(两个 run 各跑一遍,签名一致)。
  • 这是确定性失败(同一分片、所有平台同挂),不是 flaky。

关键判断:这是 review 之后新引入的回归

  • review 发评时的 head 7c152dc08a 是全绿(review 里"最终 head 全部 workflow success"、"4 个 windows 分片全挂→已修")。
  • 但发评后(09:11、09:28)分支又合入了 master:PR #6482(29 个碎片修复 batch)、PR #6568、kernel 0.0.197、pi-subagents 0.2.4 → head 到 c337b3dd21。
  • 所以现在挂的分片 3 是这批新 master 内容带进来的,不是 review 已修的那 3 个回归(review 修的是 Windows EBUSY 的 persist 句柄,这次 ubuntu 也挂,签名不同,是新问题)。

我卡住的说明

  • 我尝试拉分片 3 的失败日志定位具体用例,但 check-run logs 端点返回 404(两次进程因长时间无输出被重启)。所以具体是哪个测试断言失败我还没钉死——但"分片 3 全平台确定性红"这个事实已经确凿。

结论(可合判定,改)

  • 不可合:CI 红。 当前 head c337b3dd21 分片 3 确定性失败,必须先修。
  • review 本身的分析(3 个回归 + 修复)我独立核验成立,但那针对的是旧 head;新 master 内容引入了新的分片 3 回归,需要单独定位修复。
  • 下一步(我来做):拉分片 3 的具体失败用例(换 Actions run 日志端点),定位是哪个测试/哪条新 master 改动引入,给出修复方向。

合并仍由人工执行(禁非人类合并);当前状态:拦下,等分片 3 修绿。

@ranxianglei

Copy link
Copy Markdown
Owner

🤖 Powered by ework · qwen3.8-27b

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

收到你的 CI 修复报告(b604ff1,plugin-fork CCR cold-restore 5 个测试)。我交叉核验了分支与 CI 当前状态:

分支状态(已 fetch 最新)

CI 当前状态(直接查 check-runs,head b604ff1)

  • 88 个 check-run:52 success / 1 failure / 31 还在跑 / 4 skipped。
  • 当前唯一失败:dsh plugin lane (fork adoption + side-request isolation + lane truth tables)。
  • 注意:这个失败名和你修的 5 个 CCR cold-restore 测试不是同一组——你修的是 "HTTP CCR … fails closed after cold disk restore",这个挂的是 "fork adoption + side-request isolation + lane truth tables"。可能是同一 lane 里的另一组用例,也可能是独立问题。

判断

  • 你本地 57/57 通过,说明 CCR cold-restore 那 5 个确实修好了。
  • 但 CI 上 dsh plugin lane 还有一组用例在挂(fork adoption / side-request isolation / lane truth tables),且 CI 还没跑完(31 个 in-progress)。
  • 我不动手(这是你的修复线,且 CI 还在跑)。等 CI 跑完我确认最终状态;如果这组用例持续红,我再帮你拉具体失败日志定位。

合并仍由人工执行;当前状态:CI 未跑完,暂不能判定。

'child persists its own companion and survives a proxy restart (#1341)'
counts the .content-store.json companion envelope on disk, which the
pure-SQLite default writer (2026-11-13) never emits (0 !== 1 — red in the
e2e-dsh-plugin-lane, run 43550710438). Pin BILI_STORAGE_JSON_WRITER=1
(restore in finally) like the other e2e lanes (74a925d/d252543a and the
plugin-fork pin in b604ff1). Full lane verified locally: 12 suites,
165 tests, 0 failures.
@ranxianglei

Copy link
Copy Markdown
Owner

Second CI fix: b604ff1 turned 11/13 green; the two remaining reds:

  1. e2e-dsh-plugin-lane (43550710438) — one more pure-SQLite storage-writer straggler: 'child persists its own companion and survives a proxy restart (bug(ccr): fork adoption carries covered refs without adopting their content-store entries #1341)' in tests/fork-ccr-adoption.test.ts counted a .content-store.json envelope that the default writer no longer emits (0 !== 1). Fixed in 0db3305 with the same dual-write pin as before; full lane verified locally (12 suites / 165 tests / 0 failures).
  2. CI push run (43550705980) — single windows-latest job, single test: 'abort x proxy-openai-sse: client abort mid-stream destroys the upstream request' (tests/wire-exit-matrix.test.ts:263). Same commit went green on the pull_request-side CI run and both sibling abort tests passed; local repro passes. Treating as a one-off Windows timing flake — the fresh full suite on 0db3305 re-verifies it; will dig if it repeats.

@ranxianglei

Copy link
Copy Markdown
Owner

🤖 Powered by ework · qwen3.8-27b

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

Confirmed the "Second CI fix" — I verified both fixes locally on head 0db33059:

  1. e2e-dsh-plugin-lane straggler (tests/fork-ccr-adoption.test.ts, child persists its own companion and survives a proxy restart (#1341)): the test counts the .content-store.json companion envelope on disk, which the pure-SQLite default writer (2026-11-13) no longer emits. 0db33059 pins BILI_STORAGE_JSON_WRITER=1 (restored in finally), matching the sibling e2e pins. Verified locally: tests/fork-ccr-adoption.test.ts passes 7/7, including the #1341 companion test.

  2. Windows flake (tests/wire-exit-matrix.test.ts:263, abort x proxy-openai-sse: client abort mid-stream destroys the upstream request): treating as a one-off Windows timing flake is reasonable — the same commit went green on the pull_request-side run and both sibling abort tests passed. The fresh full suite on 0db33059 re-verifies it; if it repeats it's a real timing bug worth digging into (the abort→upstream-destroy path is a wire-exit invariant, not cosmetic).

State as of this run:

  • Live head: 0db33059 (one commit after b604ff1).
  • Mirror check cache is stale (still reporting b604ff1, fetched_at 04:01:00Z, ~40 min old — it hasn't picked up the 0db33059 run yet). I did not gh-poll for the fresh run; your report (b604ff1 → 11/13 green, 2 reds addressed) is the current authoritative picture, and my local verification of both fixes is consistent with it.
  • No further action from me this run — both storage-writer fixes are on the branch and verified locally; the Windows flake is under observation.

八问:

  1. 是什么问题:v0.1.214 分支 CI 还剩两处红——e2e-dsh-plugin-lane 的一个 pure-SQLite 存储 writer 漏网用例,以及一个 windows-latest 单测 flake。
  2. 什么原因导致的:①2026-11-13 起默认存储 writer 切到 pure-SQLite,不再落 .content-store.json 信封,而该用例在磁盘上数这个信封(0 !== 1);②windows 单测是 abort→上游销毁路径的时序 flake(同 commit 在 pull_request 侧绿、两个兄弟 abort 用例也过)。
  3. 影响范围与严重程度:仅 CI 红,无线上影响;①是存储 writer 切换的测试漏网(CI 层面),②是平台特定(flake)。
  4. 怎么修复的:①0db33059 给该用例钉 BILI_STORAGE_JSON_WRITER=1(finally 恢复),与兄弟 e2e 车道一致;②不改代码,按一次性 flake 观察,0db33059 全量重跑复验,复现再深挖。
  5. 是否有回归问题:本地复验①的 fork-ccr-adoption 7/7 全绿;②未改代码,无回归面。
  6. 是否破坏缓存:不涉及(①是存储 writer 的测试钉,不碰缓存/重试/增量游标;②未改代码)。
  7. 是否改了设计方向:不涉及(①是测试侧对齐既有存储契约,未转向;②未改代码)。
  8. 是否引入了新的配置:不涉及(①复用既有 BILI_STORAGE_JSON_WRITER env,无新 key/默认值;②未改代码)。

收工判定:两处红的处置我已本地核验(①修复已上分支且本地全绿;②按 flake 观察合理)。无需我再推改动;0db33059 的全量重跑给出最终判定,若 windows flake 复现再立项深挖。

@ranxianglei

Copy link
Copy Markdown
Owner

为什么没有release报告

The e2e-fake-codex lane's #2195 test failed in CI (run 43557997361) with
ERR_SQLITE_ERROR 'database is locked' from the very first statement of a
fresh proxy: the machine-global $XDG_DATA_HOME/.../index.db is written by
every bili instance on the box (#5082 supported topology), and a peer
still holding the file (draining proxy, sibling job on the same runner)
refused the startup outright:

- the pre-migration quick_check ran before any busy_timeout existed on
  the connection -> raw SQLITE_BUSY instead of a bounded wait;
- deeper: PRAGMA journal_mode needs exclusive access and BYPASSES the
  busy handler entirely - with the file in its legacy journal mode and a
  peer in a write transaction it throws at 0 ms even with
  busy_timeout=5000 installed (deterministic repro now in
  tests/storage-open-busy-lock.test.ts, which fails pre-fix).

Fix, per the #5082 owner decision that a live foreign writer never blocks
startup: install busy_timeout right after open; skip the journal switch
when the file header already declares WAL (strict no-op, plain file
read); defer it to the next open when the switch comes back BUSY.

Pinned by tests/storage-open-busy-lock.test.ts (child-process lock
holder; legacy-journal shape fails pre-fix, WAL shape guards the skip).
These lanes pinned XDG_CONFIG/CACHE/STATE per test but inherited
XDG_DATA_HOME, so their spawned proxies wrote their session index to the
machine-global sessions dir. The CI jobs are bare runs-on: ubuntu-latest
(no container) and GitHub's shared-pool runners run several jobs of
several repos side by side under the same user - every concurrently
running bili proxy on that runner shares one index.db. #2195's t3
launcher burned its 60 s health budget on exactly this. Every other e2e
lane already pins a per-test data dir (e2e-native-pi/dsh/opencode/pi-
codex-ws); pin the same shape in e2e-codex-fake/-persona/e2e-codex.
@ranxianglei

Copy link
Copy Markdown
Owner

第三个 CI 失败修掉了,只触发了失败的 lane。

失败:e2e-fake-codex(run 43557997361 @ 0db3305)的 #2195 测试——t3 这次启动的新 proxy 第一条 SQL 就报 database is locked,launcher 把 60 秒健康检查预算耗尽在启动失败页上。

根因(两层):

  1. 这条 lane 的三个 e2e 文件只隔离了 XDG_CONFIG/CACHE/STATE,XDG_DATA_HOME 是继承的 → 测试里拉起的 proxy 全部写到机器全局的 sessions index.db。CI 是裸 runs-on: ubuntu-latest(无容器),GitHub 共享 runner 上同一时刻会并排跑多个 repo 的 job、同一个用户 → 别的 job 里在跑的 bili proxy 和同一个 index.db 抢写锁,新 proxy 一开库就撞锁,直接拒绝启动。其他 e2e lane(native-pi/dsh/opencode/pi-codex-ws)早就 pin 了 per-test data 目录,只有 codex 这三条漏了。
  2. 库代码本身对这个撞锁形状不设防:PRAGMA journal_mode 需要独占访问且绕过 busy handler——文件还是旧日志模式、又有 peer 持写事务时,即使装了 busy_timeout=5000 也在 0ms 直接抛 SQLITE_BUSY(已做成确定性复现);另外 pre-migration 的 quick_check 跑在装 busy_timeout 之前,裸连接上任何瞬态锁都是 raw 抛错。

修复:

验证:本地 #2195 通过(修复后);新单元测试 pre-fix 失败 / post-fix 通过;tsc 对改动文件零错误;storage 相关单测套件本地全绿(issue5627 的 2 个失败在改动前就存在,非本次引入)。CI 只重跑了 e2e-fake-codex(run 43563459859 @ 50f8e28),其余 13 个重复 run 已取消。

@ranxianglei ranxianglei reopened this Nov 14, 2026
@ranxianglei

Copy link
Copy Markdown
Owner

🤖 Powered by ework · qwen3.8-27b

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

第三个 CI 修复已本地核验(head 现 be980cc2,含一次 master 合并):

关于 @Dog 问的「为什么没有 release 报告」:

v0.1.214 的 release PR 还在 CI 修复阶段、尚未合并,所以还没有 GitHub Release / 发布产物——GitHub Release(含 release notes)是 PR 合并后由 CI 自动创建的,现在还没到那一步。

另外,release-notes/package.json 里没有 v0.1.214 的条目,这是符合预期的:按 #1870 的 release-notes 策略,只有 SEVERE release 才需要条目,普通 release 不带 notes(gates 在缺失时通过)。当前最新条目是 v0.1.208(critical)。所以 v0.1.214 作为普通 release 没有 release-notes 条目是正常的。

如果你指的是别的「release 报告」(比如 PR 正文的 "Changes since vX" 清单、或发布后的 GitHub Release 文案),说清楚要哪种,我来补。

八问:

  1. 是什么问题:①e2e-fake-codex 的 [Bug][Windows Codex] WAL-only 提交时 SQLite 合并选错世代:顺序启动新增 thread 被移入 conflict #2195 测试在 CI 上撞 database is locked(机器全局 index.db 被 peer 持锁,新 proxy 启动即拒);②@Dog 问为什么没有 release 报告。
  2. 什么原因导致的:①两层——三个 codex e2e 文件没隔离 XDG_DATA_HOME(写机器全局 index.db,共享 runner 上跨 repo 抢锁)+ 库代码对撞锁形状不设防(PRAGMA journal_mode 绕过 busy handler,旧模式文件 + peer 持写事务时 0ms 抛 BUSY;pre-migration quick_check 跑在装 busy_timeout 之前);②release 还没合并,GitHub Release 由 CI 在合并后自动创建,且普通 release 本就不带 release-notes 条目。
  3. 影响范围与严重程度:①CI 红(e2e-fake-codex lane);但库代码的撞锁不设防在生产「上一实例还在 draining + 下一实例启动」的共享 index.db 拓扑下也是真实可达的,所以这次同时修了库代码(可用性层面);②无影响(解释性问题)。
  4. 怎么修复的:①c1355dc1 库代码——open 后立刻装 busy_timeout、已是 WAL 跳过 journal 切换、撞 BUSY 推迟到下次 open(A second process was detected writing to the same index.db — another process (pid 435075) is writing to the database in | 检测到第二个进程在写同一个 index.db 另一个进程(pid 435075)正在写入本会话目录的数据库——两个进程写同一个库会损坏数据(#3923/#3959)。请关闭多余实例:一个会话目录只能由一个实例服务。 #5082 策略);50f8e282 测试侧——三个 codex e2e 文件 pin per-test XDG_DATA_HOME;②无需修,说明 release 报告/notes 的产出时机与策略。
  5. 是否有回归问题:本地复验 storage-open-busy-lock 2/2 全绿;库代码改动只动 storage open 路径,跳过/推迟 journal 切换都保持「当前 journal 模式安全多进程」语义,不改变正常路径行为。
  6. 是否破坏缓存:不涉及(①是 storage open 的锁处理,不碰缓存/重试/增量游标;②解释性)。
  7. 是否改了设计方向:不涉及(①按既有 A second process was detected writing to the same index.db — another process (pid 435075) is writing to the database in | 检测到第二个进程在写同一个 index.db 另一个进程(pid 435075)正在写入本会话目录的数据库——两个进程写同一个库会损坏数据(#3923/#3959)。请关闭多余实例:一个会话目录只能由一个实例服务。 #5082「活的外来 writer 永不阻止启动」决策实现防御,未转向;②解释性)。
  8. 是否引入了新的配置:不涉及(①无新 env/config/默认值,busy_timeout=5000 是既有 storagePragmas 的值;②解释性)。

收工判定:第三个 CI 修复(库代码 + 测试 pin)已本地核验(新单测 2/2 全绿、diff 合理);be980cc2 的新 run 在跑(0 failed),给出最终判定。@Dog 的 release 报告问题已答:release 未合并故无 GitHub Release,且普通 release 本就不带 release-notes 条目。

c1355dc added tests/storage-open-busy-lock.test.ts, which spawns
lock-holder child processes, but never registered it in the shared
LIVE_FILES table — the run-ci-tests.mjs tripwire (#1248/#3182) dies
before any test runs, so every unit shard on every OS fails at the
guard step. One-line registration; suite itself passes locally
(2/2, hermetic mkdtemp, no port binds).
@ranxianglei

Copy link
Copy Markdown
Owner

大面积 CI 失败原因 + 修复(commit acc7944)

现象:merge master(be980cc2f)后,ubuntu/windows 全部 15 个 unit 分片在测试开始前就挂了。

根因:c1355dc18(sessions index open survives a concurrent writer, #2195)新增的 tests/storage-open-busy-lock.test.ts 会 spawn 子进程(锁持有者),但没在 scripts/live-files.mjs 的 LIVE_FILES 表里注册——run-ci-tests.mjs 的 #1248 tripwire 在分片启动时统一检查"所有会 spawn 的测试文件必须注册",发现缺注册直接 exit 1,所以每个分片、每个 OS 都在 guard 步骤集体阵亡,一个测试都没跑到。

修复:acc794423 一行注册(附并发假设注释:锁持有者是子进程、hermetic mkdtemp、不绑端口)。本地验证:guard 检查 PASS + 该套件 2/2 通过。

新分片跑起来后如有真实失败再报。

@ranxianglei
ranxianglei merged commit c26e001 into master Nov 14, 2026
90 checks passed
@ranxianglei

Copy link
Copy Markdown
Owner

v0.1.214 大 Diff 回归 Review —— 最终结论

范围:v0.1.213 → v0.1.214 整段大 diff(616 文件 +54981/-12993,448 commits),以及后续合入 master 的 82 个新提交(36a04a7 线)。
方法:整段 diff 逐区审查(不按 PR 逐个看)× 4 个重点方向 + 4 轮真模型 gate 对照(v0.1.213 基线 / 本 PR / 最新 master,8299 qwen3.8-27b-w8a16)+ Windows 虚拟机实测。

结论:发现 5 个回归,全部已修复并有对应验证;其余各专项未发现回归。CI 当前全绿,可以合并。

发现的回归与修复链

# 回归 影响 修复 验证
1 pure-SQLite 新默认写穿 5 条 e2e client 车道:JSON 会话信封不再默认落盘,而 e2e 断言读 JSONL 5 条 CI e2e 车道(pi/dsh/opencode/pi-codex-ws/subagent)必红 e2e 车道 spawn 环境钉 BILI_STORAGE_JSON_WRITER=1(双写),不改变产品默认 本地 8/8 等 + CI 车道全绿 → #6572(待合)+ 已 cherry-pick 进本分支
2 notice-registry 测试不净:CI 预加载把 BILI_STORAGE_UNIFIED 置 legacy,ubuntu 分片确定性红 CI unit 分片 22/1、24/1 必红 测试内删除泄漏的两个 storage env 变量 CI 两个分片转绿(已在 release 分支)
3 Windows EBUSY:#2 的测试文件让测试开 index.db 且 rmrf 前不关句柄,Windows 删不掉打开中的 SQLite 文件 Windows unit 分片 22/1、22/3、24/1、24/3 必红(v0.1.213 上同分片是绿的 = 确认回归) 两个 persist 测试套件在 rmrf 前 closeQuietly() 所有 store 本地 20/20 + CI Windows 分片转绿(已在 release 分支)
4 原地自更新 100% 失败(master 线,#6309 原子交换改写引入):预备份使 rename 目标必 ENOTEMPTY → 原子路径永远走不通;fallback 再拷到已有备份上撞 npm 相对符号链接自拷贝保护 → EINVAL 下个 master 版本起,所有 npm 布局用户 bili update 永远失败、永远停在旧版 #6643:去掉预备份,只在 fallback 且未 rename 成功时向全新目录备份 gate Lane X 容器复现原报错→修复后 4/4 全绿 + Windows VM 三场景实测(干净/重复/代理运行中更新)→ 已合入 master
5 #4753 输入释放静默禁用 watermark fastpath(master 线,批量合入引入):body 提前释放后 bodyText !== undefined 门控恒假 rollout-on 插件会话每轮全量重解析+重哈希,内存驻留优化失效(无报错、无日志) #6640:仅在 fastpath 不可能触发的协议切片才释放 body red-pin 测试(修复前必败/修复后必过)+ 4 套件绿 → 已合入 master

另有 1 个 CI 守卫问题(非产品):master 合入的新测试 tests/storage-open-busy-lock.test.ts 未注册 LIVE_FILES → 全部分片在守卫步挂掉;已修复(release 分支 acc794423,3 行注册)。

四个专项(本 PR 范围)

Gate 对照(真模型,8299)

段 v0.1.213 基线 本 PR 最新 master(36a04a7)
A 压缩 3/9 7/9 8/9
B 切换 5/6 6/6 6/6
U 注册表 2/2 2/2 2/2
I 安装 3/3 3/3 3/3
X 自动更新 4/4 4/4 2/4 = #4 已知 → 修复后重跑 4/4 全绿(1ff89e878)
plugin 23/66 48/78 74/79
restart 32/42 27/42 dsh 33/42 + pi 24/25

master 轮全部红灯 = 与基线同机制的环境类失败(模型空回复/超时、dsh 的 pi-ai 客户端 CONTEXT_WINDOW_EXCEEDED 自伤)或已知 #4;无新增产品回归。master 轮最难的持久性断言全过:pi 杀进程后恢复出站压缩 41.7KB vs 原始 127.9KB(24/25,仅中窗自校准一项环境类失败);dsh 跨重启 cache 恢复 100%(38080/38094)。

门禁 harness 修复记录(~/projects/bili-gate)

  1. plugin-lanes 断言从扫 JSONL 会话文件改为 index.db 优先(sessions.metadata_json 里的 pluginAgent),JSONL 作 fallback——pure-SQLite 下旧断言会误报「plugin lane claimed」。
  2. 修 upstream-recorder 泄漏:它继承 lane 的日志管道 stderr 且 lane 中途异常时不被 kill,导致整个 gate 卡死在 restart 段结束处 3 小时(本轮 master 实测遇到并手工解除)。
  3. gate 默认模型服务 8199 → 8299。

最终状态

shreynshah pushed a commit to shreynshah/billion-context that referenced this pull request Nov 15, 2026
…n wire log

plugin-lanes.mjs — bring the lane script forward to the state that ran the
ranxianglei#6552 full gate (the repo copy predated it):

- plugin claim is read from the sessions index.db metadata FIRST and the
  JSONL envelope scan is kept only as a fallback. Pure-SQLite has been the
  storage default since 2026-11-13, so JSONL-only claim checks could go red
  on a perfectly healthy session (that is exactly what the ranxianglei#6552 gate
  review found — the data sat in index.db while the lane asserted on the
  JSONL that was never written).
- CODEWORDS / buildCorpus are exported: restart-lanes.mjs reuses the same
  corpus generator (commit 2).
- requireSync via createRequire (node:sqlite is loaded lazily, only when a
  candidate session actually has an index.db).
- keep the recorder-spawn comment for the 2026-11-14 wedged-tee fix.

upstream-recorder.mjs — record a capped 256KiB rolling tail of each response
body plus per-request ms: usage / cached_tokens live in the FINAL stream
chunk, and Lane R's cache-hit assertions read them from the recorded tail.
Sensitive headers (authorization / x-api-key / cookie / ...) stay masked —
bili forwards the model API key into this hop on every request.
This was referenced Nov 15, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment