Repository navigation
[PR] fix(#4227): honest compression diagnostics — cumulative shrink/postCtx over all blocks, internal-lane receipts pinned to the round's own offer - #4229
Conversation
📦 Built Package ArtifactBranch: Option A — Install this exact build (recommended)npm install -g billion-context@0.0.5234-pr.4229.64ef990This exact version is immutable and reproducible. The rolling Option B — Download artifact
tar xzf billion-context-pr4229.tgz
npm install -g packageInstall instructions are refreshed on each push. |
…rathons Two observability defects observed live in the #4224 dsh-fork marathon (87 blocks): 1. The [acp-compress-obs] line metered only the CURRENT fold against the raw resend view: with 86+ active blocks it printed "shrink 0%" / "postCtx=14.5M" / "ceiling >=0%" for a heavily compressed session. postCtx is now the RENDERED post-fold context (raw view minus the union of ALL active blocks' covered mass); the this-fold ratio keeps its name and semantics where gates need it (degenerate-fold gate, staged-compress note, lastCompress) and is explicitly labelled; a cumulative figure covers every active block. Single-block sessions stay byte-identical to the old values. Cache-ledger Vp follows the same rendered value (fallback clamp in decomposeSample when the fold's X anchor is absent). 2. Internal-lane (preflight) receipt tails judged "anything left?" on a live recompute fed by statusInputBaseline - the previous request's usage-grade input tokens - while the walk acted on THIS request's actual payload. In an overflow marathon the baseline sits far below the window while the payload is 19x over, so folds claimed "No compressible ranges remain" in the very round whose own walk logged "102 viable range(s)". commitFold and the tier-recovery distill now pass the round's own nudge decision as lastNudge, pinning the tail to the same offer the walk acted on (the #2404 discipline the relay lane already followed). Also removes one processTurn recompute per successful internal fold. No wire change: proxy-mode preflight receipts reach operators via bili.log only (those blocks carry no tool-call carrier); plugin/relay lanes untouched. No config surface, env var, or kernel change. Tests: tests/issue4227-compression-observability.test.ts pins both meters on a pre-seeded multi-block fixture (incl. ledger V/Vp) and reproduces the mixed scope at the preflightCompress wiring level (actual payload ~20x window vs a low usage-grade baseline), asserting the first receipt advertises the round's remaining offer instead of a false stop signal.
268c9fb to
ed4d3d8
Compare
(ai: vllm-qwen/qwen3.8-27b) 查重: 不重复(独立复核:按 shrink/postCtx/observability、"No compressible ranges remain"/viable ranges 两组关键词检索 open+closed issue/PR,均无命中;与 #2383/#4224 的边界一致——它们管 digest 质量与收敛速度,本 PR 管诊断面准确性。) 标签: bug / scope/ui / p3(与源 issue #4227 同缺陷族——压缩诊断面准确性;纯观测误导不阻塞功能) 审核结论:内容通过,新 head CI 绿后可合(人工合并)独立重读了 diff、调用方与 kernel 侧消费点,不是照抄 PR 描述。关键核验: 方向关 —— 两个缺陷都真实存在且修法打到根因:① obs 计量结构上就是「原始重发视图 − 本次 fold」,看不见已有块的净节省,加 cumulative 视角 + 重定义 postCtx 是对症的;② 内部车道假停报的根因是 回归清点(逐项审过既有行为):
测试有效性:三个测试都有牙——多块 fixture 钉死精确计量( diff 整洁度 / 代码整洁:3 文件单提交,无无关改动、无 lockfile/version 噪音。发现两处注释已与代码事实不符(本 PR 自身造成的过时): 我做的动作(均已工具核实)
结构化八问
行为变更披露(旧→新):obs 行新增 注意:#4226(emergency digest 质量/收敛)仍在途且碰 判定:内容审核通过;等 |
📦 Merged Build PublishedThis merge to master was published as npm install -g billion-context@0.0.803-master.1f2886d # this exact build
npm install -g billion-context@master # always the newest merged build
|
(ai: vllm-qwen/qwen3.8-27b)
Closes #4227
查重: 无(按 shrink/postCtx/observability、acp-compress-obs、"No compressible ranges remain"/viable ranges 矛盾等关键词独立检索 open+closed issue/PR,无命中;#2383/#4224 管 digest 质量与收敛速度,本 PR 管诊断面准确性)
What
Two observability defects from the #4224 dsh-fork marathon (87 blocks), both verified against production log lines:
viewTokensis the raw resend view (includes messages already covered by earlier blocks);postCtx = viewTokens - tokensCompressedsubtracted only THIS fold. With 86+ active blocks the line readshrink 0% (~68948/14565283 tok)+postCtx≈14.5M+ceiling ≥0%for a heavily compressed session.RewriteCtxWITHOUTlastNudge, sopostCompressTailfell back to a live recompute judged onstatusInputBaseline— the previous request's usage-grade input tokens (Status readers still trust estimate-grade failure baselines after #1846 #2029's low value for status surfaces). In an overflow marathon that baseline sits far below the window while the actual payload is 19x over → kernel sees no pressure → false stop signal on every fold, while the same round's walk logged 102 viable ranges. The relay lane already pinslastNudge: prepared.nudge(post-compress tail immediately re-advertises newly-released ranges -> chained folds at zero growth -> upstream prefix-cache misses #2404); the internal lanes missed it.How
src/stream.ts: keepshrinkRatioexactly as-is where gates need one rewrite's worth (degenerate-fold gate, staged-compress note,lastCompress) and label itthis-fold; add acumulativefigure over every active block; redefinepostCtxas the RENDERED post-fold context (raw view minus the union of all active blocks' covered mass). Single-block sessions are byte-identical to the old values (union == this fold).src/preflight.ts:commitFoldand the tier-recovery distill pass the round's ownturn.nudgeaslastNudge, pinning the receipt tail to the same offer/scope/moment the walk acted on. Side benefit: removes one fullprocessTurnrecompute per successful internal fold.Behavior changes (old → new)
this-foldlabel +· cumulative Y% (~D/B tok)clause; existing substrings (~A/B tok,foldPoint=,blocks=,anchor≈… tok (N active blocks, sys excluded),postCtx≈,ceiling ≥) preserved.postCtxvalue: OLD = rawView − thisFold → NEW = rawView − allActiveBlocksCoveredUnion. Identical in single-block sessions; multi-block sessions drop from resend-mass to the true rendered size (the ##2383Structured digest produces "zero-conclusion" compression blocks under extreme overflow: one block = one messag | ##2383结构化 digest 在极端溢出下产出「零结论」压缩块:一块 = 一条消息一行、每请求只折一块,87 块常驻 22.9% 窗口(DSH · deepseek-flash · v0.1.201/0.1.202) #4224-shape 14.5M → tens of K). Cache ceiling % becomes meaningful (was ≥0%).Vp: follows the rendered value above; only affectsdecomposeSample's fallback divergence clamp when the fold's X anchor is absent (Vunchanged).Tests
New
tests/issue4227-compression-observability.test.ts:shrink 44% this-fold (~10000/22500)+cumulative 67% (~15000/22500)+postCtx≈7500+ ledgerV=22500/Vp=7500(old code: no cumulative figure,postCtx≈12500,Vp=12500);preflightCompress: actual payload ~20x window (emergency digest regime, zero model calls) vs a low usage-grade baseline, one seeded mid-history block splitting the history into two disjoint runs — asserts the first committed fold's receipt advertises the round's remaining offer instead of a false stop signal (old code: every receipt was a stop signal).Targeted suites green locally (compress-observability, usage-observability, issue1839, compress-success-tail, preflight-emergency-fold, issue3646-tier-recovery-picker, issue2678-batch-fold, preflight-round-budget, issue1841-futility: 58/58) + typecheck + build. Full suite = remote CI on this head.
Note: independent of #4226 (digest quality/convergence) — different hunks in
src/preflight.ts; if #4226 lands first, rebase takes the union trivially.