Skip to content

[PR] Put each compression summary at its fold point; the old slot keeps a pointer instead of a full compress command (compressAtFoldPoint v2) - #5949

Merged
ranxianglei merged 4 commits into
masterfrom
kernel/relocate-fold-summary-v2
Nov 9, 2026
Merged

ranxianglei merged 4 commits into
masterfrom
kernel/relocate-fold-summary-v2

Conversation

@ranxianglei

Copy link
Copy Markdown
Owner

kernel-change: fold-point relocation semantics v2 + live-carrier protection hook-up — owner-directed fix in session 2026-11-08 (dev-lane live mis-behaviour analysis: weak-attention model read the v1 mid-history wall of fully-shaped compress exchanges as an invitation to keep compressing; voluntary re-compress loops while the ledger showed healthy headroom).

What was wrong

With compressAtFoldPoint ON, v1 moved each still-visible compress call/result pair VERBATIM to its fold point. That leaves a mid-history wall of fully-shaped compress interactions (call args = full summary + range, result = success receipt). Weak-attention models (qwen3-27b) imitate shapes: they kept issuing new voluntary compress calls against already-folded ranges, got refused by the existing guards (requireNudge / out-of-bounds), retried the same call verbatim — a refuse-loop that burned ~78k input tokens per attempt (observed live on a dev lane, 8 refusals stacked in one history).

What this PR changes (v2)

  • The SUMMARY TEXT (the call's args content) is re-emitted as a plain user text carrier at the fold point it describes: [bili fold summary — block(s) bN …; relocated from compress call <id>] + the summary body. The content the model needs to re-read sits where it needs it.
  • The pair KEEPS its chronological slot; the call core's args are replaced by a short pointer: compression succeeded — summary relocated to its fold point above; already folded — do not re-compress. No fully-shaped compress command remains in the wall.
  • The result core is forwarded verbatim — compression still reports success.

The summary cannot be re-compressed as plain text (#335 hook-up)

Follow-up commit: the new carrier rides the existing live-checkpoint-carrier protection (summaryOfBlockId = the pair's anchor block):

  • the selector screens it as a protected gap — no advertised range bridges it;
  • a hand-rolled plain range that includes it gets the carrier carved out (stays visible, warning points at block refs);
  • once the anchor block is consumed by a block-ref distillation — which sees and absorbs the carrier text into the new summary — the carrier goes stale and folds like ordinary text. So the RESULT stays compressible forever; the SUMMARY cannot be silently re-distilled as if it were ordinary user text whose source history is already folded away.

v1 had the same gap (the moved pair carried no protection either).

Invariants kept

Verification

  • kernel suite 1611/1611 (23-test relocate suite rewritten for v2: pointer args, verbatim receipt, carrier placement, clone-not-mutate, JSON content extraction, multi-range boundary + block list, idempotency = second run same-array-reference, marker-only skip, tail fallback, thinking-clear variants, plan/apply agreement, single- and multi-block carrier anchoring)
  • host typecheck clean; compress-at-fold-point / compress-observability / responses-refold-head-stability suites green on a clean master worktree
  • kernel 0.0.187 → 0.0.189

…the pair stays in its slot with pointer args (#5470 follow-up)

v1 moved each still-visible compress call/result pair verbatim to its fold
point. With the knob ON that leaves a mid-history wall of fully-shaped
compress interactions, which weak-attention models (qwen3-27b) read as an
invitation to keep compressing — observed as voluntary re-compress loops
even while the ledger showed healthy headroom.

v2 keeps exactly what the model needs at each spot:
- the SUMMARY TEXT (args content) is re-emitted as a plain user text carrier
  at the fold point it describes ('[bili fold summary — block(s) bN …]');
- the pair KEEPS its chronological slot; the call core's args are replaced
  by a short pointer ('compression succeeded — summary relocated …; already
  folded — do not re-compress'), so it no longer reads as an open command;
- the result core is forwarded verbatim (compression still 'succeeded').

View-only and deterministic as before; idempotent via carrier id
(acp_reloc_<callId>) plus an args marker probe (survives host round-trips
that strip synthetic ids). The call core rewrite is a shallow clone — input
cores are never mutated. Boundary rule, ambiguity skips, #4732 tail
fallback and the predicate-gated thinking clear are unchanged.

kernel-change: fold-point relocation semantics v2 (owner-directed fix after
live mis-behaviour analysis on a dev lane); kernel 0.0.187 → 0.0.188.
Follow-up to 2dd1f997c: the v2 fold-point carrier (plain user text carrying
the relocated summary) had NO checkpoint protection — a plain message-ref
compress range could fold it as if it were ordinary user text, re-distilling
a summary whose source history is already folded away (#335's exact hazard).

The carrier now carries summaryOfBlockId = the anchor block of the pair
(first block; multi-block pairs virtually always get consumed together by
the block-ref distillation that spans them). While the anchor is active:
- recommend.ts screens the carrier as a protected gap — no advertised range
  bridges it;
- unit-projection carves it out of any hand-rolled plain range (it stays
  visible, with the existing warning pointing at block refs);
- once the anchor block is consumed by a block-ref distillation — which
  sees and absorbs the carrier text into the new summary — the carrier goes
  stale and folds like ordinary text: the RESULT remains compressible, the
  SUMMARY cannot be silently re-distilled as plain text.

v1 (pair moved verbatim) had the same gap; nothing marked the moved pair.

kernel-change: carrier protection hook-up (#335 predicate); 0.0.188 → 0.0.189.
@github-actions

github-actions Bot commented Nov 8, 2026 •

Copy link
Copy Markdown
Contributor

📦 Built Package Artifact

Branch: kernel/relocate-fold-summary-v2 (e316d3f)

Latest build — install this exact version

npm install -g billion-context@0.0.8633-pr.5949.1961ec3

This exact version is immutable and reproducible. The rolling pr tag tracks the newest test build across all PRs.

Recent builds (commit → version)

commit version build
e316d3f billion-context@0.0.8633-pr.5949.1961ec3 build
cec34d1 billion-context@0.0.8632-pr.5949.1566636 build
ad242bf billion-context@0.0.8631-pr.5949.ad5e8de build

Download artifact

  1. Download the artifact from the Actions run
  2. Extract the tarball and install:
tar xzf billion-context-pr5949.tgz
npm install -g package

Install instructions are refreshed on each push.

@ranxianglei ranxianglei changed the title Put each compression summary at its fold point; the old slot keeps a pointer instead of a full compress command (compressAtFoldPoint v2) [PR] Put each compression summary at its fold point; the old slot keeps a pointer instead of a full compress command (compressAtFoldPoint v2) Nov 8, 2026
@ranxianglei ranxianglei added bug Something isn't working p2 scope/kernel labels Nov 8, 2026
@ranxianglei

Copy link
Copy Markdown
Owner Author

🤖 Powered by ework · qwen3.8-27b

[bot] 🏷 (ai: vllm-qwen/qwen3.8-27b)

查重: 不重复 — 本线程只有一个 [PR] 行(mirror #5951 → GitHub PR #5949),无并列修复 PR,未另开分支。

标签: bug + scope/kernel + p2(已打到镜像线程与 GitHub PR;保留原有「马上合并」「实验性功能」)。一句话理由:修的是实验开关下实测到的误行为 → 缺陷类;改动主体在 kernel/;影响面限于主动开启该实验开关的用户且有绕行(关开关)→ p2,非 p1(默认 OFF、守卫拦住了循环、无数据丢失/无界增长)。

按 [PR] 规程处理:没有重做工作,拉取活分支核对代码 + 实时确认 CI。以下为核对面(全部为今日实时查证,非记忆):

Live state (verified just now)

  • Head e316d3fea1,共 4 commits:v2 语义 + fix: detect codex compaction requests before preflight; verbatim passthrough when not intercepted (#332) #335 保护接线两个 kernel commit,加两个 lock-sync chore(分支在我审查期间又前进了两次,最终按 tip 审的)。
  • CI on this tree: 首批全量批次(11:55Z)全绿——主测试矩阵(ubuntu/windows × node 22/24 × 3 shards)、kernel-guard / lane-guard / lock-sync / config-surface-guard / docs-* 等全部 guard job、各 e2e lane 均 success。12:08:59Z 有一批由 labeled 事件自动触发的重跑(所有 workflow 的 pull_request triggers 含 labeled;我加标签是最近一次此类事件)——按 ci: any non-ci:full label on a PR cancels its in-flight matrix run and records a vacuous skip-green #3772 设计那是 skip-scoped 的空跑批,但整批被取消,导致 commit 状态聚合卡在 pending、PR 显示 blocked。我已把被取消的批次 rerun(均为空跑批,无实质计算成本);现在该 SHA 上每个 check 名的最新 check-run 均为 success/skipped(check-runs API 逐一核对,180 条无一失败)。代码自绿批以来零变更。

Code review findings

两处小发现(均不挡合并)

  1. kernel/src/compress.ts:1101-1104 节点注册处注释仍是 v1 措辞("move still-visible carrier pairs onto their fold point"——v2 里 pair 不再移动)。一行注释修正,但落在 kernel/src/** 下须连带 kernel 版本 bump,且 dev 车道正在此分支活跃推送,我没有中途插 commit;建议措辞:"relocate the SUMMARY TEXT of still-visible carrier pairs onto their fold point (pair keeps its slot with pointer args)",下轮顺路带上即可。
  2. (可选)测试钉的是谓词本身(isLiveCheckpointCarrier(carrier, state) === true),没有一条端到端行真正让 recommend 筛选 / unit-projection 挖除跑过 relocated carrier。机制是既有的且 fix: detect codex compaction requests before preflight; verbatim passthrough when not intercepted (#332) #335 自带测试已证明,残余风险低;如要更硬可在后续补一条集成行。

结构化八问(PR 审核结论)

  1. 是什么问题:compressAtFoldPoint v1 把完整形状的 compress 调用/结果对原样搬到折叠点,历史中部留下一整墙"完整压缩命令"形状,弱注意力模型(qwen3-27b)模仿形状持续自愿重压已被折叠的范围,被现有守卫拒绝后原样重试——dev 车道实测 8 连拒、每次烧约 78k input tokens。
  2. 什么原因导致的:弱注意力模型靠形状模仿行动——call args 里的完整摘要+range 读起来像一条待执行的压缩指令;v1 的搬运方式反而把这堵墙固化在历史中段。根因在"可见载体形状"而非守卫缺失(requireNudge/out-of-bounds 都正常工作)。
  3. 影响范围与严重程度:仅影响主动开启 compressAtFoldPoint 的用户(默认 OFF,默认用户字节级不受影响);开启用户在 v1 下 token 浪费 + 拒绝循环,能用但体验明显受损、有关闭开关的绕行 → p2。
  4. 怎么修复的:载体分离——模型需要重读的摘要文本以纯 user text 形式放到它描述的折叠点(带 summaryOfBlockId 锚定首块,骑既有 fix: detect codex compaction requests before preflight; verbatim passthrough when not intercepted (#332) #335 live-carrier 保护:plain range 不能跨它/折它,block-ref distillation 可以吸收它使其转 stale);原 pair 留在时序槽位、call args 换成"already folded — do not re-compress"短指针、result 逐字转发。view-only + 确定性 + 双探针幂等,三调用点(pipeline 节点 / relay round-2 / plugin-render S4)同一函数保证一致。
  5. 是否有回归问题:无。host 侧 diff 纯注释/i18n;管线节点顺序不变;边界规则/歧义跳过/Plugin history render drops an entire fold (covered rows suppressed AND no summary anchor) when the fold reaches the transcript tail — ok:true, no error #4732 尾回退/thinking clear 语义不变;开关关闭时 no-op fast path 返回同数组引用(有测试钉死)= 字节级 legacy 一致。高危模式逐项过:无语义漂移(v1→v2 是本次显式目的,已在 PR 正文披露旧→新)、无 fail-fast 变吞错、无阈值/时序漂移、输出格式变化仅限开关开启时的视图布局(属功能本体)。唯一瑕疵是 compress.ts:1101 一处 v1 残留注释(见上文小发现 1)。
  6. 是否破坏缓存:否。view-only transform 不碰 refs、不写持久层;布局是 f(history, state) 的确定性函数,稳态每轮重算出相同字节,第二轮起 byte-stable,不产生折叠自身 break 之外的额外 prefix-cache 成本;carrier 紧贴折叠区之后,折叠点之前的稳定前缀不受影响。S4 render 的 env/global-tier 读取不对称是 v1 既有的、已在代码中登记 KNOWN ASYMMETRY 的有意选择,非本 PR 引入。
  7. 是否改了设计方向:无架构转向——同一实验开关内 v1→v2 语义替换(搬 pair → 搬摘要+留指针),复用既有 fix: detect codex compaction requests before preflight; verbatim passthrough when not intercepted (#332) #335 保护谓词,未引入新机制/新模块/新数据流。
  8. 是否引入了新的配置:无。沿用既有 compressAtFoldPoint(默认 OFF)与 clearThinking 伴随开关,无新 env/config 项;面板文案 en+zh 同步更新。

收工判定:代码与描述逐项吻合、CI 在该树上全绿(含清理后的最新 check-run 全 success/skipped)、版本纪律合规、无回归发现——我这边判定可合并,合并动作留给 owner(「马上合并」标签已在)。

@github-actions

github-actions Bot commented Nov 9, 2026

Copy link
Copy Markdown
Contributor

📦 Merged Build Published

This merge to master was published as 0.0.1097-master.d70e6e2 (rolling master tag).

npm install -g billion-context@0.0.1097-master.d70e6e2  # this exact build
npm install -g billion-context@master  # always the newest merged build

npm view billion-context@master prints the current version at any time.

Louie0806 added a commit to Louie0806/billion-context that referenced this pull request Nov 9, 2026
…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
ranxianglei added a commit that referenced this pull request Nov 10, 2026
…ringified single-entry compress content salvaged, compress-burst credit meter overrides cycle-stale (#5949 v2 / #470 / #5135+#4383)
ranxianglei added a commit that referenced this pull request Nov 11, 2026
…at-fold-point

[PR] remove: the experimental compressAtFoldPoint feature — fold-point relocation (v1 #5471 + unreleased v2 #5949), #6132
yanhuojiyusheng pushed a commit to yanhuojiyusheng/billion-context that referenced this pull request Nov 11, 2026
…anxianglei#6132)

Owner-directed full removal of the experimental compressAtFoldPoint /
compressAtFoldPointClearThinking feature (v1 ranxianglei#5471 + unreleased v2 ranxianglei#5949):
two distinct live pathologies in 9 days on its own target model family —
2026-11-08 voluntary re-compress loops (v1, ranxianglei#5949 field report) and
2026-11-10 authorship misattribution (v1 in v0.1.213 production: the pair's
relocation left the turn's own answer text bare at the transcript tail, and
a 27B model read its own last utterance as a user message, m00376 chain).

- delete kernel/src/relocate-compress.ts + kernel/tests/relocate-compress.test.ts
- drop the relocate-compress-carriers pipeline node (after hide-compress-calls,
  before view-latch) and its registration
- drop Config.compressAtFoldPoint / .compressAtFoldPointClearThinking /
  .reasoningDroppable and the public relocateCompressCarriers/plan exports
- drop the already-folded-echo parse kind + v2 pointer marker
  (parse-compress-input.ts) and the two echo tests
- kernel 0.0.192 -> 0.0.193 (both package-locks)

kernel-change: removed relocate-compress.ts, the pipeline node, 3 Config
fields and the public exports (full feature removal, owner decision after the
2026-11-10 incident, ranxianglei#6132); with the switch off the transform was a
byte-identical no-op, so removal changes nothing for the default layout.
kernel 0.0.192 -> 0.0.193.

Closes ranxianglei#6132 (kernel side; host/web/docs follow in the next commit of this PR)
yanhuojiyusheng pushed a commit to yanhuojiyusheng/billion-context that referenced this pull request Nov 11, 2026
…#6132)

Companion to the kernel removal: strip the experimental fold-point
relocation feature (v1 ranxianglei#5471 + unreleased v2 ranxianglei#5949) from everything else.

- env knobs BILI_COMPRESS_AT_FOLD_POINT(_CLEAR_THINKING) + resolvers
  (knobs.ts), file keys compress.compressAtFoldPoint(_ClearThinking)
  (config.ts: CompressSettings fields, COMPRESS_SETTING_FIELDS, parser
  loop), compress-settings.ts cascade/pass-through/reachability,
  relay.ts round-2 mirror + drop-predicate install, the four prepare*
  install sites, plugin-render.ts S4 mirror, makeFoldPointReasoningDroppable
  (server.ts), the v2 already-folded-echo ack in stream.ts
- stale configs: one-shot INERT deprecation warning extended to the two
  removed keys (every level incl. top-level), values ignored
- web config row + i18n strings (en/zh), config-reference yaml, site docs,
  site i18n strings, blog post + article entries deleted (owner instruction)
- docs configuration en/zh + lifecycle ledger (rows removed, §5 note),
  CHANGELOG entry
- tests: delete tests/compress-at-fold-point.test.ts, drop the echo test
  from compress-reject-reasons.test.ts, extend removed-compress-keys-inert
  with the removed fold-point keys

Closes ranxianglei#6132
ranxianglei added a commit that referenced this pull request Nov 11, 2026
…ringified single-entry compress content salvaged, compress-burst credit meter overrides cycle-stale (#5949 v2 / #470 / #5135+#4383)
ranxianglei added a commit that referenced this pull request Nov 14, 2026
…ringified single-entry compress content salvaged, compress-burst credit meter overrides cycle-stale (#5949 v2 / #470 / #5135+#4383)
ranxianglei added a commit that referenced this pull request Nov 14, 2026
…ringified single-entry compress content salvaged, compress-burst credit meter overrides cycle-stale (#5949 v2 / #470 / #5135+#4383)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant