Repository navigation
[PR] fix(session-order): keep newest skeletons within each carrier's byte budget - #6477
ranxianglei wants to merge 1 commit into
Conversation
…budget (#6255) The session-order snapshot producer (src/order-persist.ts) applied its byte budget in array (write) order, so with fewer than 1,024 entries — where the recency sort was skipped — the byte cap kept the OLDEST records and silently dropped the newest conversations. It also used its 8 MiB legacy-file budget for unified KV writes, but the store rejects extension values over 4 MiB, so a large snapshot made the one-time migration throw, demoted the process to the legacy file path for the whole run, and raised per-flush write volume. Fix: sort the union by recency before BOTH caps, measure serialized UTF-8 bytes, and use the store's 4 MiB ceiling for KV migration and steady-state writes (the legacy file keeps its 8 MiB ceiling). No new config, schema, or fragment truncation. Closes #6255
📦 Built Package ArtifactBranch: Latest build — install this exact versionnpm install -g billion-context@0.0.9422-pr.6477.968e203This exact version is immutable and reproducible. The rolling Recent builds (commit → version)
Download artifact
tar xzf billion-context-pr6477.tgz
npm install -g packageInstall instructions are refreshed on each push. |
[bot] 🏷 (ai: vllm-qwen/qwen3.8-27b) 查重: 不重复 — 检索 open+closed PR/issue: 唯一针对 #6255 的在途 PR 就是本 PR #6477;Afloat16 的前置工作 #6186(写生命周期:await unified snapshot writes)已 closed 且修的是另一面,本 PR 是 #6255 修复向当前 master 的干净 rebase,无并行第二 PR 修同一 thread。 标签: bug + scope/storage + p2(会话顺序快照的容量/预算缺陷,属持久化域;能用但有明确问题——丢最新骨架 + KV 写失败降级,未到数据丢失/不可用级,故 p2 非 p1;无特定客户端绑定,不打客户端标签)。 这是带 |
[bot] 🏷 (ai: vllm-qwen/qwen3.8-27b) Review verdict: APPROVE — code is correct, the regression tests have teeth, CI is fully green on head. What I verified (independent, from the branch — not the issue body):
CI (head f1dcb9e):
Follow-up observation (noted here, not filed, per thread rule): Labels applied to the PR (judged from its own diff): 八问(中文):
判定:APPROVE,可合并。 代码正确、回归测试有牙(master 上复现 bug、PR 上转绿)、CI 在 head 全绿(flake 重跑后转绿)、标签已打。留一个跟进观察(store 的 |
[ework] CI fix verified green ✓ |
What & why
The session-order snapshot producer (
src/order-persist.ts) had two capacity defects in the same write path:Byte budget dropped the newest conversations.
normalizeForWrite()only sorted by recency when the entry count exceeded 1,024. Below that — the common case — the union stayed in array (write) order, so the 8 MiB byte cap kept the oldest records and silently dropped the newest ones. After a restart those conversations have no persisted skeleton (the resolver re-runs the cold-start race, Compression fails in long sessions while new sessions work fine | 压缩失败.新会话反而没事 #3397).8 MiB producer budget vs 4 MiB store ceiling. The same producer used its 8 MiB legacy-file budget for unified KV writes, but the store rejects extension values over 4 MiB (
EXT_VALUE_MAX_BYTES). A snapshot in the 4–8 MiB band made the one-time migration (hydrateOrderUnified) throw, demoted the process to the legacy file path for the whole run, and raised per-flush write volume (the file is plaintext JSON).Fix
One bounded-snapshot producer fix — no new config, schema, or fragment truncation:
EXT_VALUE_MAX_BYTESis now exported fromsrc/storage/store.tsso the producer and the store share one ceiling constant.Behavior change (old → new)
Validation
tests/order-persist.test.ts+tests/order-unified-store.test.ts→ 10/10 pass (3 new regression tests pin both facets, each in both directions).npm run typecheckclean;npm run buildgreen.testlanes on this head.Duplicate screening: no open/closed issue or PR makes this snapshot producer respect its carrier's size limit or keep recent entries under it. #3405 introduced the producer, #5757 migrated it to KV, #6186 fixes the write lifecycle, #6203 fixes generic extension validation — none touch the capacity ordering/ceiling.
Reported and proposed by @Afloat16 (issue #6255); this is a clean rebase of that fix onto current master with the regression tests.
Fixes #6255