Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
60 commits
Select commit Hold shift + click to select a range
ec302b9
storage: snapshot-table compression foundation (P0 schema + P1 shadow…
ranxianglei Nov 7, 2026
9bb3f3f
docs: document storage.snapBase.{enabled,shadowWrite} seeds + regen c…
Nov 7, 2026
5c214be
test: close the snapplane flag stores before rmSync — Windows EBUSY o…
Nov 7, 2026
bbd645f
fix: re-anchor the S4 anchor when GC physically releases plane rows (…
Nov 7, 2026
f6c5a19
refactor: drop the unused completeLog param from snapShadowSync (#5874)
Nov 7, 2026
d7a69b0
soak: run the snapshot plane at 100% default for ci:full + local gate
ranxianglei Nov 8, 2026
68f8a97
docs: add storage-relations diagram (zh/en)
ranxianglei Nov 8, 2026
2707163
docs: land the #5874 snapshot-table design record (zh/en) + index ent…
ranxianglei Nov 8, 2026
ce023c6
docs: list src/storage/snap.ts in the architecture file map (#5874)
Nov 8, 2026
f11f3fc
docs: architecture map schema note v11 → v12 — this branch bumps STOR…
Nov 8, 2026
243e2d6
docs: regenerate configuration index — snapBase rows back to seed tru…
Nov 8, 2026
f2520a2
fix: probe-first v12 DDL so the plane coexists with sibling-branch sc…
ranxianglei Nov 8, 2026
3c7ee7d
test: tolerate mid-reinstall ENOENT in e2e readPkgVersion polls (#590…
Nov 8, 2026
d253f0b
outbound context served from the verified snapshot plane, with a byte…
ranxianglei Nov 8, 2026
ecf3f9f
tests(#5874 P2): widen the msg() helper role to allow the anchor's sy…
ranxianglei Nov 8, 2026
dd71842
fix(#5874 P2): re-apply the per-resend ACP envelope onto plane-render…
ranxianglei Nov 8, 2026
3597fdc
ci(#5874 P2): satisfy the guard jobs — config seeds, architecture doc…
ranxianglei Nov 8, 2026
7781e1f
observability(#5874 P2): log the first diverging field on egress trip…
ranxianglei Nov 8, 2026
39c8e6f
observability(#5874 P2): mismatch context includes field lengths and …
ranxianglei Nov 8, 2026
0d6ef38
fix(#5874 P2): reach render parity by running the kernel's own render…
ranxianglei Nov 8, 2026
bab9407
fix(#5874 P2): anchor summaries at the earliest covered row and adopt…
ranxianglei Nov 8, 2026
036b91f
tests(#5874 P2): pin BILI_MESSAGE_TIMESTAMPS=1 inside the T18a/T18b r…
ranxianglei Nov 8, 2026
e9981c8
fix(#5874 P2): pair tool results by toolCallId for trim adoption; ric…
ranxianglei Nov 8, 2026
ba14b5b
fix(#5874 P2): adopt the dsh tool-result pruner's head+marker+tail shape
ranxianglei Nov 8, 2026
2bc4d14
fix(#5874 P2): tripwire dump head/tail via text-safe clamp (family ga…
Nov 8, 2026
204a192
chore(#5874 P2): seam-window + adoption telemetry on the egress tripwire
ranxianglei Nov 8, 2026
d5a2222
fix(#5874 P2): adopt the kernel's own emergency-truncation clips on t…
ranxianglei Nov 8, 2026
45dc8cc
fix(#5874 P2): tripwire sees codec sidecars; toolCallId seam arm; har…
ranxianglei Nov 8, 2026
26abb94
fix(#5874 P2): run the kernel/lane post-passes over the plane view too
ranxianglei Nov 8, 2026
852a8a8
test: align storage-null-identity schema pins with this PR's v12
Nov 10, 2026
cf9a805
test(e2e): disable repetition guard in delegate-notify hermetic scenario
Nov 10, 2026
0677875
fix(field): live-task receipts — fold-pointer echo acked as no-op, st…
ranxianglei Nov 10, 2026
0553e75
refactor(#5874 P2-final): the snapshot write runs in-request, in the …
ranxianglei Nov 10, 2026
80b535f
fix(#5874 P2): respect the #5608-C timestamp high-water mark in the p…
ranxianglei Nov 10, 2026
3c9a531
fix(#5874 P2): hydrate media in the egress plane view; the plane path…
ranxianglei Nov 10, 2026
1a81e59
refactor(#5874 P2): mapEgress direct authority — no per-round diff, e…
ranxianglei Nov 11, 2026
5f93ec6
chore(#5901): re-trigger CI — the 533b72fb4 push event was not delive…
ranxianglei Nov 11, 2026
ab9157b
fix(#5901): drop unused export — snapEgressFlags is internal to snap-…
ranxianglei Nov 11, 2026
33b1011
fix(#5874 P2): plane write side — remint collisions, in-save folds, r…
ranxianglei Nov 11, 2026
86d3d5d
fix(rebase): drop the relocate-compress import (feature removed on ma…
Nov 11, 2026
d1f0e7d
fix(#5874 P2): #5765 retire parity — the plane egress anchor loop ski…
Nov 11, 2026
60070ca
refactor(#5874): drop the orphaned TRUNCATION_CLIP_RE export — kernel…
Nov 11, 2026
d049dde
docs(#5874 P2): drop the duplicated snapAbCheckTagged doc line (edit …
Nov 11, 2026
815d095
feat(#5874 2×2): 2×2 snapshot egress modes — stage-0 world match, ker…
ranxianglei Nov 11, 2026
5bdb4dc
fix(#5874 2×2): restore the #1954 KEEP=1 contract — strip previous_re…
ranxianglei Nov 11, 2026
5e38cf1
fix(#5874 2x2): review round 1 — B0-B4 + M1-M6 (plane bypass, 400 fun…
ranxianglei Nov 12, 2026
799fab2
fix(#5874 2x2): review round 2 — no-op rounds keep the chain id, same…
ranxianglei Nov 12, 2026
a85ae7d
fix(#5874 2×2): Residual 2 hardening — the chain id is opaque: trust …
ranxianglei Nov 13, 2026
e2c8636
fix(#5874 2x2): use safeSuffix for the mint-scan tail clamp (family g…
Nov 13, 2026
345949e
fix(#6181): 5901-base regressions — untagged-save plane guard (prefix…
ranxianglei Nov 13, 2026
06c410c
fix(#6181): repair the merged process.yaml — desc_ja line lost its ne…
ranxianglei Nov 13, 2026
cba5155
fix(#5901): review cleanup — drop pr-body-6299.md working file, stale…
Nov 13, 2026
fc57eb6
fix(e2e): pin BILI_STORAGE_JSON_WRITER=on in the five native suites —…
ranxianglei Nov 13, 2026
838a2a2
fix(e2e): pin BILI_STORAGE_JSON_WRITER=on in e2e-native-dsh-persona —…
ranxianglei Nov 13, 2026
66db88b
fix(e2e): pin BILI_STORAGE_JSON_WRITER=on in fork-ccr-adoption + lift…
ranxianglei Nov 13, 2026
c3ec9bd
fix(tests): close SessionStores before rmrf under the #6480 full-mode…
ranxianglei Nov 13, 2026
9211084
snapshot-plane review fixes (#5901): B0 delta-view stale-ride, defaul…
ranxianglei Nov 13, 2026
f42f251
fix(rebase): drop the duplicate getStore import in prepare-responses.ts
ranxianglei Nov 14, 2026
eb0670d
fix(#5901): restore the storage.snapBase.enabled/shadowWrite desc_ja …
ranxianglei Nov 14, 2026
7526eb8
Merge origin/master into #5901 (resolve store.ts sessionStorageStats …
Nov 15, 2026
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions docs/configuration.ja.md
Original file line number Diff line number Diff line change
Expand Up @@ -212,6 +212,10 @@
| `storage.jsonWriter` | on\|off | unset (off for the pure-sqlite selection — absent/unified=sqlite — and on for explicit full) | BILI_STORAGE_JSON_WRITER | フェーズ 3 エンベロープスイッチ (#2960) — 今回のリリースでデフォルト反転: 未設定 (UNSET) はピュア SQLite 選択 (storage.unified 未設定または "sqlite") ではデフォルト OFF — SQLite インデックスが唯一の永続コピーとなる (読み取りはすでに統合優先; 起動時にインデックスの和集合を列挙するため、インデックスのみのセッションは正常にロードされる)。明示的な full は #3818 由来のダブルライトデフォルトを維持 (このキーが指定しない限りエンベロープは書き込まれ続ける)。有効な full モードではいずれの階層でも明示的な on/off が常に優先: shadow/legacy (または暗号化が有効な場合) で要求された off は、JSON ファイルが唯一の真実のソースであるため 1 回限りの警告付きで無視される。環境変数階層 0/false/off = off、1/true/on = on が厳密なファイル表記 ("off"/"on") より優先される。フェイルセーフ: サイドカーが実行中に自身を無効化した場合、次のセーブでエンベロープ書き込みが再開される。ダブルライトの復元: storage.jsonWriter=on (または BILI_STORAGE_JSON_WRITER=1) — インデックスのみのセッションは起動和集合経由で引き続きロードされ、レプリカ/リストアはポータブルな JSON エンベロープを再物質化する。バイナリのダウングレード (または SQLite エンジンの喪失) は、>=v0.1.197 バイナリが再び実行されるまで、インデックスのみのセッションを v0.1.196 以前のバージョンから不可視にする - データは index.db に無傷のまま残るが、古いコードによって読み取られないだけである。セッションごとの CCR コンテンツストアサイドカーも書き込みが停止する - full モードでは、すべての読み取りで最初にインデックスの ccr ミラーが参照されるため、ミラーが永続コピーとなる。jsonWriter=off レーンは、そのセッションディレクトリの唯一のライターでなければならない: off レーンは統合優先で読み取り、決してファイルにフォールバックしないため、同じディレクトリに対して legacy/shadow で実行されるピアインスタンスは静かに分岐する (その JSON コピーは更新を受け取らなくなり、off レーンはピアの書き込みを決して見ない)。 |
| `storage.walJournalSizeLimitBytes` | number | 8388608 | BILI_STORAGE_WAL_JOURNAL_SIZE_LIMIT_BYTES | index.db-wal の WAL 回収上限 (#3250)、バイト単位: 完了したチェックポイントごとに WAL ファイルがこのサイズまで切り詰められ、長寿命プロセスにおけるディスク使用量とクラッシュ復旧リプレイを制限する。セッションごとのデータクォータではない - データは書き込まれた時点で index.db に着地し、WAL はチェックポイント間のフレームをステージングするだけなので、セッション数/サイズはこれをスケーリングしない; 大きなバーストは、次の完了チェックポイントが切り詰めるまで一時的に超過しうる。高い = 切り詰め IO が稀になるが、定常時のディスク使用量が増え、クラッシュリプレイのテールが長くなる。環境変数階層 (正の整数) がファイル階層より優先される; ゴミまたは非正の環境変数値は、起動を失敗させるのではなくファイル/デフォルト階層にフォールスルーする。レーン起動時にストアが開かれる時点で適用される - ホット編集には再起動が必要。有効な値は統合有効ログ行とストレージ診断ブロブに表示される。 |
| `storage.archiveAfterDays` | integer | 365 | BILI_STORAGE_ARCHIVE_AFTER_DAYS | 日単位の GC 年齢スイープウィンドウ (#3463, #3901): これより長くアイドル状態のセッションはアーカイブされる - 単一のアーカイブログ (セッションディレクトリ配下の archive/archive.jsonl — セッションごとのファイルスプレーなし) に 1 行の JSON が追記され、トombストーン行がラベルとアイデンティティを保持し、コンテンツ/メディア参照が解放され、リストアは 1 つの POST のみで可能。0 は年齢スイープを無効にする; POST /__bili/storage/gc は常に実行され、既存の index.db を縮小するには ?vacuum=full を取る (新規書き込みには常に auto_vacuum=INCREMENTAL が有効)。同じ操作に CLI レイヤーがある (#3928): bili storage gc [--days N] [--vacuum full\|incremental] [--dry-run]、および bili sessions ls/rm/archive/restore <id> (README の 'Storage maintenance CLI' セクション)。環境変数がファイル階層より優先される。 |
| `storage.snapBase.enabled` | boolean | false | — | スナップショットテーブル圧縮プレーンのマスターフラグ (#5874, schema v12): 4 つのプレーンテーブル (l1_world / snap_rows / snap_log / snap_ckpt)、単一事務コミット原語、読み出し側のチェックサム再構築を有効化する (不一致はそのセッションのプレーンを永続的に固着させる)。デフォルトオフ — 設定するまで挙動は不変; 設定ファイルのみ、環境変数階層なし (#2030 の規律)。sqlite パスにのみ配線 — mysql バックエンドはこのフラグを無視する。 |
| `storage.snapBase.shadowWrite` | boolean | false | — | プレーンのシャドウライト用のレーンフラグ、storage.snapBase.enabled にネスト (#5874): 両方が設定されると、各 ingest コミットが同一 tick 内で独立した事務所でプレーンを追加導出する (定常状態は delta 高速パス、それ以外は最終状態 diff; 導出可能なイベントのないラウンドは何も書かず、クラッシュで失われたラウンドは次の保存時に自己修復)。読み出し側は legacy 行との比較のみを行い、決して提供しない — 送信バイトは不変。レーン単独では無効; ロールバック = 解除 (または 4 テーブルの DROP + user_version の復元)。 |
| `storage.snapBase.egress` | boolean | false | — | #5874 P2 (mapEgress): スナップショットプレーンが直接の出站権威 — 出站圧縮コンテキストは S4 検証済みプレーンから提供され、legacy バイトとのラウンド毎の比較は行わない (tripwire なし、正規化 diff なし、sticky 除外なし)。プレーンはカーネル自身のタグ付き processTurn 出力を保存する (不変条件 v: post_json は書き換え後のコア形式であり、決してワイヤバイトではない); 書き込み側はカーネルがイベントレベルの増分として見たバイトを正確に永続化する (cast / update / delete / compact — 保存毎に 1 事務、legacy コミットと同一 tick)、そのため圧縮ラウンドの新規ブロックは同一ラウンドでプレーンから読み出せる。Egress はプレーン行を pos 順に読み (生存する active 行 + 各 active ブロックの保存済みアンカー要約をその被カバー run の pair-safe 位置へ移動; 被カバー行はプレーン自身の active フラグ / cover_ref で抑制し、id 一致では決して行わない)、その後レーン自身の後処理 (absorb → attach → strip → drop) を実行 — 出力は構造上 legacy egress とバイト単位で一致する (プレーン行が legacy 変換の入力そのものだから)。フラグオフ、cohort 除外、このセッションのプレーン dead/欠如、いずれかの行がパース不能、アセンブリ例外 — いずれの場合も legacy バイトへ降格 (1 ラウンド; 次ラウンドで再決定)、各理由は /__bili/status の snaplane.egress 下に表示。書き込み側は crash 等級: 不可解参照の view エントリ、または fold 時の view とプレーンの ID 不一致 (A/B 判定) はセッションを永続的に plane-dead に固定し、legacy が引き続き提供する。opt-in: 未設定時はデフォルト OFF (#5874 §9) — `egress: true` で切り替え; ロールバック = `egress: false` (バイト変化ゼロ、プレーンはシャドウライト継続)。既知のソフトエッジ: google countTokens と responses compact の二次 processTurn ポイントは legacy ソースのまま。 |
| `storage.snapBase.egressCohorts` | string[] | ["openai","anthropic","google","responses"] | — | egress ソースの切替を許可するプロトコル cohort (#5874 P2); openai/anthropic/google/responses の部分集合。プロトコルがリストにないセッションは無条件で legacy バイトを保持する (プレーンはシャドウライト継続)。空/欠如の配列は 4 つすべてを意味する。 |
| `sessions` | object | {} (all defaults) | — | セッションテーブルサイズ上限とオプトインによるゴミ収集。 |
| `sessions.max` | number | 256 | BILI_MAX_SESSIONS | メモリ内セッションテーブル上限 (アイドルセッションの LRU 退避)。 |
| `sessions.warmMax` | number | 0 | BILI_SESSION_WARM_MAX | 有界な起動 (#2803/#3050): リスニング前に起動時に水合される最大最近保存セッション数; 古い状態はオンデマンドで再ロードされる。デフォルト 0 (急激なウォームセットなし — 最初のタッチが 1 回のオンデマンドロードを支払う; 急激な動作を復元するには 8 を設定)。sessions.max で上限が設定される。 |
Expand Down
4 changes: 4 additions & 0 deletions docs/configuration.md
Original file line number Diff line number Diff line change
Expand Up @@ -215,6 +215,10 @@ This index is generated from `website/config-reference/*.yaml` — edit the seed
| `storage.jsonWriter` | on\|off | unset (off for the pure-sqlite selection — absent/unified=sqlite — and on for explicit full) | BILI_STORAGE_JSON_WRITER | Phase 3 envelope switch (#2960) — default flipped this release: UNSET now defaults to OFF for the pure-sqlite selection (storage.unified absent or "sqlite") — the SQLite index is the only persistent copy (reads are already unified-first; boot enumerates the index union, so index-only sessions load normally). Explicit full keeps the historical #3818 dual-write default (envelopes stay written unless this key says otherwise). An explicit on/off at either tier always wins in effective-full mode: under shadow/legacy (or with encryption active) a requested off is ignored with a one-time warning because the JSON file remains the sole source of truth. Env tier 0/false/off = off and 1/true/on = on wins over the strict file spellings ("off"/"on"). Fail-safe: if the sidecar disables itself mid-run, envelope writes resume on the next save. To restore dual-write: set storage.jsonWriter=on (or BILI_STORAGE_JSON_WRITER=1) — index-only sessions keep loading via the boot union, and replicas/restore re-materialize portable JSON envelopes. Downgrading the binary (or losing the SQLite engine) makes index-only sessions invisible to v0.1.196 and older until a >=v0.1.197 binary runs again - the data stays intact in index.db, it is just not read by the older code. The per-session CCR content-store sidecar stops being written as well - in full mode the index's ccr mirror is consulted first on every read, so the mirror is the durable copy. A jsonWriter=off lane must be the SOLE writer of its sessions directory: an off lane reads unified-first and never falls back to the file, so any peer instance running legacy/shadow against the same directory diverges silently (its JSON copy stops receiving updates, and the off lane never sees the peer's writes). |
| `storage.walJournalSizeLimitBytes` | number | 8388608 | BILI_STORAGE_WAL_JOURNAL_SIZE_LIMIT_BYTES | WAL reclamation cap for index.db-wal (#3250), in bytes: every completed checkpoint truncates the WAL file back to this size, bounding disk use and crash-recovery replay in long-lived processes. NOT a per-session data quota - data lands in index.db as it is written and the WAL only stages frames between checkpoints, so session count/size does not scale this; a large burst can overshoot temporarily until the next completed checkpoint truncates back. Higher = rarer truncate IO but more steady disk use and a longer crash-replay tail. Env tier (positive integer) wins over the file tier; a garbage or non-positive env value falls through to the file/default tier instead of failing boot. Applied when the store opens at lane boot - hot edits need a restart. The effective value appears on the unified-enable log line and in the storage diagnostics blob. |
| `storage.archiveAfterDays` | integer | 365 | BILI_STORAGE_ARCHIVE_AFTER_DAYS | GC age sweep window in days (#3463, #3901): sessions idle longer than this are archived - one JSON line appended to a single archive log (archive/archive.jsonl under the sessions directory — no per-session file spray), a tombstone row keeps the label and identity, content/media refs are released, and restore is one POST away. 0 disables the age sweep; POST /__bili/storage/gc always runs and takes ?vacuum=full to shrink an existing index.db (auto_vacuum=INCREMENTAL is always on for new writes). The same operations have a CLI layer (#3928): bili storage gc [--days N] [--vacuum full\|incremental] [--dry-run], plus bili sessions ls/rm/archive/restore <id> (README 'Storage maintenance CLI' section). Env wins over the file tier. |
| `storage.snapBase.enabled` | boolean | false | — | Master flag for the snapshot-table compression plane (#5874, schema v12): arms the four plane tables (l1_world / snap_rows / snap_log / snap_ckpt), the single-transaction commit primitive, and the read-side checksum rebuild (a mismatch permanently wedges that session's plane). Off by default — zero behavior change until set; config-file only, no env tier (#2030 discipline). Wired on the sqlite path only — the mysql backend ignores the flag. |
| `storage.snapBase.shadowWrite` | boolean | false | — | Lane flag for the plane's shadow write, nested under storage.snapBase.enabled (#5874): with both set, every ingest commit additionally derives the plane in its own transaction within the same tick (steady-state delta fast path, otherwise final-state diff; rounds yielding no derivable event write nothing, a crash-dropped round self-heals on the next save). The read side only compares against the legacy rows and never serves them — outbound bytes are unchanged. The lane alone has no effect; rollback = unset (or DROP the four tables + revert user_version). |
| `storage.snapBase.egress` | boolean | false | — | #5874 P2 (mapEgress): the snapshot plane is the DIRECT outbound authority — the outbound compressed context is served from the S4-verified plane, with NO per-round comparison against the legacy bytes (no tripwire, no normalized diff, no sticky exclusion). The plane stores the kernel's OWN tagged processTurn output (invariant v: post_json is the post-rewrite core form, never wire bytes); the write side persists exactly the bytes the kernel saw as event-level increments (cast / update / delete / compact — one transaction per save, same tick as the legacy commit), so a compression turn's brand-new block is plane-readable in the same round. Egress reads the plane rows in pos order (surviving active rows + each active block's stored anchor summary, moved to its covered run's pair-safe position; covered rows are suppressed by the plane's own active flag / cover_ref, never by id matching), then runs the lane's exact post-processing (absorb → attach → strip → drop) — the output is byte-identical to the legacy egress BY CONSTRUCTION, because the plane rows ARE the legacy transform input. Degrades to the legacy bytes (one round; the next round re-decides) on: flag off, cohort excluded, plane dead/missing for this session, any row unparsable, or an assembly exception — each reason surfaces on /__bili/status under snaplane.egress. The write side is crash-grade: an unaddressable view entry or a fold-time view-vs-plane identity mismatch (A/B oracle) latches the session plane-dead permanently, legacy keeps serving. Opt-in: default OFF when unset (#5874 §9) — set `egress: true` to cut over; rollback = `egress: false` (zero bytes change, the plane keeps shadow-writing). Known soft edges: google countTokens and responses compact secondary processTurn points still ride the legacy source. |
| `storage.snapBase.egressCohorts` | string[] | ["openai","anthropic","google","responses"] | — | Protocol cohorts allowed to cut the egress source over (#5874 P2); a subset of openai/anthropic/google/responses. Sessions whose protocol is absent keep legacy bytes unconditionally (the plane still shadow-writes for them). An empty/absent array means all four. |
| `sessions` | object | {} (all defaults) | — | Session-table size cap and opt-in garbage collection. |
| `sessions.max` | number | 256 | BILI_MAX_SESSIONS | In-memory session table cap (LRU eviction of idle sessions). |
| `sessions.warmMax` | number | 0 | BILI_SESSION_WARM_MAX | Bounded startup (#2803/#3050): max most-recently-saved sessions hydrated at boot before listening; older state reloads on demand. Default 0 (no eager warm set — first touch pays one on-demand load; set 8 to restore the eager behavior). Capped by sessions.max. |
Expand Down
Loading
Loading