Repository navigation
feat(#2394): raise fork-snapshot retention default from 16 MiB to 100 MiB - #2433
Conversation
📦 Built Package ArtifactBranch: Option A — Install this exact build (recommended)npm install -g billion-context@0.0.2648-pr.2433.9ce61d1This exact version is immutable and reproducible. The rolling Option B — Download artifact
tar xzf billion-context-pr2433.tgz
npm install -g packageInstall instructions are refreshed on each push. |
… MiB #2394 G3. The public fork API retains a raw wire-history snapshot per plugin session for adopt-on-fork; sessions whose serialization exceeds the cap fail closed (409 SNAPSHOT_UNAVAILABLE) and degrade to a bare fresh session + full raw replay. The 16 MiB default sits below real long-session sizes — the #2383 incident's ~5M-token dsh session serialized to ~20MB+, so fork adoption could never apply there and every fork degraded to raw replay (the storm #2387 stops at the bottom). Owner instruction in the #2383 thread (sign-off for this default change): "调大吧 调成100M?" — implemented exactly as asked. config surface: default-value change ONLY. plugin.snapshotCapBytes / BILI_PUBLIC_SNAPSHOT_CAP_BYTES fallback tier moves 16 MiB -> 100 MiB; no new keys/fields/env vars, override precedence unchanged, no migration (explicit overrides keep their values). 100 MiB keeps the #2017 D-B fail-closed bound while giving ~5x headroom over the largest observed incident session. behavior change: OLD un-forkable above 16 MiB -> NEW un-forkable above 100 MiB; worst-case retained snapshot per very-long plugin session <= ~100 MB (was <= ~16 MB). '0' = disable-retention and env parsing are unchanged.
080f97e to
0a3d544
Compare
[bot] 🏷 PR #2433 审查完成 — 方向正确、实现干净;发现并顺手修掉 1 个会挂 CI 的遗漏。结论:CI 绿后可合(需人工合并)。 结构化八问
🔧 顺手修复(review 中发现的小问题):PR 更新了 CONFIGURATION.md(en/zh)中的生成区表格行,但漏改源头种子 可合并性核查:分支已 rebase 到当前 master( |
📦 Merged Build PublishedThis merge to master was published as npm install -g billion-context@0.0.164-master.9129c68 # this exact build
npm install -g billion-context@master # always the newest merged build
|
…VAILABLE (#3011) Client (src/agent/fork-adopt.ts): classify degraded outcomes by structured verdict instead of a reason-string regex. The regex only matched 'error' / 'http 5xx', so the incident's 'snapshot http 409 SNAPSHOT_UNAVAILABLE' was treated as terminal after ONE attempt and the child's inheritance was permanently abandoned in-process. Each result now carries an explicit retryable flag: snapshot GET retries on network errors, HTTP >=500, and 409 code SNAPSHOT_UNAVAILABLE (a residency gap that self-heals on the parent's next request); 404 PARENT_NOT_FOUND and other 4xx stay terminal. Fork POST classification unchanged (network/5xx retryable). Give-up now logs an explicit 'permanently disabled' line distinct from the transient 'will retry' line. Server (src/plugin.ts): new forkSourceMessages() selects the raw source view. The retained copy (pluginSnapshot) stays primary; when it is missing (the residency gap: LRU eviction or host restart losing an unpersisted copy) the recent raw view session.lastMessages is served instead — it is persisted unconditionally and re-stamped by every parent request. A head-divergent tail wins over a frozen pre-compaction retained copy (zero-overlap guard case), so the served identities survive native compaction rebases. Folded tails never serve. The retention-cap refusal (#2433) stays first. Fork materialization uses the same selection, so a zero-branchpoint child keeps its legitimate empty snapshot. Server (src/session.ts): resetSessionCompression clears the stale publicSnapshot* metadata so a rebased parent cannot fail the list-level stored-refs check against the old view.
…VAILABLE (#3011) Client (src/agent/fork-adopt.ts): classify degraded outcomes by structured verdict instead of a reason-string regex. The regex only matched 'error' / 'http 5xx', so the incident's 'snapshot http 409 SNAPSHOT_UNAVAILABLE' was treated as terminal after ONE attempt and the child's inheritance was permanently abandoned in-process. Each result now carries an explicit retryable flag: snapshot GET retries on network errors, HTTP >=500, and 409 code SNAPSHOT_UNAVAILABLE (a residency gap that self-heals on the parent's next request); 404 PARENT_NOT_FOUND and other 4xx stay terminal. Fork POST classification unchanged (network/5xx retryable). Give-up now logs an explicit 'permanently disabled' line distinct from the transient 'will retry' line. Server (src/plugin.ts): new forkSourceMessages() selects the raw source view. The retained copy (pluginSnapshot) stays primary; when it is missing (the residency gap: LRU eviction or host restart losing an unpersisted copy) the recent raw view session.lastMessages is served instead — it is persisted unconditionally and re-stamped by every parent request. A head-divergent tail wins over a frozen pre-compaction retained copy (zero-overlap guard case), so the served identities survive native compaction rebases. Folded tails never serve. The retention-cap refusal (#2433) stays first. Fork materialization uses the same selection, so a zero-branchpoint child keeps its legitimate empty snapshot. Server (src/session.ts): resetSessionCompression clears the stale publicSnapshot* metadata so a rebased parent cannot fail the list-level stored-refs check against the old view.
…VAILABLE (#3011) Client (src/agent/fork-adopt.ts): classify degraded outcomes by structured verdict instead of a reason-string regex. The regex only matched 'error' / 'http 5xx', so the incident's 'snapshot http 409 SNAPSHOT_UNAVAILABLE' was treated as terminal after ONE attempt and the child's inheritance was permanently abandoned in-process. Each result now carries an explicit retryable flag: snapshot GET retries on network errors, HTTP >=500, and 409 code SNAPSHOT_UNAVAILABLE (a residency gap that self-heals on the parent's next request); 404 PARENT_NOT_FOUND and other 4xx stay terminal. Fork POST classification unchanged (network/5xx retryable). Give-up now logs an explicit 'permanently disabled' line distinct from the transient 'will retry' line. Server (src/plugin.ts): new forkSourceMessages() selects the raw source view. The retained copy (pluginSnapshot) stays primary; when it is missing (the residency gap: LRU eviction or host restart losing an unpersisted copy) the recent raw view session.lastMessages is served instead — it is persisted unconditionally and re-stamped by every parent request. A head-divergent tail wins over a frozen pre-compaction retained copy (zero-overlap guard case), so the served identities survive native compaction rebases. Folded tails never serve. The retention-cap refusal (#2433) stays first. Fork materialization uses the same selection, so a zero-branchpoint child keeps its legitimate empty snapshot. Server (src/session.ts): resetSessionCompression clears the stale publicSnapshot* metadata so a rebased parent cannot fail the list-level stored-refs check against the old view.
…VAILABLE (#3011) Client (src/agent/fork-adopt.ts): classify degraded outcomes by structured verdict instead of a reason-string regex. The regex only matched 'error' / 'http 5xx', so the incident's 'snapshot http 409 SNAPSHOT_UNAVAILABLE' was treated as terminal after ONE attempt and the child's inheritance was permanently abandoned in-process. Each result now carries an explicit retryable flag: snapshot GET retries on network errors, HTTP >=500, and 409 code SNAPSHOT_UNAVAILABLE (a residency gap that self-heals on the parent's next request); 404 PARENT_NOT_FOUND and other 4xx stay terminal. Fork POST classification unchanged (network/5xx retryable). Give-up now logs an explicit 'permanently disabled' line distinct from the transient 'will retry' line. Server (src/plugin.ts): new forkSourceMessages() selects the raw source view. The retained copy (pluginSnapshot) stays primary; when it is missing (the residency gap: LRU eviction or host restart losing an unpersisted copy) the recent raw view session.lastMessages is served instead — it is persisted unconditionally and re-stamped by every parent request. A head-divergent tail wins over a frozen pre-compaction retained copy (zero-overlap guard case), so the served identities survive native compaction rebases. Folded tails never serve. The retention-cap refusal (#2433) stays first. Fork materialization uses the same selection, so a zero-branchpoint child keeps its legitimate empty snapshot. Server (src/session.ts): resetSessionCompression clears the stale publicSnapshot* metadata so a rebased parent cannot fail the list-level stored-refs check against the old view.
…VAILABLE (#3011) Client (src/agent/fork-adopt.ts): classify degraded outcomes by structured verdict instead of a reason-string regex. The regex only matched 'error' / 'http 5xx', so the incident's 'snapshot http 409 SNAPSHOT_UNAVAILABLE' was treated as terminal after ONE attempt and the child's inheritance was permanently abandoned in-process. Each result now carries an explicit retryable flag: snapshot GET retries on network errors, HTTP >=500, and 409 code SNAPSHOT_UNAVAILABLE (a residency gap that self-heals on the parent's next request); 404 PARENT_NOT_FOUND and other 4xx stay terminal. Fork POST classification unchanged (network/5xx retryable). Give-up now logs an explicit 'permanently disabled' line distinct from the transient 'will retry' line. Server (src/plugin.ts): new forkSourceMessages() selects the raw source view. The retained copy (pluginSnapshot) stays primary; when it is missing (the residency gap: LRU eviction or host restart losing an unpersisted copy) the recent raw view session.lastMessages is served instead — it is persisted unconditionally and re-stamped by every parent request. A head-divergent tail wins over a frozen pre-compaction retained copy (zero-overlap guard case), so the served identities survive native compaction rebases. Folded tails never serve. The retention-cap refusal (#2433) stays first. Fork materialization uses the same selection, so a zero-branchpoint child keeps its legitimate empty snapshot. Server (src/session.ts): resetSessionCompression clears the stale publicSnapshot* metadata so a rebased parent cannot fail the list-level stored-refs check against the old view.
…flict fix) Conflict resolved by union of intent on the 409 SNAPSHOT_UNAVAILABLE path: - #3011 raw-view picker (retained copy -> recent raw tail, head-divergence rule) gains master's verified storage reconstruction as the last rung; - master's recon diagnostics (gate-named [reconstruction: ...] suffix, waitForReconstructionReplicas) kept verbatim; - #2433 retention cap stays a hard refusal even when a fresh view exists; - #4266 signed-thinking acceptance adopted (thinkingTokens rejection dropped); - fork handler serves child baseline from the SAME picked source view (identity-derived fromTail keeps CCR bookkeeping fail-closed); - test hunk takes master's strict 200 assertion (reconstruction makes the cold-restore scenario deterministically servable under unified-full).
What / why
#2394 G3: the public fork API retains a raw wire-history snapshot per plugin session so a forked child can be adopted onto it (identity-hash prefix match). Sessions whose serialization exceeds the cap fail closed (
409 SNAPSHOT_UNAVAILABLE) and degrade to a bare fresh session + full raw replay.The 16 MiB default sits BELOW real long-session sizes: in the incident behind #2383 a ~5M-token dsh session serialized to ~20MB+, so fork adoption could never apply there — every fork degraded to raw replay, which is what fed the preflight storm (#2387 stops that storm at the bottom as the shared degrade backstop).
Owner instruction in the #2383 thread (sign-off for this default change): "调大吧 调成100M?" — this PR implements exactly that: default 16 MiB → 100 MiB.
config surface
Default-value change ONLY:
plugin.snapshotCapBytes(config file) /BILI_PUBLIC_SNAPSHOT_CAP_BYTES(env) — fallback tier moves from 16 MiB to 100 MiB.behavior change (old → new)
0= disable-retention, and env parsing are byte-identical otherwise.tests
tests/knobs-config-precedence.test.tsre-pinned to the new default (11/11 green locally)npm run typecheckcleanfakeCompletion.bufCapBytesliteral sharing the old value is untouched