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 ✓ |
🔶 需要决策 This PR is superseded by master — the conflict cannot be resolved mechanically without a decision. What I did this run:
Why this needs a decision: any "resolution" is a policy choice, not a mechanical one —
Options:
Labels: applied 八问(本次运行结构化结论)
判定:等待 owner 决策;未 push、未改任何代码。若无回应,默认按 A 执行(关闭动作本身由 owner 完成)。 |
(ai: vllm-qwen/qwen3.8-27b) Re-triggered on the same blocker — re-verified live, nothing changed, no action taken. Live state this run (GitHub API + git, not from memory):
So the situation is unchanged: the conflict is not mechanically resolvable — keeping the PR's files resurrects a mechanism the owner explicitly retired, and dropping them leaves an empty PR needing a close (owner-only). I did not re-attempt the rebase, did not push, and did not re-post the decision request to avoid spamming the thread. The options stand: A (recommended, default): close PR as superseded + close #6255 as fixed-by-retirement / B: resurrect the retired mechanism / C: salvage only the 八问(本次运行)
判定:维持等待 owner 决策(默认 A);本分支无新提交、无 push、无标签变更。 |
(ai: vllm-qwen/qwen3.8-27b) Third trigger of the same blocker; re-verified live this run — nothing changed: PR still |
[ework] CI fix verified green ✓ |
[bot] 🏷 (ai: vllm-qwen/qwen3.8-27b) Fourth trigger — re-verified live, no substantive change: PR still |
[ework] CI fix verified green ✓ |
[bot] 🏷 (ai: vllm-qwen/qwen3.8-27b) Fifth trigger — live-verified, state unchanged since the last run: PR still |
[bot] 🏷 (ai: vllm-qwen/qwen3.8-27b) Sixth (final) trigger — live-verified, state unchanged: PR still |
[ework] CI fix verified green ✓ |
[bot] 🏷 (ai: vllm-qwen/qwen3.8-27b) Seventh trigger (past the lane's 6-attempt budget, still re-firing) — live-verified: PR still |
[ework] CI fix verified green ✓ |
1 similar comment
[ework] CI fix verified green ✓ |
[bot] 🏷 (ai: vllm-qwen/qwen3.8-27b) Eighth trigger — live-verified: PR still |
[ework] CI fix verified green ✓ |
[bot] 🏷 (ai: vllm-qwen/qwen3.8-27b) Ninth trigger — live-verified, and one correction to my earlier tracking. State: PR still Correction: I'd been citing Conclusion (unchanged): PR #6477 is still superseded — it fixes a mechanism that no longer exists on master, and its only surviving hunk ( |
[ework] CI fix verified green ✓ |
[bot] 🏷 (ai: vllm-qwen/qwen3.8-27b) Tenth trigger — live-verified: PR still |
[ework] CI fix verified green ✓ |
[bot] 🏷 (ai: vllm-qwen/qwen3.8-27b) Eleventh trigger — live-verified: PR still |
[ework] CI fix verified green ✓ |
[bot] 🏷 (ai: vllm-qwen/qwen3.8-27b) Twelfth trigger — live-verified: PR still |
[ework] CI fix verified green ✓ |
[bot] 🏷 (ai: vllm-qwen/qwen3.8-27b) Thirteenth trigger — live-verified: PR still |
[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