Repository navigation
[PR] e2e: Fix 5 client e2e lanes broken by pure SQLite defaults + advisory half-deletion race | e2e: 修好被纯SQLite默认击穿的5条客户端e2e泳道 + advisory半删除竞态 - #6572
Conversation
…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.
📦 Built Package ArtifactBranch: Latest build — install this exact versionnpm install -g billion-context@0.0.9676-pr.6572.0ef4314This exact version is immutable and reproducible. The rolling Recent builds (commit → version)
Download artifact
tar xzf billion-context-pr6572.tgz
npm install -g packageInstall 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.
…path) The original comment asserted the updater 'uninstall→reinstall half-deletes the install dir (npm drops package.json before the directory)'. Verified against src/update.ts: there is no npm uninstall anywhere; every install (normal self-update, advisory forceInstallVersion, manual) goes through installViaTarball, whose success path overwrites package.json in place (cp staging→installDir) and never deletes it. The only installDir deletion is restoreFromBackup (failure path only, immediately restored). So the stated mechanism does not exist. Reword the comment to describe the observed behavior (transient ENOENT while the updater rewrites the install dir) without asserting an unverified mechanism. The pkgVersionOrAbsent fix itself is unchanged and remains correct: ENOENT→null→keep polling, timeout still fails, non-ENOENT still throws.
[bot] 🏷 (ai: vllm-qwen/qwen3.8-27b) 查重: 同家族但机制不同——与 #6567 高度重叠,建议合并。 #6567(先到,11-13 16:18)同样修 e2e-native-pi 泳道被 pure-sqlite 默认击穿,但用预写沙箱 config 文件( 审核独立性声明: 以下八问与结论系本人独立审 diff + 核代码 + 查 CI 后产出,未照抄 issue 侧分析。 ① 审原 issue(方向关): issue 诊断的两条根因中,第一条(纯SQLite默认击穿 5 泳道)完全成立——已核 src/knobs.ts:1050-1075(resolveJsonWriterChoice 三态)+ src/persist.ts:665-675(jsonWriterOff 门)+ 各泳道 cleanEnv 先剥光 BILI*/BILLION_CONTEXT*/ACP_ 再只注入钉死的变量,断言 sessionFiles() 扫 ② 回归审查(整体关): 逐文件清点既有行为——
③ 代码审查(主关): 逻辑、不变量、错误处理均过。 ④ 测试有效性审查(质量关): 这些是 e2e 泳道,断言有牙(sessionFiles 长度、版本翻转、advisory 回滚落地)。 ⑤ diff 整洁度: 干净。全部测试文件,无跑题、无生成物、无锁文件连带、无纯空/缩进重排。每行都与本 PR 目的相关。 ⑤b 代码整洁硬标准: 命名达意(pkgVersionOrAbsent 清晰)、无死代码、无重复、错误处理完整(非 ENOENT rethrow)、无魔法数字、注释讲为什么(修正后)、风格一致、不引入依赖、函数单一职责。全项过。 ⑥ CI 证据(活核): 本 PR 自身 CI 的 e2e 泳道是 gate-skip(无 ci:full label,门在 .github/workflows/ci-e2e-native.yml:30-57 + ci-registry.yml:30-57,仅 ci:full/dispatch/30min cron 才真跑)——issue 自己也承认此前「绿」是 skip 不是通过。真实验证 = 发布分支 #6552(ci:full)的 CI: 已核 #6552 head(d252543,含同款 3 个 fix commit)的全部 e2e 泳道 GREEN(real pi package-native / dsh headless / opencode native / pi codex-responses WS / hermetic registry ubuntu+windows 全 success)。#6552 与 #6572 的 diff 仅版本文件(package.json / package-lock.json / 4 个 plugin manifest),测试文件内容逐字节相同。 结构化八问:
合并判定: 功能正确可合,但需先解决与 #6567 的重叠。 所有功能改动已独立验证正确,CI 真实验证(#6552 ci:full)全绿。唯一阻塞项是与 #6567 的同根因重叠——建议 owner 拍板合并策略(保留本 PR 关 #6567,或并入后关 #6567)。另: 我在 review 期间向 PR 分支补了两个 commit——ad0616d6b3(修正 advisory 假根因注释)+ 已 rebase 到作者新推的 ada04fd(persist 关 store sidecar,Windows EBUSY)之上。 |
[bot] 🏷 (ai: vllm-qwen/qwen3.8-27b) 进度汇报(重启后确认): 审核工作已在重启前完成并投递,无阻塞。当前状态:
无待办,等 owner 对 #6567 重叠的处置决定。 |
|
本 PR 的全部 5 个修复(e2e 车道 dual-write 钉位 ×6 文件、advisory 探针 ENOENT 容忍、notice-registry env 泄漏、persist 套件 Windows EBUSY closeQuietly、注释修正)已随 #6552(release 分支合入 master)完整落在 master(c26e001b6 起,逐文件核对:6 个 e2e 文件的 BILI_STORAGE_JSON_WRITER 钉位、pkgVersionOrAbsent、两处 closeQuietly、notice-registry 的 delete 都在)。cherry-pick 到当前 master 全部冲突 = 内容已存在。此 PR 失去存在意义,关闭。 |
现象
发布 v0.1.214(PR #6552)的 CI 里 5 条客户端 e2e 泳道全红(native-pi / native-dsh / native-opencode / pi-codex-ws / subagent-sessions),报
proxy must persist the session (got 0 sessions);另有一条 ubuntu "hermetic registry e2e" 偶发红(advisory-rollback 泳道)。根因
sessionFiles()扫描sessions/<prov>/*.json),但 5a80e2b 只更新了单元测试,没动 e2e harness → 新默认下代理只落 index.db,JSONL 为 0 个 → 断言必挂。本地用 CI 同款 pi-stable@0.83.6 在 PR head 上确定性复现(7/8 子测试挂,磁盘上只有 index.db)。waitFor探针里readPkgVersion直接读文件 → 半删除窗口内 ENOENT 从 waitFor 抛出(该处无 try/catch)→ 子测试崩。本地可复现(npm -g uninstall 后目录残留、package.json 已消失)。修复
BILI_STORAGE_JSON_WRITER=1(双写):这些泳道测的是代理/会话语义,不是存储默认;纯SQLite路径由单元测试 + 真模型 gate 覆盖。e2e-advisory-rollback.test.ts新增pkgVersionOrAbsent():ENOENT 视为"还没到"(继续轮询,60s 超时仍会断言失败),非 ENOENT 照常抛。验证