Repository navigation
[PR] Snapshot-table compression foundation (#5874): server owns the fold ledger, outbound prefix renders from the table - #6155
ranxianglei wants to merge 10 commits into
Conversation
📦 Built Package ArtifactBranch: Latest build — install this exact versionnpm install -g billion-context@0.0.10558-pr.6155.f12338bThis exact version is immutable and reproducible. The rolling Recent builds (commit → version)
Download artifact
tar xzf billion-context-pr6155.tgz
npm install -g packageInstall instructions are refreshed on each push. |
…#6153) The test file and its header cited #6155 — a number that on GitHub belongs to an unrelated thread (snapshot-table compression foundation). Cross-references in PR artifacts must use GitHub numbers; the source bug report for this fix is GitHub issue #6153. Pure rename + header fix; no behavior change.
Verification conclusions (#5874)CI (full matrix, head E2E lanes triggered by the Feature-on evidence (the 100%-on requirement)The foundation is verified fully enabled in two places:
Local test evidence
|
Final status: all gates greenLocal real-model gate ( The earlier Lane-A failure on this machine was the co-resident sglang build answering The one remaining red, Requirement scorecard
|
[bot] 🏷 (ai: vllm-qwen/qwen3.8-27b) Dup screening: same topic family, not a duplicate — there is one related parallel implementation PR (#5901; see the decision request I'm posting right after this). No other same-signature rows among open/closed mirror or GitHub entries. Independent live verification at head
八问(结构化评审)
Verdict: mergeable — code and behavior verified green at |
(ai: vllm-qwen/qwen3.8-27b) Merge conflict resolved — merged current What I did this run:
(One honest aside, not part of this conflict fix: the separate 七问(CI-run summary):
判定:冲突已解决(git 层面证明无冲突 + typecheck 绿),merge commit |
[bot] 🏷 (ai: vllm-qwen/qwen3.8-27b) Merge conflict resolved — done. (Full 七问 summary is in the comment just above.)
(Aside, not part of this conflict fix: the separate |
659e0b9 to
ee69344
Compare
[bot] 🏷 Conflict resolved — the PR is now mergeable (no conflicts). 七问 CI summary
Bottom line: the merge conflict is resolved and verified (typecheck green, master is a verified ancestor, |
[bot] 🏷 Re-verified live this run — the conflict is already resolved; no further work needed.
Nothing to do — stopping. |
ee69344 to
6bdbf56
Compare
[bot] 🏷 Rebased onto the current master tip and pushed — the PR is no longer in conflict. Honest status, including one real finding the rebase surfaced: Done
Verified locally
Remaining — one real failure, flagged
Risk / next
|
6bdbf56 to
66a342e
Compare
[bot] 🏷 (ai: vllm-qwen/qwen3.8-27b) Merge conflict resolved — rebased onto the current master tip and force-pushed. What I did this run:
七问(CI-run summary):
Verdict: conflict resolved and verified (rebase onto Remaining (pre-existing, NOT introduced by this rebase — already flagged in a prior run): the A/B byte-parity test ( |
[bot] 🏷 (ai: vllm-qwen/qwen3.8-27b) Re-verified the live check state: the previously-failing check is NOT currently failed — it's re-running (queued). The failure is a known flaky Windows test, not a real bug in the PR's code. What I did this run:
七问(CI-run summary):
Verdict: The previously-reported failing check is a known flaky Windows test (event-loop starvation on loaded runners), not a real bug in the PR's code. The PR doesn't touch this test or the abort/teardown path. The check is re-running (queued). The mirror cache is stale (~2h old), so I could not confirm the latest state in this run. No code change is needed on the PR branch — there is nothing to fix. If the re-run fails again, it's the same flaky signature; the next wake will pick it up. |
66a342e to
48979d0
Compare
(ai: vllm-qwen/qwen3.8-27b) Conflict rebase done — PR #6155 (snapshot-table foundation) is clean again. New head What happened: the branch (5 commits, base Resolution: union of both intents — the returned object keeps master's Structured summary (八问):
CI status (mirror cache, snapshot 13:03:50Z — poller has not refreshed since, so this is the freshest verified state): new head |
(ai: vllm-qwen/qwen3.8-27b) No action needed — this trigger is a stale duplicate of the conflict I resolved in the previous run (replied above, 21:18). Live-verified in this run:
One caveat, stated plainly: the mirror poller has not refreshed since 13:03:50Z (UTC), so the check snapshot above is the freshest verifiable state; the pending lanes are still running. If any of them lands red, this lane re-triggers (attempt 1/6) and I'll pick it up then. |
(ai: vllm-qwen/qwen3.8-27b) Stale event — the reported failure no longer applies. The failing check Live-verified just now: the PR branch head is |
The probe anchor PROXY_TOOL_AT=6 was calibrated on 2026-10-31 for #4521 (schedule {4,6,8,9}). The nudge scheduling has shifted again — nudge now lands at {3,5,11,14}. Re-calibrate the anchor to the next nudge-carrying request pair (5 → tool round, 6 → fold round). The fold/proxy-tool-round mechanics under test are unchanged. Closes: master-red on test (windows-latest, 22, 3) and (ubuntu-latest, 22, 1).
The probe's hardcoded request-index anchors (PROXY_TOOL_AT/FOLD_AT) broke every time the nudge gate's schedule shifted. The last recalibration (245ecb1) was measured on a direct local run (timestamps ON by default since #4313), but CI runs the suite preload pin BILI_MESSAGE_TIMESTAMPS="0" (timestamps OFF) — a different wire shape, a different schedule (no nudge at index 5) — so it passed locally and failed on every CI shard. Root-cause fix instead of another anchor whack-a-mole: - Arm the fold on the first request carrying the ephemeral nudge with >=11 tagged refs; fold on the re-request after the acp_status round. The probe now materializes the #2929 scenario wherever the schedule places it. - Pin compress.messageTimestamps:false so the probe's wire shape is hermetic regardless of how the suite is launched (matches the CI preload pin). Supersedes the 245ecb1 recalibration. Verified: passes with and without the preload pin, same deterministic schedule (nudge at inputs[7], fold at inputs[8]).
…imitive snap_log, snap_ckpt) at storage schema v12, plus the single-tx commit primitive (upsert rows -> append log -> optional ckpt fold) and the CAS-backed pre-byte lifecycle (put/get/release content refs). Purely additive: no existing behavior changes. Rows are append-only (pos never reused), pre-fold bytes ride the content CAS, and the ckpt fold is the bounded-lifetime boundary (no global TTL, ruling B). - sqlite + MySQL twins + StorageBackend interface + SqliteBackend - unifiedStore foundationStore() accessor (sync sqlite fast-lane) - v12 upgrade pin + DROP-rollback drill + contract tests (both backends) - existing migration pins re-pointed 11 -> 12
…5874) Formalizes the incremental-compression bridge into a server-owned foundation: the compression ledger lives in the snapshot tables, and the outbound prefix is rendered FROM the table instead of re-deriving it from the client's resent bytes. Stable across client byte churn; the client converges in one turn on any mismatch (self-healing). Stages: 0 identity — the host's per-element msgid envelope (biliMsgIds #4491) is matched to the standing world canon (echo/probe/scatter/issue/ diverge/resync). Missing envelope on an enrolled session = R3 hard-reject (400), zero side effects, breaker after repeated faults. 1 convert — protocol -> common core (the public kernel codec). 2 rewrite — kernel fold is UNCHANGED (zero kernel edits). The fold produces a single compact event; the plugin endpoint commits it in-request, the model request reconciles the tail. 3 ingest — the single-tx commit primitive (schema v12, commit 1). 4 egress — active rows in host-envelope order ++ this turn's new cores, then the SAME downstream (nudge/carrier/codec). Byte parity with the legacy path is pinned by an A/B corpus. 5 out — tripwire low-ratio sample compare; mismatch yanks the session to legacy + alert. Red gates (per-session, fail-safe, never bricks the client): R1 checksum/S4 bad -> the session's plane is permanently dead (legacy) R2 egress join chain broken -> no events this turn, whole turn legacy R3 enrolled envelope fault -> hard 400 + zero side effects + breaker R4 structural-pending lost -> conservatively dead until resync Rollout: two-level nested master (snapshotFoundation, 0%) containing the lane (snapshotLane, 100% within master) — the existing base-nesting. Cohort roster is config (snapshot.cohortHosts, default ["pi"]); the foundation is a full-resend msgid-envelope host feature, so non-envelope hosts (e.g. the dsh CLI) are simply not enrolled and stay on legacy. Consumers: decompress reads the covered rows for a dead block (honest post-GC audit receipt, never a silent empty); the status endpoint + web three-state switch surface the plane health. The local release gate now runs the foundation at 100% (master + lane on). 64 hermetic tests: A/B byte-parity corpus (the pi plugin lane), logic (world match / reconcile / hydrate / lane), storage, decompress exit, and the #3752 growth bound (rows/log/ckpt stay bounded by the ckpt cadence). No kernel changes.
…e.md (#5874) The architecture-docs guard requires every tracked src/ file in the map: adds src/snapshot-plane.ts + the src/snapshot/ decision layer (9 files).
…5874) - tests: pin BILI_STORAGE_UNIFIED=full in the two suites that need the unified sqlite substrate (the CI baseline pins legacy by default, #4011 lesson — passed locally without the preload chain, failed on CI) - mysql.ts: remove semicolons from the v12 DDL comment block — the DDL string is split on ';' at init, so a ';' inside a comment fragment turned the rest of the comment into a bogus statement (ER_PARSE_ERROR on every mysql-contract test, including pre-existing #4666) - storage-null-identity: migration-head pin 11 -> 12 (missed in the first round of 7 files)
…cleanup (#5874) - mysql.ts snapLogMaxSeq: the cross-join's outer MAX only saw the log's column — after a ckpt fold absorbed the log the frontier read 0. Use GREATEST(COALESCE(l.m,0), COALESCE(c.m,0)) so the frontier is max of log AND checkpoint, matching the sqlite twin. - issue4666 mysql lane: four stale 'fresh/upgrade/re-run/lock-free install stamped v11' assertions -> v12 (the sqlite twin was updated in round 1, the mysql lane was missed). - ab + decompress tests: closeQuietly() the SessionStore handles before cleanup and retry the rm (Windows EBUSY on an open index.db — the suites pin BILI_STORAGE_UNIFIED=full, so they now open real sqlite handles that a bare rmSync cannot unlink on Windows).
48979d0 to
5850ee0
Compare
(ai: vllm-qwen/qwen3.8-27b) Second conflict rebase done — PR #6155 is clean again. New head Master moved 68 commits since my previous rebase ( Resolution: union of both intents — kept master's Structured summary (八问):
CI status: new head |
(ai: vllm-qwen/qwen3.8-27b) Stale duplicate — the conflict was already resolved minutes ago (see my previous comment: rebase onto master Live-verified in this run: branch head = |
(ai: vllm-qwen/qwen3.8-27b) Red CI on head What I did in this run:
If any lane lands red on 八问
判定:继承红已按政策处置(merge ci-fixes + #4599 留痕),分支现为干净 final head |
What this is
This lands the snapshot-table compression foundation — the formal, complete
version of the incremental-compression bridge that today only works as a
stopgap. In one sentence: the compression history (the "fold ledger") now
lives in server-side tables, and the outgoing request prefix is built from
those tables instead of being re-derived from the bytes the client happens to
re-send. That makes the prefix byte-stable across client byte churn, which is
the whole point of prompt-cache-friendly compression.
This implements the full proposal in #5874
— all six stages, not a partial P1/P2 slice:
Why
The current compression path re-derives what to send from the client's resent
history every turn. If the client serializes a message slightly differently
(one whitespace, a reordered field, a re-encoded image marker), the derived
prefix changes, the prompt cache misses, and the fold we already did is
wasted. The foundation pins the ledger server-side: each logical message gets a
stable position, the table holds its canonical form, and the prefix is rendered
from the table. The client converges to the canonical form in one turn on any
mismatch — it self-heals and never bricks.
How it works (the six stages)
biliMsgIds,the Plugin lanes: pin identity to client msgids, render outbound from the server-owned history | 插件车道服务端正史:消息身份钉在客户端 id 上,出站前缀由正史渲染 #4491 channel) is matched against the standing "world" canon: echo /
probe / scatter / issue / diverge / resync.
produces one
compactevent; the plugin endpoint commits it in-request andthe next model request reconciles the tail.
l1_world,snap_rows,snap_log,snap_ckpt). Rows are append-only(a position is never reused); pre-fold bytes ride the content store; the
checkpoint fold is the bounded-lifetime boundary (no global TTL).
same downstream the legacy path uses (nudge / carrier / codec). Byte parity
with the legacy path is pinned by an A/B corpus test.
legacy view; a mismatch yanks that session back to legacy and raises an
alert.
Safety (it cannot brick a client)
Every failure mode is a per-session, fail-safe red gate that degrades to the
existing legacy path — never a crash, never a half-state:
marked dead and it runs legacy.
the whole turn runs legacy (next turn re-derives).
400,zero side effects, and a breaker latches it to legacy after repeated
faults.
is conservatively held to legacy until it re-baselines.
Rollout (off by default)
Two-level nested rollout using the existing
basemechanism:snapshotFoundation(master, 0%) containssnapshotLane(100% withinthe master). So flipping the master gate is the only knob that turns the
feature on. The cohort is a config list (
snapshot.cohortHosts, default["pi"]). The foundation is a full-resend msgid-envelope host feature: ahost only participates if it sends the per-element id envelope. Hosts that
don't (for example the
dshCLI) are simply not enrolled and keep running theunchanged legacy path — so enabling the feature can never break them.
Verification
byte-identical to the legacy path, modulo the timestamp attribute).
backends.
garbage collection it returns an explicit audit receipt (never a silent
empty body).
(the 0.1.200 → 0.1.201 upgrade (#3658 identity change) mass-unfolds persisted sessions incl. Anthropic lane; downgrade re-churns #3752 "unbounded growth" red line).
typecheckclean; all CI guards pass (unused-exports, test-import-graph,lifecycle-ledger, config-surface, lane-guard, version-guard).
gate:local) runs the foundation at 100% (master +lane on) — see
scripts/release-gate-local.mjs.acp-kernelis untouched).Scope note
This PR targets the pi plugin lane (the host that sends the msgid envelope
and full-resends). Other lanes (anthropic wire, dsh native, non-plugin) keep
their existing behavior — the foundation yields to them rather than double-
handling, per the proposal's "each flow has one home" routing. Extending the
cohort to additional msgid-envelope hosts is a config change once their
envelope is confirmed, not a code change.