Repository navigation
[PR] Compression cycle fix: identify and confirm pointer echo, condense duplicate failure receipts into a single line, and co | 压缩循环修复:认出并确认指针回声、把重复失败回执缩成一行、修复折叠后压力表虚高 - #5961
Conversation
… repeat failure receipts, credit overrides cycle-stale meter Field incident (2026-11-08, session 01a1b6b3, four symptoms, one loop): a model under nudge pressure copied its most recent compress call as a template — but compressAtFoldPoint v2 had rewritten that call's args to a short ack pointer, so every re-send failed content-not-array; each failure receipt re-appended the ~200-word format lecture plus a repeat counter the model misread as "the user asked the same thing N times"; and because the burst's turns never reached an upstream settle, the token meter fell back to the raw resent-history bound and read 112% right after a successful fold (238112/212992 while the real outbound was 83K) — re-nudging the very loop the fold was supposed to end. 1. kernel: parse-compress-input classifies content echoing the v2 relocation pointer as kind=already-folded-echo (no lecture), and salvages a content STRING that encodes one entry OBJECT (refs inside the JSON) through the shared entry validator. 2. host: stream.ts acks already-folded-echo as a one-line no-op (no repeat-guard counter; still loop-tracked so runaway bursts hit the #2146 breaker), and collapses identical parse-failure receipts to a one-liner from the 2nd occurrence on — first failure keeps the full teaching receipt. 3. meter: effectiveTokenCount's #5135 pending-credit branch no longer requires !anchorStale — during a compress burst the send chokepoint keeps contextTokensSource="estimate" so the credit exemption was dead exactly when needed; credit is still bounded by the next real settle. kernel-change: acp-kernel 0.0.188 -> 0.0.189 (parse-compress-input: new CompressParseKind member + stringified-entry salvage; owner-directed fix per 2026-11-08 field review of session 01a1b6b3).
📦 Built Package ArtifactBranch: Latest build — install this exact versionnpm install -g billion-context@0.0.8688-pr.5961.75ec665This exact version is immutable and reproducible. The rolling Recent builds (commit → version)
Download artifact
tar xzf billion-context-pr5961.tgz
npm install -g packageInstall instructions are refreshed on each push. |
…ne; gate the one-liner collapse on the tracked lane - issue5134 T5: pending credit now outranks cycle-staleness — the stale estimate is the resend's raw upper bound (field: 112% phantom pressure right after a successful fold). #4383's unreported-growth protection still applies with no fold pending; preflight + the next settle bound the window. - #1029-② / #4812: pin 1st=full lecture, 2nd+=one-liner (count climbs, arm paragraph rides it), n>3=armed short refusal. - #4812 preflight lane: collapse was missing the trackLoop gate — the internal lane must never collapse (fix, not a test change).
|
Fix commit 61cca20 for the 3 red CI tests — all were pinning the pre-fix behavior, except one real bug it caught:
Local: targeted suites 155/155 green (compress family, nudge, receipts), tsc clean. The cache-friendly-plugin failures seen locally reproduce on pristine master on this machine (environmental, not from this branch) — CI is the arbiter. |
(ai: vllm-qwen/qwen3.8-27b) 查重: 不重复——本 PR 即 #5960 的直接修复(owner-directed 现场复盘 session 01a1b6b3),无其他在途同主题 issue/PR。 两个 commit(e03cc4b 原始修复 + 61cca20 红测修复)已逐行审完,关键机制独立复核过。按八问: 是什么问题:模型把压缩完成后写回历史的「指针文案」原样抄回当新的 compress 调用,连续同参失败;失败回执逐条堆长,模型误读成「用户问了 N 次」;折叠刚成功压力表读 112% 虚高又触发新一轮 nudge。三个症状,一条根链:循环对「这次调用早已完成」没有识别、回执没有去重、计量信用豁免恰在需要时失效。 什么原因导致的(三层对应三处修):
影响范围与严重程度:指针回声触发面 = 开了 compressAtFoldPoint v2 且模型回声指针的 pluginMode 会话(v2 默认关,暴露面小);计量虚高影响所有「刚折叠待结算」会话,窗口到下次真实结算为止(通常一轮)。严重度:体验退化+token 浪费,不丢数据、不毁缓存 → p2。 怎么修复的:① parser 认指针字面量(与 v2 分支 PR #5949 的 RELOCATED_POINTER_MARKER 逐字节一致,od -c 核过)→ 新诊断 kind already-folded-echo;顺带把「content 是单个 entry 对象的字符串化 JSON」经共享 entry 校验器抢救为合法 range(负例仍拒)。② 回声回一行确认「那次压缩早已完成,别重发」——不进重复守卫(不给模型错觉)、仍计入 #2146 熔断防失控;相同格式解析失败第 2 次起缩成一行指回首次回执。③ 计量:#5135 信用分支去掉 !anchorStale 前置,credit>0 直接返回净后 usage 级值——stamp 随之翻成 usage,自持环一轮内打破。 是否有回归问题:逐项审过既有行为——#1029 重复守卫语义:有意变更(见下方清单);#4812 armed 阶梯:f2/f3 回执有意变更,preflight 内部车道原会被误伤进缩行(缺 trackLoop gate,是修复里的真 bug)——被 CI 的 #4812 preflight 测试抓住,61cca2039a 补了 gate,我复核 diff 确认: 是否破坏缓存:不涉及。前缀缓存/重试/增量游标/去重键均未触碰;计量变化只影响 nudge 时机判断,不影响任何缓存键。 是否改了设计方向:无架构转向,两处教义澄清:①待结算的压缩信用优先于 cycle-staleness(旧:stale 赢)——stale 路径的值是重发上界而非真实增长,这是本修复核心;②失败回执「一个计数器只说一次」(首次教学,后续指回)。均为既有机制(#5135/#2146/#4812)的延伸,无新数据流。 是否引入了新的配置:不涉及。无新 env/config/CLI/默认值。 行为变更清单(强制披露,旧→新):
CI 实况(刚实测):最终 head 61cca20 全矩阵绿——run 42497948024 全部 11 个 test 分片(ubuntu/windows × node22/24)+静态门+build-artifact 全 success;check-runs 汇总 36 success / 20 skipped / 44 cancelled(取消为打标触发的重跑并发清理,与代码无关)/0 failure。e2e 族按设计 skipped(ci-e2e.yml gate:PR 需带 ci:full 标签才跑真客户端,nightly cron 兜底 master);想要真客户端回归可随时补打 ci:full。 非阻塞小疵(不动手):echo 分支注释里「collapses to the #2146 short refusal」措辞略宽——纯回声 burst 实际是 n≥3 起 ack 追加 pause paragraph,短拒绝只出现在熔断 armed 期间的 parse-failure 回执上;防失控性质本身成立,纯注释措辞,不值得为它触发整轮 CI 重跑。 基线新鲜度:PR 落后当前 master 6 个提交(848f59b),那 6 个全是 CI/test/docs 修复,与本 PR 零文件重叠,mergeable=true 无冲突——直接合或先 rebase 均可。 合并判定:建议合并。代码、测试(kernel 新增 4 用例 + host 三套重钉,断言有牙且双向)、CI 均已验证;kernel 改动(parse-compress-input + 版本 bump)属 human-only 合并档,请自行合并:#5961 |
…ot a string no receipt carries
The re-pin asserted !second.includes("Eligible ranges") — that capitalized
phrase appears in no receipt (the recovery hint reads "Current compressible
ranges", the one-liner lowercase "eligible ranges"), so the check passed
vacuously. Pin the actual lecture signature instead: "compress takes ONE
'content' STRING" is present in the full receipt and absent from the
one-liner, so a regression that re-expands repeats into the full lecture is
caught.
📦 Merged Build PublishedThis merge to master was published as npm install -g billion-context@0.0.1096-master.647b525 # this exact build
npm install -g billion-context@master # always the newest merged build
|
…sis, ranxianglei#5949 relocated fold summaries, ranxianglei#5971 codex lane fixes, ranxianglei#5961 compress-burst loop fix Advances the base from 848f59b to 33d4951 (20 commits, 43 files). The only overlap with this lane is src/pipe-free relay.ts; upstream touched the WS oversize diagnosis, outbound stamping and continuation refetch paths, while the lane's non-streaming compact egress sits at src/server/relay.ts:2103. Both survive — the auto-merge needed no manual resolution. Notable upstream commits adopted: - cc1e240 kernel: relocate-compress v2 — summary text moves to the fold point - e03cc4b Stop the compress-burst loop: ack fold-point pointer echoes - 725084b feat: context analysis — init size, nudge cadence, harvest acceptance - 3fcf41e fix(codex): answer WS-lane failures with object error frames (ranxianglei#4601) - 86aae0d fix(google): keep tool_result-first part order for Claude-through-Google - d3fab0d fix(codex): keep marketplace Git repos inside the codex overlay tmp - 50e4cdc fix(ci): sync root + kernel lockfiles to acp-kernel 0.0.189
Fixes #5960(现象/现场证据/根因链见 issue)。
改了什么
kernel/src/parse-compress-input.ts):content 里含 compressAtFoldPoint v2 的指针文案 → 新 kindalready-folded-echo(与 v2 分支的RELOCATED_POINTER_MARKER字面量保持一致,本 PR 不依赖该分支);content 字符串整体编码单个 entry 对象 → 经共享 entry 校验器抢救为合法 range。新 kind+抢救共 4 个 kernel 测试。src/stream.ts):指针回声回一行「那次压缩早已完成,别重发」的确认——不进失败计数(不给模型「用户问了 N 次」的错觉),但仍计入 dsh内部问题 出现这个错误后,重启dsh可以发消息 但陷入无限压缩失败 #2146 熔断防失控;相同格式的解析失败从第 2 次起回执缩成一行(首次保留完整格式教程+范围清单)。src/server.tseffectiveTokenCount):[Bug] 0.1.209: Claude Code CLI main conversation forks onto <id>|sub:<fp>; the session-title call claims the raw key (regression from #4774) #5135 压缩信用分支去掉!anchorStale前置——连续压缩回合无上游结算,锚点整个爆发期都判过期,信用豁免恰好在最需要时失效,计量跌回原始重发历史上界(现场 238112/212992=112%,实际出站 83K)。信用仍由下次真实结算清零,不会冻结计量。验证
tests/compress-burst-ghost-pressure.test.ts钉住「有信用→用净后 usage;无信用→过期守卫仍拒绝冻结锚点」两条。kernel-change: acp-kernel 0.0.188 → 0.0.189(parse-compress-input 新增 CompressParseKind 成员与字符串化 entry 抢救;owner-directed fix,2026-11-08 会话 01a1b6b3 现场复盘)。