Repository navigation
Per-wire continuity proofs + reasoning-drop tolerance (model-switch / fork-adoption / mode-upgrade) - #2732
Conversation
…ponses wires (#2601/#2676) The #2729 proof pinned scenario A (model switch = one session) and scenario B (fork copies state) on the chat wire only, but the persona wiring is per-call-site in src/server/handle.ts (anthropic :811 / openai :821 / responses :843,:880) with a different system-text extractor per lane — correct-in-one-lane is not correct-in-all (#377). Parameterize the harness over chat/anthropic/responses: per-wire request builders (system message vs top-level system vs instructions), per-wire mock upstream responses, identical session-state assertions. google is deliberately absent (no persona call site, issue #2730). Teeth (A/B @ 4ecd82f pre-#2719): scenario A mints the |sub: fork on all three wires; scenario B 409s (#2676); controls still fork on all three — the persona path is engaged per wire, not vacuous.
…le (#629) fork-adoption.test.ts proves the anonymous fork lane (grow → proxy fold → mid-list edit → fork mint → seeded refs + adopted blocks + untouched parent) on the openai chat wire only. The mint is protocol-neutral, but identity extraction and the tool protocol are per-wire call sites — correct-in-one-lane is not correct-in-all (#377, the #2658 lesson). resume-adoption-wires.test.ts covers the IDENTIFIED resume twin on responses/google; this file covers the ANONYMOUS fork twin on all three remaining wires (anthropic native tool_use mock, responses via the chat bridge, google native functionCall mock) plus a forkAdoption=off control on responses. Teeth: dropping "anthropic" from fork-adoption.ts SUPPORTED makes exactly the anthropic test fail; adoption assertions, seeded-ref identity and the copy-on-fork parent check are shared verbatim with the chat proof.
…2193 follow-up, #2636) Cross-model replay on the anthropic/responses/google wires discards structured thinking wholesale while every text/tool core keeps its kernel id. With >=10 dead reasoning ids and zero reanchoring claims, the destroy-escalation diagnosed this sanctioned host behavior as 'compression substrate appears destroyed'. Classify a reasoning-only unmatched set as tolerated (fold substrate healthy) and count only non-reasoning missing ids toward the destroy threshold, so 'model switch + one honest user edit' can never cry destruction either. Identity proof grows per-wire model-switch companions (drop-keep churn with two thinking carriers per turn) asserting coverage retention, no thinking re-billing, honest edit re-entry, and no escalation latch; on master they fail with 'destroy-escalation latched on a sanctioned model switch'.
…ion, one carrier, sticky binding (#1426) Single-rig proof of the mode-upgrade contract the two compression modes rely on: a session that grew and folded in proxy mode upgrades to plugin mode via x-bili-plugin without forking, keeps the proxy-era fold alive (preflight blocks carry acp_summary in any mode), stops tool injection exactly at the flip, executes a plugin-era fold through /__bili/plugin/ tool coexisting with the proxy-era block, refuses downgrade when the header disappears (sticky pluginAgent), lets a different agent header override the recorded value, and never latches destroy-escalation or conflict events on any sanctioned flip. Tooth verified: deleting the sticky-restore line in server/handle.ts fails the sticky phase.
📦 Built Package ArtifactBranch: Option A — Install this exact build (recommended)npm install -g billion-context@0.0.2981-pr.2732.416b838This exact version is immutable and reproducible. The rolling Option B — Download artifact
tar xzf billion-context-pr2732.tgz
npm install -g packageInstall instructions are refreshed on each push. |
…easoning-drop tolerance (#2732 review supplement) Review finding: FoldAnchor.c is only set at anchor creation, but the anchor REUSE path copies pre-existing anchors verbatim — anchors persisted before this change never gain c (session state outlives the process), stay classified as non-reasoning forever, and the reasoning-only-drop tolerance never reaches pre-upgrade sessions. Add the established #2396/#2636 backfill branch (recompute from live bytes once while the id is on the wire; same-id implies same identity fields incl. contentType, so exact) plus three unit tests in the #2636 suite: pure reasoning drop above the 10-id floor never escalates, mixed drop (dead reasoning + one honest user edit) accrues the ordinary streak but can only warn, and stripped pre-upgrade anchors regain c verbatim-shape on the next live pass.
[bot] 🏷 Review 完成 — 可合并(CI 绿后)(PR: #2732) 结构化八问
验证证据(本人实测,非转述)
Review 中发现的小问题 — 已直接修掉(小问题直接修政策) 观察(不阻塞,供知悉,不立项):#2695 zombie-reap 路径未变——若某 fold block 的覆盖集以 reasoning core 为多数,模型切换后该块会在 3 个 pass 后被 reap(摘要丢失)。这是 #2695 机制的既有行为、触发条件苛刻(fold 范围须 reasoning 占多数)、与本 PR 机制域不同,且我无真实流量证据证明其发生,故只在此记录边界,不动它。 CI:guard 全线绿(docs-sync/config-surface/lane/kernel/pi-subagents/version/lock/build-artifact 等);test 作业在我推入 判定:可合并(待 CI test 作业绿;merge 由人执行)。 |
[bot] 🏷 CI 跟进:head 判定维持:可合并,merge 请人工执行:#2732 |
…ng drop must not eat fold blocks (#2695, #2636) The GAP-1 classification tolerates pure reasoning drops at the session escalation level, but the per-block zombie streak still counted dead reasoning ids in its majority test. A fold span whose covered ids are reasoning-majority (thinking-only turns, multi-thought turns, dense reasoning stretches) would reap a HEALTHY block 3 passes after a sanctioned drop-keep model switch — summary lost, surviving text re-billed, then silently replaced by a re-fold over the decimated history. The majority test now runs on the non-reasoning covered ids only (anchors carry contentType); a span with no non-reasoning ids never reads as gone. Genuine decimations (text/tool substrate gone) still reap — #2695 semantics unchanged for real loss. Teeth: unit majority-reasoning span survives 4 drop passes then still reaps on real decimation; identity-proof anthropic drop lane rebuilt pair-free (75% reasoning span) asserts the settled block survives the switch — red on master-lineage tip without the fix (b1 reaped, replaced by text-only re-fold), green with it.
📦 Merged Build PublishedThis merge to master was published as npm install -g billion-context@0.0.261-master.251cb96 # this exact build
npm install -g billion-context@master # always the newest merged build
|
…e as substrate destruction External analysis of #2815 (user relayed): stripRawStage runs BEFORE ids are minted in every prepare (e.g. prepare-openai.ts strip -> openaiToCore), so sessions folded before the marker engine carry covered ids minted from marker-laden bytes. A stateless client resends that history forever; post- upgrade every marker-bearing covered message arrives under a fresh clean-byte id on every pass. Probe-verified shape: fold state survives (user ids verbatim, positional anchors hold, z=0 nothing reaped), churned assistant content re-covers on the next re-fold — but with >=10 marker-covered turns the #2193 gate latched foldDriftEscalated and logged 'compression substrate appears destroyed / host-native compaction' while compression was healthy. Exactly the #2789 victim population; same misread class as the reasoning- drop sanction (#2732). Fix (suggestion 3 of the analysis): prepares keep the strip counts and pass markerStripped: markerArtifactCount(counts) into reconcileFoldCoverage. A pass that stripped raw artifacts proves the resend carried bili echoes, so its total-loss drift accrues no streak. One acceptance info line per session (foldMarkerChurnNoted latch, never reset — stateless churn has no episode end) replaces the misleading per-pass 'mutation or client-side deletion' warn. Marker-free passes still escalate on their own streak: real destruction is never masked (pinned by test). Tests (tests/fold-reconcile.test.ts): marker-explained churn x5 passes -> zero errors, no latch, single note, no warn; 2 marker passes + 5 clean destructive passes -> still escalates on its own streak. Goldens: metadata-section-only drift, verified to be exactly the new foldMarkerChurnNoted latch (state/blockContents/stats digests identical). Also notes the load-bearing unpinned order: anonymous prefix affinity resolves on the RAW body (handle.ts, before the prepares) while the strip mutates parsed inside the prepare — session identity stays stable across the upgrade. To be pinned/argued with the owner in the PR thread.
Continuation of the m02811 proof-gap census, driven by the #2636 model-switch incident class. Three proof families go per-wire, and one real misdiagnosis found on the way gets fixed.
1. fix: tolerate a pure reasoning drop as sanctioned model-switch churn (#2193 follow-up, #2636)
Cross-model replay on the anthropic/responses/google wires is DROP-KEEP: structured thinking (thinking blocks / reasoning items / thought parts) is discarded wholesale while every text/tool core keeps its kernel id (ids are seeded blind to thinking siblings). With >=10 dead reasoning ids and zero reanchoring claims, the destroy-escalation logged
compression substrate appears destroyedon a sanctioned host behavior — the fold itself stayed healthy.FoldAnchorgainsc(contentType) so the drift check can classify the unmatched set.2. identity-proof: per-wire model-switch phases (#2636)
destroy-escalation latched on a sanctioned model switch; chat stays green (its churn is claimed by Pass 3, no misdiagnosis existed there).3. fork-adoption: per-wire anonymous-fork adoption (#629)
tests/fork-adoption-wires.test.tsgeneralizes the chat e2e scenario (grow -> fold -> mid-list edit -> fork -> seeded refs identical -> follow-up reconciles -> parent untouched) over anthropic (native mock), responses (chat relay bridge), google (native mock), plus a responses OFF control. Tooth: removinganthropicfrom the adoption SUPPORTED set fails exactly the anthropic test.4. mode-upgrade boundary proof (#1426)
tests/mode-upgrade-proof.test.tspins the proxy->plugin upgrade contract on one rig: same session across the flip (no fork), proxy-era fold keeps its acp_summary carrier in plugin mode, tool injection stops exactly at the flip, a plugin-era fold via /__bili/plugin/tool coexists with the proxy-era block (coverage ledger spans both eras), the binding is sticky when the header disappears, a different agent header overrides the recorded value, and no sanctioned flip latches escalation or conflict events. Tooth: deleting the sticky-restore line insrc/server/handle.tsfails the sticky phase.Also included: the two-scenario continuity proof (already merged via #2729 for chat) now runs on anthropic + responses wires (commit 2d529c1).
Evidence
npm run typecheckclean,npm run buildOK.Config surface
No config changes (no new fields, env vars, or flags).
Kernel boundary
No changes under
kernel/— the reasoning-drop tolerance lives insrc/fold-reconcile.ts(host reconcile layer).5. Reap-side reasoning-awareness (4efdb30, follow-up to §4)
The §4 classification tolerates pure reasoning drops at the session escalation level, but the per-block #2695 zombie streak still counted dead reasoning ids in its majority test: a fold span whose covered ids are reasoning-majority (thinking-only turns, multi-thought turns, dense reasoning stretches) would reap a healthy block 3 passes after a sanctioned drop-keep model switch — summary lost, surviving text re-billed, silently replaced by a re-fold over the decimated history.
Fix: the majority test ("gone") now runs on the non-reasoning covered ids only (anchors carry contentType via the "c" field); a span with no non-reasoning ids never reads as gone. Genuine decimations (text/tool substrate gone) still reap — #2695 semantics unchanged for real loss.
Teeth (A/B, worktree at 28bf4e6):
Note: builds on the review supplement 70b212d (c backfill on anchor reuse) — that closes the pre-upgrade-anchor gap for the escalation side; the same backfill serves the reap side whenever the id rides the wire at least once post-upgrade.