Skip to content

[PR] fix(#5780): screen UNCOVERED HISTORY runs through the apply-side foldability judgment - #5785

Open
ranxianglei wants to merge 5 commits into
masterfrom
2026-11-06_uncovered-foldability-screen
Open

ranxianglei wants to merge 5 commits into
masterfrom
2026-11-06_uncovered-foldability-screen

Conversation

@ranxianglei

Copy link
Copy Markdown
Owner

Closes #5780. Related: the split-guard item on #5185 (owner-tracked); coordinates with PR #5311 (see below).

What this is

UNCOVERED HISTORY (the #4331 audit surface) advertised runs that compress structurally cannot fold — in the incident log, m02080–m02088 was rejected with "Range would split 1 turn(s) at the protected-zone boundary", and the atomic batch rollback dragged the adjacent legitimate range down with it. The audit never ran the shared apply-side foldability judgment (#3236 doctrine: advertise and execute must share one projection) — that doctrine was wired into the Compressible-ranges offer and the acp_status uncompressed view, but not into the later-added uncovered-history audit.

Fix (host-side only, zero kernel diff)

src/uncovered.ts:

  1. Foldability screen. Every final run's exact span is run through core.applyCompression on a structuredClone of the live state — byte-for-byte the path a real submission takes (public core API; no kernel re-export needed, so kernel authorization request: export the projectUnit screening entry so UNCOVERED HISTORY runs can carry verdict-backed foldability tags #5784 is not required for this fix). Structurally doomed runs carry a compact trailing marker:
  2. Zone-claim recovery (companion defect found in triage). The empirical zone diff silently dropped any run whose ENTIRE body was claimed by the diff — including doomed heads that predate the protected window (exactly the incident geometry: "fold up to the previous question" + recent window starting on the turn's first tool call). Runs whose head predates the host-side protected-claim estimate are now reported (and screened/marked) instead of vanishing. The estimate deliberately UNDER-counts the kernel zone (message-count window + most-recent-user anchor only; token/closure extensions ignored) so the bias direction is report-more, never hide-more.

The marker rides both render sites automatically (acp_status section + success-receipt verdict line) — no consumer edits.

Behavior changes (intended, disclosed)

  • UNCOVERED HISTORY run lines can now end with , ⚠ not foldable: … inside the parens for structurally-doomed runs only (old: bare span; new: span + marker). Plain-line grammar unchanged.
  • Runs previously dropped silently (fully zone-claimed, head before the protected window) now appear, marked. Old: invisible; new: visible + marked.
  • No config / wire / kernel / persistence / summary-format changes. No kernel diff → no kernel-guard declaration required.

Coordination with PR #5311

#5311 (part of #5186) adds a blanket STATIC [not foldable] prefix to all uncovered runs plus a historical-refs note on success receipts. Different mechanism (static mask vs shared judgment): this PR's marker is per-run evidence from the actual apply path and names the cause; #5311's prefix flags without explaining why. Both touch the same parenthesized render hunk — whichever merges second carries a small rebase (this note appends inside the parens after any leading prefix, so they compose). I did not stack on #5311's branch because it fixes a different thread (#5780 vs #5186) — one issue = one scope.

On ④ (pre-loop coverage snapshot)

Triage conclusion matches the tracking side's empirical probe: the stale preExistingCoverage snapshot in applyRanges cannot produce spurious split fatals in forward-order batches (INV1 needs a call earlier than its own group's reasoning — impossible; INV2 never references coverage; overlap-skip prevents sibling-span overlap). Residual impact is limited to reversed-order submissions and self-heals next round. No change here.

Tests

New tests/issue5780-uncovered-foldability.test.ts (7 tests, hermetic, real kernel apply path):

  • P1: incident geometry ("up to the previous question", zone on the turn's first call) → run reported + ⚠ …split… marker; consistency pin: verbatim submission fails identically with "would split" (advertise↔execute agreement).
  • P1b: the marker rides the rendered listing.
  • N1: turn-aligned mid-history hole stays UNMARKED and folds cleanly (no over-marking); fully-claimed tail with head inside the claim stays silent (no over-reporting).
  • P2: larger-context variant — fully-claimed run with head before the window is reported + marked (was: silently vanished).
  • P2b: run inside a [Bug] neverPreserveRecentTools splits tool-call/result pairs at protected boundary, causing upstream 400 invalid_request_error #2886-closure-extended zone gets the zone marker although the naive message-count claim misses the pullback; verbatim submission is the predicted soft no-op.
  • P4: sub-gate run stays unmarked (transient refusal, self-teaching).
  • unit: marker renders inside the parens; cap kept; note-less lines byte-stable.

All 10 existing tests/issue4331-uncovered-history.test.ts tests pass unchanged. Local: targeted suites green, typecheck clean, build clean; full-suite verdict comes from CI. Perf sanity: ~27 ms audit on a 1800-message session with 3 reported runs (advisory surface, not the per-request hot path).

@github-actions

github-actions Bot commented Nov 6, 2026 •

Copy link
Copy Markdown
Contributor

📦 Built Package Artifact

Branch: 2026-11-06_uncovered-foldability-screen (b94e68d)

Latest build — install this exact version

npm install -g billion-context@0.0.9542-pr.5785.61ee164

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
b94e68d billion-context@0.0.9542-pr.5785.61ee164 build
4a55be3 billion-context@0.0.9448-pr.5785.f073b59 build
aaacc5b billion-context@0.0.8330-pr.5785.a441de0 build
b1ae885 billion-context@0.0.8328-pr.5785.3926d05 build
b0cd01e billion-context@0.0.8327-pr.5785.e6d84ea build

Download artifact

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

Install instructions are refreshed on each push.

@ranxianglei ranxianglei changed the title fix(#5780): screen UNCOVERED HISTORY runs through the apply-side foldability judgment [PR] fix(#5780): screen UNCOVERED HISTORY runs through the apply-side foldability judgment Nov 6, 2026
@ranxianglei

Copy link
Copy Markdown
Owner Author

🤖 Powered by ework · qwen3.8-27b

(ai: vllm-qwen/qwen3.8-27b)

查重: 不重复。 Open [PR] 列表里唯一相关项是 #5311(静态 [not foldable] 前缀 + success receipts 的 historical-refs note,修的是 #5186)——不同线程、不同机制(静态遮罩 vs 共享 apply-side foldability 判定)。两者触碰同一个括号渲染块,PR 正文已写明协调方式(后合入者带小量 rebase,标记可组合)。没有其他 open PR 指向 #5780。

这是 [PR] 唤醒,不重做工作,进入验证:拉取 2026-11-06_uncovered-foldability-screen @ b0cd01e,对照当前 master 审 diff、查 CI(镜像缓存)、本地跑两个定向测试套件(issue5780-uncovered-foldability + issue4331-uncovered-history)。结构化八问审查结论随后在本线程给出。

@ranxianglei

Copy link
Copy Markdown
Owner Author

🤖 Powered by ework · qwen3.8-27b

(ai: vllm-qwen/qwen3.8-27b)

审查完成。结论:可合并(待 CI 剩余 lane 跑绿;已完成 lane 全绿、无红)。方向、实现、测试均成立;顺手修了一处注释(见末节,独立 commit b1ae885 已推到 PR 分支)。

结构化八问:

  1. 是什么问题:UNCOVERED HISTORY([Bug] compress reports 'no compressible ranges remain' while mid-history spans sit outside every block #4331 加的观测面)会「列出」apply 端必然结构性拒绝的段(保护边界上的 turn 碎片)——模型照抄提交必被拒,还经原子批回滚连累兄弟 range;另外整段被 zone-diff「认领」的 run 即使头部早于保护窗口也会被静默丢弃——正是事故 m02080–m02088 的盲区。
  2. 什么原因导致的:列表面(recommend 侧)与执行面(apply 侧)不共用同一资格判定,违背 [Bug] recommend/apply 对同一区间的 turn-integrity 判定永久不一致:acp_status 反复推荐的区间被 apply 侧整段拒绝(0.1.196,Range would split N turn(s) at the protected-zone boundary) #3236 单一投影教义;zone-diff 无法区分「被 recent window 藏住」与「被结构性扣留」,旧代码把两者一律当「zone 隐藏」静默掉。
  3. 影响范围与严重程度:所有出现 acp_status overview / 成功 receipt UNCOVERED HISTORY 行的会话(advisory 面)。严重度:体验缺陷 + 浪费往返(p2 档)——无数据丢失、无线协议变更、不影响模型流量;最坏情形 = UNCOVERED HISTORY advertises a protected-boundary turn fragment that compress always rejects | [Bug] UNCOVERED HISTORY 报出的 run 是保护区边界的 turn 片段,compress 必然拒绝,且整批回滚把相邻的合法区间一起废掉 #5780 之前的行为(静默少报),不产生新失败。
  4. 怎么修复的:每个幸存 run 用 core.applyCompression 在 state clone 上跑一遍真实 apply 路径(公开 API、零 kernel diff、字节级同一代码路径);结构 fatal/no-op(turn split / entirely zoned)在渲染行括号内追加紧凑 ⚠ 标记并点名原因;瞬态拒绝(低于 fold-size gate 等)保持无标记(与相邻 mass 合起来仍可折,且拒绝文本自教学)。整段被认领的 run 若头部早于 host 侧保护窗估计则上报并由 screen 打标。
  5. 是否有回归问题:逐项清点既有行为——
    • 两个渲染点(src/stream.ts:675 success receipt、src/acp-status.ts:314 overview)经 describeUncoveredRuns 透传 note:无标记行渲染逐字稳定(单测钉住);
    • VIABLE_RANGE_MIN_TOKENS 门槛、zone-diff 机制、actionable 排除逻辑均未动;
    • screen 失败降级为「无标记」(advisory 姿态保持),receipt/status 不受影响;
    • 高危模式(fail-fast 变吞错、阈值/时序漂移、输出格式漂移):无——标记是括号内尾部追加,既有字段不变;
    • 披露的行为变化(PR 正文 §Behavior changes ②):整段被认领且头部早于窗口的 run 从「静默消失」变为「可见+⚠ 标记」,旧值→新值=隐藏→诚实可见,原因=事故盲区,属有意变更;
    • 另发现一个残余几何角(见下节),非回归(最坏退化到旧行为)。
  6. 是否破坏缓存:不涉及。纯服务端观测面字符串变化,不触前缀字节、块存储、账本或 ref 空间。
  7. 是否改了设计方向:不涉及。把 [Bug] recommend/apply 对同一区间的 turn-integrity 判定永久不一致:acp_status 反复推荐的区间被 apply 侧整段拒绝(0.1.196,Range would split N turn(s) at the protected-zone boundary) #3236 单一投影教义落到第三个面(recommend 侧、acp_status uncompressed view 之后),零 kernel surface 变更。
  8. 是否引入了新的配置:无。

测试有效性:7 个新 case 走真实生产 apply 路径(parseCompressInput + applyRanges)钉 advertise↔execute 一致性——被标记 span 逐字提交收到与标记预测相同的拒绝(P1/P2)、turn 对齐空洞保持无标记且干净折叠(N1)、sub-gate 段保持无标记(P4)、#2886 closure zone 得 zone 标记且提交为 soft no-op(P2b);正负向成对,断言有牙。本地定向运行:17/17 绿(新文件 7 + issue4331 回归对 10)。master 自 merge-base 以来未触碰 src/uncovered.ts、src/stream.ts、src/acp-status.ts——56 commits behind 与本改动域无语义冲突。

残余几何角(非阻塞):protectedClaimStart 原注释把保守性归因于 entry 跳过(「UNDER-counts…can only make us report more」);实际当 covered/zero-token 消息落在 recent window 内部时,entry 空间的 last-N entries 覆盖 >N 条消息,估计会越过 naive zone 往更老处延伸,该角落偏向多静默(与注释声称方向相反)。波及面受窗内 covered 数有界,最坏退化为 pre-#5780 的静默少报,不会产生假「可折」声明。已当场修正注释(见下)。

与 #5311 协调核对:已取 #5311 head 验证——其静态 [not foldable] 前缀置于行首,本 PR 的 ⚠ 原因标记追加在括号内,文本可组合;语义上 #5311 的「true for every row」在「该行 verbatim 提交此刻必失败」解读下成立(当前可折的 span 已在 offer 中、不会进此列表),两者不矛盾;doomed 行上两标记重叠略冗余但无害。后合者带小 rebase,PR 正文已如实声明。

CI:head b0cd01e 上已完成 lane 全部 success(ubuntu 22×3、ubuntu 24×1、windows 22×2、static-gates windows 22),其余 in_progress,无红。注释修正 commit b1ae885 为纯注释变更,已推分支,新 CI run 会覆盖新 head。

顺手修(review fix,独立标注 commit b1ae885):修正 src/uncovered.ts protectedClaimStart 头注的偏差方向表述——原文归因错误(见上节),改为显式陈述两种偏差及其安全性论证(#2886 族扩展使估计位于真 zone 起点之后 → 报出+screen 打标;skip-in-window 角落偏向静默、有界)。零代码行为变化。

判定:可合并,待剩余 CI lane 绿即可由 owner 合并(agent 不代合)。

ci-check added 4 commits November 13, 2026 11:13
…eview)

The original header attributed the estimate's conservatism to entry-space
skipping ('UNDER-counts ... can only make us report more'). That mechanism
actually pushes the other way when covered/zero-token messages sit inside
the recent window: last-N entries span more than N messages, so the claim
reaches further back than the naive message-space zone and errs toward
silence in that band (bounded by the covered count in the window; degrades
to pre-#5780 behavior). State both biases explicitly: (1) #2886-family zone
extensions protect more than the count+anchor estimate, so it sits behind
the true zone start (doomed mass ahead of the zone is reported + screen-
labeled instead of vanishing); (2) the skip-in-window corner above errs
toward silence. Neither direction ever claims a span folds that apply
rejects. Comment-only; no code change.
…nt from the second repro

P2c: with the latest user message left uncovered, the kernel's user-anchor rule (Rule 3, coupled to preserveRecentMessages>0) protects only that message; the audit's relaxed diff pass zeroes the knob and is blind to the anchor (and token) components. Pins both sides: foldable mass past the anchor stays plain and folds cleanly, while the anchor-claimed user msg and the zoned tail are never advertised as if older than the window; a fully-zoned current turn stays silent.

P3: one session surfaces both verdict classes at once (a clean mid-history hole plus a doomed head glued to the zoned tail); sweeps EVERY reported run on isolated state copies asserting no unmarked+doomed combination exists.
…d window' when they sit inside its components

The acp_status UNCOVERED HISTORY header asserted every listed run was older than the protected recent window, which contradicts the apply verdict for runs claimed by the zone's other components (token rule, user-anchor rule, #2886 closure) — the exact contradiction of the second repro ('the advertised text and the verdict are opposite conclusions'). Wording now states what is true: outside the offered ranges, either older than the window or inside one of its components. Module header documents the empirical diff's structural blind spot for those components.
@ranxianglei
ranxianglei force-pushed the 2026-11-06_uncovered-foldability-screen branch from aaacc5b to 4a55be3 Compare November 13, 2026 03:16
…o-op

An isolated protected-tool run (e.g. a mid-history compress exchange far
from the recent window) hits the kernel's filter no-op — "all of its
content is protected or filtered" — not the zone no-op. The screen keyed
both soft no-ops to ZONE_NOTE, mislabeling the cause for the filter class.
Split them: FILTERED_NOTE for the content-filter no-op, ZONE_NOTE for the
zone no-op. P5 pins an isolated protected-tool run getting the filtered
marker and its verbatim filter no-op receipt.

@ranxianglei ranxianglei left a comment

Copy link
Copy Markdown
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

(ai: vllm-qwen/qwen3.8-27b)

Review: APPROVE (posted as comment — GitHub blocks approving my own PR). Correct fix, strong tests, zero kernel diff.

APPROVE — correct fix, strong tests, zero kernel diff.

What it does: screens each UNCOVERED HISTORY run through the apply-side foldability judgment (core.applyCompression on a structuredClone(state)), so the audit only advertises runs that will actually fold. Structural refusal (split fatal / zone no-op / filter no-op) → a marker; transient refusal (sub-gate, already-covered) → unmarked; screen failure → unmarked (advisory degrades, never blocks).

Verified:

  • Host-side only, public API — no kernel change.
  • Every kernel error/warning wording the regexes match is confirmed verbatim in kernel/src (unit-projection.ts:476/371/1071, compress.ts:1809/1893).
  • protectedClaimStart bias directions all safe (report-more or silence — never a false "folds" claim).
  • Test file: 10 tests, positive+negative pairs, real apply path, pins advertise↔execute agreement.

Small finding fixed on the spot: the screen keyed both soft no-ops to ZONE_NOTE, so an isolated protected-tool run (a mid-history compress exchange far from the recent window) was mislabeled "entirely inside the protected zone" when the true cause is the content filter. Split into FILTERED_NOTE / ZONE_NOTE + a P5 test pinning the isolated protected-tool run. 已顺手修 + commit b94e68d.

Targeted tests: tests/issue5780-uncovered-foldability.test.ts 10/10, tests/issue4331-uncovered-history.test.ts 10/10. Full-suite verdict = CI on the new head.

@ranxianglei

Copy link
Copy Markdown
Owner Author

🤖 Powered by ework · qwen3.8-27b

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

PR #5785 review complete — APPROVE (posted as a comment review; GitHub blocks approving my own PR). Review: #5785 (review)

What the PR does. The UNCOVERED HISTORY audit (the "these runs are foldable" advisory in the status/receipt) previously judged foldability by a cheap heuristic — span tokens ≥ 200 + not fully zone-claimed — which diverged from the kernel's real apply judgment. A run could pass the heuristic but be refused by the apply path (split a turn at the protected boundary, sit entirely inside the zone, or be entirely protected/filtered content), so a model following the hint hit a refusal/no-op and wasted a turn. The fix screens each run's EXACT span through core.applyCompression on a structuredClone(state) — the same public API the apply path uses — so the audit only advertises runs that will actually fold. Structural refusal (split fatal / zone no-op / filter no-op) → a marker; transient refusal (sub-gate, already-covered) → unmarked (self-teaching); screen failure → unmarked (advisory degrades, never blocks).

Verified. Host-side only, zero kernel diff. Every kernel error/warning wording the regexes match is confirmed verbatim in kernel/src (unit-projection.ts:476/371/1071, compress.ts:1809/1893). protectedClaimStart bias directions all safe (report-more or silence — never a false "folds" claim). Test file: 10 tests, positive+negative pairs, real apply path, pins advertise↔execute agreement. Targeted tests: tests/issue5780-uncovered-foldability.test.ts 10/10, tests/issue4331-uncovered-history.test.ts 10/10. Full-suite verdict = CI on the new head (running, 0 failed so far).

已顺手修:the screen keyed both soft no-ops to ZONE_NOTE, so an isolated protected-tool run (a mid-history compress exchange far from the recent window) was mislabeled "entirely inside the protected zone" when the true cause is the content filter. Split into FILTERED_NOTE / ZONE_NOTE + a P5 test pinning the isolated protected-tool run (and its verbatim filter no-op receipt). + commit b94e68d


八问

  1. 是什么问题:UNCOVERED HISTORY 提示("这些 run 可折叠"的 advisory)会推荐 apply 路径实际会拒绝的 run —— 模型照提示折叠时撞上一脸 refusal/no-op,浪费一轮。
  2. 什么原因导致的:audit 用廉价启发式(span tokens ≥ 200 + 未被 zone 全占)判断可折叠性,与 kernel 真实 apply 判定(还强制 turn 完整性、protected-tool 过滤、size gate、protected zone)分叉;run 能过启发式却在 apply 路径被拒。
  3. 影响范围与严重程度:显示 UNCOVERED HISTORY 提示的 plugin-mode 会话。严重度:体验瑕疵 / 特定条件下有问题 —— 模型照提示折叠时浪费一轮在 refusal 上;无数据丢失、无缓存泄露、不可用性不受影响(非 p1)。
  4. 怎么修复的:把每个 run 的精确 span 跑过 core.applyCompression(在 structuredClone(state) 上,与 apply 路径同一公共 API)。结构性拒绝(split fatal / zone no-op / filter no-op)→ 打标记;瞬态拒绝(sub-gate、已覆盖)→ 不标记(自教学);screen 失败 → 不标记(advisory 降级,绝不阻塞)。使 advertise↔execute 一致。
  5. 是否有回归问题:无。仅 host 侧(零 kernel diff)。无 note 的行字节稳定(标记只在设置时追加在括号内)。两个调用点(stream.ts:692、acp-status.ts:324)传同一 core/state/config/applyView。定向测试绿(issue5780 10/10、issue4331 10/10),全量套件 = CI 在新 head 上跑。
  6. 是否破坏缓存:否。audit 是 advisory(读 state,不写 wire 或 cache);screen 跑在 structuredClone(state) 上,不改活会话。
  7. 是否改了设计方向:否。把 audit 的可折叠性判定对齐到 apply 侧判定(单一投影原则,KDD refactor: reapOrphanBlocks should live in acp-kernel, not the proxy #12);不改压缩管线、wire、protected-zone 规则。
  8. 是否引入了新的配置:否。无新 config/env/CLI 面。

判定:可合并 —— 仅 host 侧、无 kernel 改动、定向测试绿。注:PR 落后 master 15 个 commit(243709bef2→99c22d283f,均为 notices/BILI_PLUGIN_BYPASS/docs),但无一触碰本 PR 文件(无语义冲突),trivial rebase 后即干净可合(或作 merge commit)。小发现(filter vs zone 标记)已当场修(commit b94e68d)。

@ranxianglei

Copy link
Copy Markdown
Owner Author

🤖 Powered by ework · qwen3.8-27b

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

PR #5785 review complete — APPROVE / 可合并. (Full 8问 + verification detail on floor 11.)

  • Verdict: APPROVE. Host-side only, zero kernel diff → no 🔶需要决策 gate; I may approve (posted as a comment review — GitHub blocks approving my own PR). Review: [PR] fix(#5780): screen UNCOVERED HISTORY runs through the apply-side foldability judgment #5785 (review)
  • Small finding fixed on the spot: the screen keyed both soft no-ops to ZONE_NOTE, so an isolated protected-tool run (mid-history compress exchange, far from the zone) was mislabeled "entirely inside the protected zone" when the true cause is the content filter. Split into FILTERED_NOTE / ZONE_NOTE + a P5 test pinning the isolated protected-tool run and its verbatim filter no-op receipt. 已顺手修 + commit b94e68d (pushed to the PR branch).
  • Tests: targeted suites green — tests/issue5780-uncovered-foldability.test.ts 10/10, tests/issue4331-uncovered-history.test.ts 10/10. Full-suite verdict = CI on the new head b94e68dbe4 (running, 0 failed so far).
  • Base note: PR is behind master by 15 commits (243709bef2→99c22d283f, all notices/BILI_PLUGIN_BYPASS/docs) — none touch this PR's files, so no semantic conflict; cleanly mergeable after a trivial rebase (or as a merge commit).

判定:可合并 —— 仅 host 侧、无 kernel 改动、定向测试绿;小发现已当场修(commit b94e68d)。agent 不代合,待 owner 合并。

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

1 participant