Repository navigation
[PR] fix: make snapshot-render D-lane test deterministic and surface degrade reason (#3771) - #3774
Conversation
📦 Built Package ArtifactBranch: Option A — Install this exact build (recommended)npm install -g billion-context@0.0.4479-pr.3774.b39aac7This exact version is immutable and reproducible. The rolling Option B — Download artifact
tar xzf billion-context-pr3774.tgz
npm install -g packageInstall instructions are refreshed on each push. |
(ai: vllm-qwen/qwen3.8-27b) 范围缺口提醒(来自并行的 PR #3770 review):你的修复没有覆盖 PR #3770(google 车道接入 snapshot render)在 证据:全量矩阵 run 39196237026(#3770 head 322502e)中,google 变体以与 openai 三件套完全相同的签名失败—— 建议:合并前把 合并顺序提示:两个 PR 改同一测试文件,#3770 的 google 测试是按修复前 harness 写的——后合的一方 rebase 时记得把新 helper 用上。 |
(ai: vllm-qwen/qwen3.8-27b) 查重: 不重复 —— 本 PR 即 #3771 的修复 PR(唯一 Closes #3771);在途的 #3770(snapshot-render google-lane)与 #3753(lite-fold anchors)虽同属 snapshot-render 域,但症状与机制均不同,不构成重复。 标签: bug / scope/ci / p2(CI 非确定性红灯 + 假覆盖信号;功能可用但每次命中分片都可能红,需绕行) 审核进行中:已独立通读全部 diff(2 文件,+59/−13)与两个文件全文;master 自 PR base 前进了 5 个提交(hermes-plugin context window + 另两套测试的 teardown 收口),与本 PR 文件零重叠、无语义交互。本地定向测试与 CI 结果出来后给结构化八问结论。 |
(ai: vllm-qwen/qwen3.8-27b) 结论:原 head(2eedf61)CI 红灯未过——但根因已独立钉死并修复,commit 828bea1 已推到本 PR 分支,等 CI 复验。 CI 事实(PR 自身 head 的 run 39198572850 @ 2eedf61)
根因(独立重推,不采纳 PR 正文的诊断)
证据链(本地可复现,非推断):
修复(已推 828bea1,独立标注 commit)在 preload 内做文件级豁免:node --test 每文件一个子进程,argv 恰好指向一个套件;仅 行为变更披露(old → new)
结构化八问
余留事项
判定:828bea148 CI 转绿 + #3770 缺口处置明确后即可合并;合并动作留给人工。 |
828bea1 to
e01aff5
Compare
(ai: vllm-qwen/qwen3.8-27b) 冲突已解决,rebase 到最新 master 并 force-push(新 head 冲突根因:本 PR 和已合入的 #3749( 八问:
诚实说明一句:rebase 之后,PR 标题里「make deterministic」那半已经被 master 上 #3749 的合入覆盖,本 PR 现在的实际范围 = 降级原因显性化 + 存储基线豁免。 本地验证:typecheck 干净; |
(ai: vllm-qwen/qwen3.8-27b) 进展简报(floor 6 之后):master 已前进到 2b40342——#3770(google lane,#3764)已合入,你的 f296b0e「settle on the store tail view」也已在 master。PR 分支现与 master 冲突(mergeable_state=dirty),正在按「union of intent」rebase:
rebase 完成后会跑 typecheck + 精确 CI 命令定向验证再推,CI 结果出来补八问收尾。 |
c57144b to
0193499
Compare
The D-lane e2e (tests/snapshot-render.test.ts) failed non-deterministically in CI while passing locally: most functional asserts also hold in legacy mode, so a run where the D lane never activated read as "flaky latch" instead of "lane never activated". The fixed-window nap replacement now lives on master as settleRows (f296b0e: wait until the session's tail view CHANGES); this commit lands the two pieces that remain: - assertDActive(): loud guard in every D-on test (openai AND google variants). If the lane did not actually render, it throws naming the degrade reason plus store state (replicasAvailable/rows/seqs), closing the silent-legacy blind spot so a future genuine degrade fails informatively instead of tripping an opaque latch assert. - src/server/snapshot-render.ts: additive session.metadata['snapshotRenderDegradeReason'] marker set on each post-arm degrade (store-unavailable/transcript-empty/ row-unparsable/view-pointer-missing-row/transcript-error/chain-not-started) and cleared on success. Pre-arm exits (rollout off / nothing armed) are untouched. No wire or message-shape change: degrades still return clientMsgs unchanged. - Contract pins both directions (#3617 gate discipline): the storage-unavailable test asserts the surfaced reason ('transcript-empty'); steady-state asserts the marker clears after successful D renders.
The test never pinned its storage mode. An ambient BILI_STORAGE_UNIFIED of legacy/0/false (or a config value) resolves mode to "legacy", where maybeOpen returns null SILENTLY and the harness store has no unified sidecar. Every D-on test then silently ran the legacy path and failed on the D latch / anchor / prefix asserts — CI-only red because local runs had the var unset (default shadow). Pinning shadow makes the sidecar open deterministically; verified green under =0/=false/unset incl. the google lane.
0193499 to
3b45e67
Compare
(ai: vllm-qwen/qwen3.8-27b) 最终状态:分支已收敛为两个 commit(e9b71de + 3b45e67,rebase 到当前 master 2b40342),本地全绿,等 CI 复验。 过程披露(重要,如实说明)
根因(floor 7 已详述,一句话版)CI preload 把 行为变更披露(old → new)
结构化八问
本地验证(最终树 3b45e67)
判定:代码侧已闭环(CI 复验为最后一步);合并动作留给人工。 |
📦 Merged Build PublishedThis merge to master was published as npm install -g billion-context@0.0.598-master.5afa77f # this exact build
npm install -g billion-context@master # always the newest merged build
|
Closes #3771
What was broken
The snapshot-render D-lane suite (
tests/snapshot-render.test.ts) failed non-deterministically in CI (all five D-on tests) while passing locally. The trip-wire wasD observability latch counted turns, but the real signal wasreplicasAvailable=false rows=null seqs=null— the unified replica was simply absent for the harness store.Root cause (corrected from the earlier settle-timing framing)
Not a commit-timing race. The test never pinned its storage mode: top-of-file sets only
NODE_ENV/BILI_PERSIST_ZSTD/BILI_CONFIG_FILE(pointing at a non-existentno-config.json). When the ambientBILI_STORAGE_UNIFIEDresolves to anything other than shadow (0/false/legacy/garbage, or a config value),resolveStorageModereturns"legacy", whereUnifiedShadow.maybeOpenreturns null silently (no log) and the harness store has no unified sidecar. Every D-on test then silently ran the legacy path and tripped the latch / anchor / prefix asserts. Local runs had the var unset → defaultshadow→ passed, which is what made it look environment-dependent.Repro:
BILI_STORAGE_UNIFIED=0 node --import tsx --test tests/snapshot-render.test.ts→# pass 2 # fail 5, byte-identical to CI.Fix
BILI_STORAGE_UNIFIED=shadowat the top of the test so the sidecar opens deterministically regardless of ambient env (the D-lane requires a readable unified transcript by construction).snapshotRenderDegradeReasonmarker onsession.metadata: each post-arm degradation records why (store-unavailable/transcript-empty/row-unparsable/view-pointer-missing-row/transcript-error/chain-not-started), cleared on a successful render. Makes future D-lane degradation diagnosable instead of silent. No wire/message-shape change — every degrade still returnsclientMsgsunchanged. Pinned by the storage-unavailable test.Rebased onto current master; no conflict with f296b0e's
settleRows.Verification
BILI_STORAGE_UNIFIED=0/false/ unset (was# pass 2 # fail 5before), incl. the google lane added since.npm run typecheckclean.Behavior change (flagged)
session.metadata.snapshotRenderDegradeReason(string; set only on a post-arm degrade, cleared on success). Diagnostic-only — does not touch outbound bytes. Old: degrades were indistinguishable. New: the reason is recorded.shadow(previously inherited the ambient value). No production default changed.