Repository navigation
Cold-load diagnostics: a session state that loads with refs but no blocks now warns loudly instead of replaying raw in silence (#3573) - #3591
Conversation
… silent The v0.1.198 incident session re-entered as raw history with zero fold-reconcile logs: reconcileFoldCoverage early-exits silently when the loaded state carries no active blocks, and nothing logged what the lazy cold load actually restored. Every on-disk load now reports its carried refs/blocks/baseline at info level, and the incident signature (refs mapped, zero persisted blocks) escalates to a warning naming the consequence, so the next occurrence is a one-line diagnosis.
📦 Built Package ArtifactBranch: Option A — Install this exact build (recommended)npm install -g billion-context@0.0.4248-pr.3591.4dcaa62This exact version is immutable and reproducible. The rolling Option B — Download artifact
tar xzf billion-context-pr3591.tgz
npm install -g packageInstall instructions are refreshed on each push. |
Review found the refs-without-blocks warn also fires for sessions that were NEVER folded (any session with >=1 persisted turn and zero folds): after a restart, revisiting ordinary short sessions would log the same warning as a lost-fold incident, diluting the signal this PR exists to create. Both lines now carry stats.tokensSaved: >0 proves compression ran in the session's lifetime (folds existed and are now missing — investigate); 0 means likely never folded (raw replay is its normal shape). The warn condition stays deliberately broad so a loss mode that also erases stats cannot go silent again. Tests pin both classes.
(ai: vllm-qwen/qwen3.8-27b) 查重: 不重复 — #3586(折叠后鬼表 meter)、#3590(马拉松超耐心)与本 PR 同属 #3573 但机制互不覆盖;本 PR 是 OP 修复方向 ①("至少 log")点名的载入侧诊断。另查了 open PR:无其他 PR 触碰 persist 冷载入日志路径。 审核结论(八问)
判定:代码与测试质量达标,方向与 OP ① 一致,回归面干净;待 3e38248 的 CI 全绿后可合(合并动作归你)。PR 描述已补 review supplement 段。 |
(ai: vllm-qwen/qwen3.8-27b) CI 确认:head 3e38248 主 CI(run 39046631518)全绿——含此前 flaky 的 审核收工:代码与测试达标、回归面干净、补充 commit 已并入分支,可合(合并归你)。 |
📦 Merged Build PublishedThis merge to master was published as npm install -g billion-context@0.0.547-master.fd3232f # this exact build
npm install -g billion-context@master # always the newest merged build
|
(ai: vllm-qwen/qwen3.8-27b)
What
The v0.1.198 incident (#3573) left a folded session re-entering as raw history — 1820 messages, usage 0%, ref=0 — with zero fold-reconcile logs, so three candidate causes (state never loaded / loaded refs-without-blocks / request keyed onto a ghost fork id) were indistinguishable in the field.
Code audit pinned why it was silent:
reconcileFoldCoverageearly-exits without logging when the loaded state has no active blocks (nothing to reconcile), and the lazy cold-load path (SessionStore.loadSync, warmed-0 default) logged nothing about what it actually restored from disk. This PR makes that moment observable:No behavior change beyond the two log lines: no thresholds, wire shape, persistence format, or defaults touched. Log-only observability on a hot path is one
Object.keys+ two filters per cold load (a rare event by design).Relationship to the other #3573 halves
Note for transparency: an earlier draft of my work on this issue also included a preflight "cold-start deformation" deterministic-digest fast path. That half was dropped as superseded by #3590's wall-clock admission, which reaches the same acceptance criterion (first turn finishes within client patience) while keeping model-quality summaries and adding no new regime.
Verification
tests/issue3573-cold-load-diagnostics.test.ts: 3 cases (incident signature → WARN + counts; healthy load → counts, no warning; empty state → no false positive). Runs under the default unified-shadow storage mode (what the incident machine ran). Mutation-checked: 0/3 pass with the persist.ts change reverted, 3/3 with it.tests/issue3157-persist-durability.test.tsgreen locally; typecheck clean. Full-suite verdict = remote CI on this head.查重: 不重复 — #3586 / #3590 同属本 issue 但各自修「折叠后鬼表」与「马拉松超耐心」两个机制;本 PR 是 OP 修复方向 ① 点名的载入侧诊断,三者互不覆盖。
Refs #3573
Review supplement (2026-10-17, agent review): commit 3e38248 adds
savedTok(stats.tokensSaved) to both log lines. The original refs-without-blocks warn also fires for sessions that were NEVER folded (any session with >=1 persisted turn and zero folds), so ordinary short sessions would log the same warning as a lost-fold incident after every restart./NO persisted blocks/+savedTok>0= folds existed and are missing (investigate);savedTok=0= likely never folded (raw replay is normal). Warn condition deliberately stays broad so a loss mode erasing stats cannot go silent again. Tests pin both classes. Note: the first CI run had one flaky red lane (test windows-latest 22 shard 1: lane-decisions-matrix event-loop hang, unrelated to this diff — that test runs SessionStore disabled and passes 22/22 locally; master green at this base); re-run triggered.