Repository navigation
[PR] incremental: pull-receipt ack reconciliation + drift fallback serves the richer side (#4352, #4323) - #4337
Conversation
…the richer side (#4352, #4323) - GET /__bili/plugin/turn?conversation=<id> now returns the warm canonical's {appliedSeq, boundary}; the boundary is the wire hash of the last applied message (byte-identical to the client formula), null when cold. - pi's maybeIncrementalTurn reconciles any un-acked pending plan by pulling the receipt BEFORE planning the next turn, adopting it only when the boundary proves the canonical absorbed OUR last message — a missed response-header ack (transport-dependent after_provider_response) no longer turns every turn into a full re-seed. - persist loadSync drift fallback now compares both sides' mapped-ref counts and serves the richer one: a stale envelope (older multi-writer generation) can no longer resurrect an outdated fold state over a newer index generation, which dead-ended preflight at a phantom 8.29M tokens with 0 compressible ranges.
📦 Built Package ArtifactBranch: Option A — Install this exact build (recommended)npm install -g billion-context@0.0.5179-pr.4337.712705eThis exact version is immutable and reproducible. The rolling Option B — Download artifact
tar xzf billion-context-pr4337.tgz
npm install -g packageInstall instructions are refreshed on each push. |
(ai: vllm-qwen/qwen3.8-27b) 审核结论(八问)一句话:代码本身质量过关、双根因修法正确、定向验证全绿;CI 的 8 个红 lane 全部是 master 既有红(与本 PR 无关,已核实);合并前需要你拍板一件事——与 #4332 在同一代码行的重叠实现怎么合成一个闭环。
验证证据
需要你拍板:与 #4332 的重叠处置两个 PR 都改
另两件小事(不阻塞):①本 PR 正文缺字面 收工判定:代码可合(定向验证+静态门禁全绿);前置两件事——你拍板 A/B/C,以及 #4334/#4330 把 master 修绿拿到全量套件判决。拍板后我立即执行对应整理并回帖确认。 |
📦 Merged Build PublishedThis merge to master was published as npm install -g billion-context@0.0.747-master.fba2d13 # this exact build
npm install -g billion-context@master # always the newest merged build
|
…ane (ranxianglei#4352) Claude Code builds that stamp no agent-id headers (VS Code extension) send subagent model requests under the parent session id. Their short, unrelated histories ride the parent session and destroy its fold substrate: fold-reconcile sees covered ids missing, confirms epoch destruction, and the model's compress calls die as substrate-destruction with refs recorded DEAD. The ranxianglei#975 two-signal gate cannot see these subagents: VS Code builds share the parent's first system block verbatim, so the main-prefix negative check fails even when the agent-id headers are present. Route claude anthropic-wire traffic (x-claude-code-session-id source, evidence allowlist in the lane-decisions registry) through the continuity-aware order resolver when the ranxianglei#975 gate misses: a continuing main conversation keeps the raw id on order+content evidence; a history-disjoint ride forks onto its own |sub:<fp> lane (own lock chain, own compression state); a byte-drifted system on continuing history still keeps the raw id (ranxianglei#1106). Gated by the existing subagentSplit knob (no new config surface); side calls and empty-system requests stay verbatim. Re-applies the fix from unmerged PR ranxianglei#4409 (closed by a stale-ticket bot that misattributed the closure to ranxianglei#4337, which does not touch this path) onto current master. Closes ranxianglei#4769 (re-report of ranxianglei#4352). Tests: tests/issue4352-claude-anthropic-subagent-split.test.ts — both gate directions plus the live VS Code field shape captured in the issue comment. Docs: CONFIGURATION.md/.zh-CN.md subagentSplit rows describe both paths.
Fixes the two root causes behind the 2026-10-22 incremental dogfood incident (full timeline in the issue comments of #4323).
Root cause 1 — ack channel depended on the response-header transport (#4352)
pi's
after_provider_responseexposes response headers only for some provider transports. When thex-bili-applied-seqheader never reaches the extension,noteIncrementalAcknever runs — and every subsequent turn re-seeds the full history (sinceSeq=0, 21K messages resent as a "delta").GET /__bili/plugin/turn?conversation=<id>now returns the warm canonical's{appliedSeq, boundary}.boundary= wire hash of the last applied message (byte-identical to the client'sincrementalWireHash); a cold canonical reportsnull— it cannot vouch and is never adopted.pi.ts maybeIncrementalTurnreconciles any still-pending un-acked plan by pulling the receipt before planning the next turn, adopting only whenboundaryproves the canonical absorbed OUR last message. Never on mere seq progress — a foreign full-resend also advances the canonical.Root cause 2 — drift fallback served the stale side (#4323)
With multiple writers sharing one sessions directory, the loadSync drift fallback unconditionally served the legacy envelope — resurrecting an older fold generation (11,849 refs / 12 active) over the newer index generation (26,971 refs / 16 active). Coverage stopped matching the canonical rows → the raw history replayed unfolded (0 compressible ranges) → preflight dead-ended at a phantom 8.29M tokens (502, not forwarded).
Tests
tests/incremental-ack-pull.test.ts(3): response-header ack regression pin / pull adoption without any response observation / coldboundary: nullrefuses adoption (honest re-seed).tests/storage-full-flip.test.ts4b: a stale envelope loses to a newer index generation.Out of scope (tracked)