Skip to content

[PR] fix(plugin-render): keep the acp_summary carrier when a fold reaches the window tail - #4749

Open
ranxianglei wants to merge 6 commits into
masterfrom
2026-10-26_4732-plugin-render-tail-anchor
Open

ranxianglei wants to merge 6 commits into
masterfrom
2026-10-26_4732-plugin-render-tail-anchor

Conversation

@ranxianglei

Copy link
Copy Markdown
Owner

Closes #4732

What was wrong

POST /__bili/plugin/render (#4491 S4) suppressed a fold's covered rows (coveredSeqs.add) before locating its anchor position. When the fold's last covered row IS the window tail — the ordinary just-compressed state, no client anomaly needed — viewRows.findIndex((r) => r.seq > maxCover) returns -1 and the old code continued without pushing the anchor. Result: the whole fold vanished from the rendered prefix (rows suppressed AND no acp_summary carrier), while the response stayed ok:true and the log line still counted those rows into folded=N. Silent context loss for the model.

The old comment ("the fold extends past the requested window") described a benign scenario that cannot occur here: blockSeqs only contains seqs resolvable inside the window, so pos === -1 means exactly "fold reaches the window tail".

Fix

Mirror the sibling implementation src/server/snapshot-render.ts (at = d default + post-loop flush):

  • anchor position falls back to viewRows.length when no row sits past maxCover;
  • a flush after the merge loop consumes anchors at pos === viewRows.length (without it they would never be emitted).

Behavior change disclosure

Rendered prefix shape on the pluginLaneServerHistory lane (rollout 0% today): a fold reaching the window tail now renders its acp_summary carrier at the tail instead of nothing. No other lane or endpoint is touched; the mid-window anchor path is unchanged (pinned by the negative-direction regression test).

Verification

  • New regression test (tail fold at untilSeq = full view and = the cut exactly at the fold's last row) failed before the fix with carrier missing, passes after; negative-direction test (mid-window fold anchors as before) green both sides.
  • npm run typecheck clean, npm run build clean locally; full suite via CI.

…the window tail (#4732)

A fold whose last covered row is the window tail (the ordinary post-
compression state) hit pos === -1 and was skipped without pushing its
anchor, while its rows were already added to coveredSeqs — the rendered
prefix dropped the whole fold with ok:true. Land the anchor at the
window end (snapshot-render's default) and flush it after the merge
loop, which is where a pos === viewRows.length anchor can only be
consumed.
@ranxianglei ranxianglei changed the title fix(plugin-render): keep the acp_summary carrier when a fold reaches the window tail [PR] fix(plugin-render): keep the acp_summary carrier when a fold reaches the window tail Oct 25, 2026
@github-actions

github-actions Bot commented Oct 25, 2026 •

Copy link
Copy Markdown
Contributor

📦 Built Package Artifact

Branch: 2026-10-26_4732-plugin-render-tail-anchor (6d14e5b)

Latest build — install this exact version

npm install -g billion-context@0.0.9424-pr.4749.ea6b239

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
6d14e5b billion-context@0.0.9424-pr.4749.ea6b239 build
afe233e billion-context@0.0.5958-pr.4749.c2161bc build
9cd59c8 billion-context@0.0.5897-pr.4749.bc17d6a build
ffbef82 billion-context@0.0.5830-pr.4749.14da3a0 build
975fa57 billion-context@0.0.5783-pr.4749.cc43674 build
2ddccae billion-context@0.0.5773-pr.4749.612f5c2 build

Download artifact

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

Install instructions are refreshed on each push.

@ranxianglei

Copy link
Copy Markdown
Owner Author

🤖 Powered by ework · qwen3.8-27b

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

查重: 不重复 —— 本 PR 是 #4732 的修复 PR(一 issue 一 PR,合规)。检索发现 #4746「When block coverage ends exactly at the tail of the transcript, the anchor is lost」与 #4732 同症状同机制(plugin-render 尾部折叠丢 anchor),两者关系我会在审查中一并核实并说明处置。

标签: bug / scope/wiring / p2(渲染管道缺陷;该车道 rollout 0%、暂无用户可触达,故 p2;若 pluginLaneServerHistory 放量则升 p1——静默上下文丢失)。

初步结论:PR 分支 first-parent 历史干净——自有提交仅 1 个核心修复(2ddccaec9 fix(plugin-render)),其余 persist/blogfeed/plugin-fork/storage-proof 变更全部来自 ci-fixes 合并(#4599 协调政策要求的 master 级修复收敛),非本 PR 夹带。正在本地做定向验证(typecheck + 回归测试),完整八问审查随后给出。

@ranxianglei

Copy link
Copy Markdown
Owner Author

🤖 Powered by ework · qwen3.8-27b

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

PR #4749 审查结论(八问)

1. 是什么问题:plugin 车道历史渲染端点(POST /__bili/plugin/render,#4491 S4)在「折叠恰好覆盖到请求窗口最后一行」时,把整段折叠从渲染前缀里弄没了——被覆盖行全部抑制,却连 acp_summary 载体都不发,响应仍是 ok:true。模型静默丢失已压缩上下文。

2. 什么原因导致的:锚点定位 viewRows.findIndex((r) => r.seq > maxCover) 返回 -1 时旧代码直接 continue——抑制了行、丢了锚。而 blockSeqs 只含窗口内可解析的 seq,-1 恰好等价于「折叠到达窗口尾部」(压缩刚完成的普通态,不需要任何客户端异常)。原注释「fold extends past the requested window」描述了一个在此处不可能发生的场景。合并循环也没有尾部 flush,即使锚落在 pos === viewRows.length 也永远发不出去——两处缺陷叠加。

3. 影响范围与严重程度:仅 pluginLaneServerHistory 车道(当前 rollout 0%,暂无人可触达)= 潜在;该车道一放量即为数据丢失级(整段折叠静默消失于模型上下文)。严重度对齐存活 issue #4732 定 p1(数据丢失类按 2026-10-19 规则不降档)——我首条回复写的 p2 是误判,以此条为准。#4746 处置:已由前序审查标 duplicate of #4732(同症状+同机制+同根因,先来后到保留 #4732),判定合规,无需再动。

4. 怎么修复的:镜像兄弟实现 src/server/snapshot-render.ts:355-387 的既有模式——锚位置回退到 viewRows.length(窗口尾,与 D 车道 end-of-prefix 语义一致)+ 合并循环后加 while (ai < anchors.length) 尾部 flush。两车道从此对同一状态渲染出同形前缀,这正是设计意图。

5. 是否有回归问题(审过的既有行为逐项):

  • 窗口中部锚路径:不变——负向测试(折叠只覆盖首行,锚仍在 assistant 行之前)修复前后都绿,我本地双向复跑确认;
  • 降级路径(feature-off 404 / storage-unavailable / session-cold / row-unparsable 503):代码未触碰;
  • appliedSeq、日志 folded=N 语义:未触碰(且现在 folded=N 与渲染结果一致了);
  • 其他车道/端点:分支自有改动仅 src/plugin-render.ts 一个源文件,未触碰;
  • 多折叠混合定位:排序稳定、flush 只消费 pos === viewRows.length 的剩余锚(循环内所有更小 pos 必被消费),逻辑推演无漏;两活跃块不可能共享同一末行,双尾部锚属不可达场景,不单测;
  • 高危模式(语义漂移/fail-fast 变吞错/阈值时序漂移):无。
  • diff 整洁度:分支 first-parent 仅 1 个自有提交(2ddccaec9);其余 persist tokenSnapshot 重映射、blogfeed CRLF、plugin-fork 有界等待、storage-proof 重钉等 hunk 经 git 祖先关系核实全部来自 ci-fixes 合并(2026-10-24 CI 协调政策要求的哨兵收敛,本就要进 master),非夹带。

6. 是否破坏缓存:不涉及缓存失效机制。新载体只在「刚压完」的当轮出现在尾部;下一轮 untilSeq 越过折叠末行后锚自动回到中部位置——与 D 车道既有的折叠重付成本剖面完全一致,无新增缓存面。

7. 是否改了设计方向:否。纯缺陷修复,向既有 D 车道模式收敛,无架构/边界/数据流转向。

8. 是否引入新配置:否。无新 env/config/默认值。

本地定向验证证据(全量套件以 CI 为准):

  • npm run typecheck 干净;npm run build 干净(dist-import-annotations/dist-external OK,commit=ffbef8274);
  • tests/plugin-render-endpoint.test.ts 9/9 通过(PR head);
  • 修复前复现:把 src/plugin-render.ts 还原到 2ddccaec9^,新回归测试精确失败于 carrier missing(渲染输出只剩一条 user 消息、无尾部空载体块),负向测试仍绿——证明修复真实有效且中部路径未被扰动;
  • CI:head ffbef82 上 23 个 check 处于 queued,全量判定待 CI。

运维备注:镜像 API 打标签失败(POST .../labels 返回 500,repo/issues 端点 404),标签结论以本评论文字记录为准,请运维查一下镜像侧标签服务。

判定:可合——核心修复正确、最小、与 D 车道同构;行为变更已披露(尾部折叠:什么都不渲染 → 渲染 acp_summary 载体);回归双向钉住;CI 绿后即可由 owner 合并(合并权在人)。唯一前置提醒:pluginLaneServerHistory 灰度放量前必须已含此修复。

@ranxianglei

Copy link
Copy Markdown
Owner Author

🤖 Powered by ework · qwen3.8-27b

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

审查已完成,补充 CI 状态更新(完整八问结论见上一条回复):

CI 红 = 继承性失败,非本 PR 引入。 逐 job 拉取失败日志比对:本分支 4 个红分片的全部失败用例(master bb7c249 上同名同现,无一为本 PR 特有):

处置:ci-fixes 上的 plugin-fork 测试修复(1fa93735d)已由哨兵 help-merge sweep 并入本分支,新 head 9cd59c803,CI 重跑中;opencode-inline/storage 的 master 级红已在 #4599 留言跟进,待哨兵收敛。

判定维持:可合——核心修复与回归钉不变,CI 绿后由 owner 合并。

ci-check added 2 commits October 26, 2026 10:15
# Conflicts:
#	src/plugin-render.ts
#	tests/plugin-render-endpoint.test.ts
@ranxianglei

Copy link
Copy Markdown
Owner Author

🤖 Powered by ework · qwen3.8-27b

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

冲突已解决并推送(attempt 1/3):master 259cd87674 已合入 PR 分支,新 head 6d14e5b7cc(fast-forward 普通 push,未 force-push;push 前后均复核了远端 head 无并发变更)。

⚠️ 重要发现:本 PR 的核心修复已经在 master 上了。 合并时冲突分析发现,#4732 的同一修复已经经由 PR #4725(740c4e601f fix(render): keep the anchor when a fold covers the render window's tail)合入 master,且 master 随后还有同区域的参数上限重构(853cb9c8b6)。#4732 已 closed。因此解冲突后本 PR 对 master 的有效 diff 只剩回归测试(tests/plugin-render-endpoint.test.ts +71/-1):

冲突处置(2 个文件,各 2 个冲突块):

本地定向验证(全量以 CI 为准):npm run typecheck 干净;tests/plugin-render-endpoint.test.ts 10/10 通过(含移植的两个 #4732 测试,对 master 现网代码实测通过)。

CI 实况(镜像缓存,sha 6d14e5b7cc):30 项 check = 8 success / 11 skipped / 11 in_progress(test 分片跑着)/ 0 failed;mergeable_state 已从 dirty 变 blocked(冲突已消,blocked = 等必选 check 跑完),无红项需要本轮修。

八问:

  1. 是什么问题:PR 分支落后 master 2929 个提交、merge state dirty(同文件双方都改过);合并中另发现核心修复已被 [PR] chore: empty PR (no changes) #4725 先行合入。
  2. 什么原因导致的:PR 停在 2026-10-26,期间 master 合入了 [PR] chore: empty PR (no changes) #4725(同一 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 修复)+ 853cb9c8b6 重构,双方都改 src/plugin-render.ts 与 tests/plugin-render-endpoint.test.ts 的同一区域 → 文本冲突。
  3. 影响范围与严重程度:仅本 PR 的合并状态,无任何运行时行为影响;不修则 PR 永远无法合并。
  4. 怎么修复的:merge master 进 PR 分支(选 merge 不选 rebase:分支历史已含多个 ci-fixes merge 提交、仓库惯例即 merge master 进 PR 分支、且免 force-push 避免与并发工作抢分支);冲突按「修复已在上游 → 源文件取 master 版,测试取并集」解决。
  5. 是否有回归问题:无。src/plugin-render.ts 与 master 逐字节一致(零行为变更);测试文件纯增不删不改;高危模式(语义漂移/吞错/阈值时序)逐项过,均不涉及。
  6. 是否破坏缓存:不涉及。
  7. 是否改了设计方向:否。
  8. 是否引入新配置:否。

待 owner 拍板:修复本体已在 master(#4725 已合、#4732 已关),本 PR 现在只剩回归测试增量。合入(补上 master 缺失的 #4732 双向回归钉,有价值)还是关闭(视为已被 #4725 吸收),请 owner 定——关闭权在您,我不代关。CI 分片跑完后如有红项,本车道 attempt 2/3 继续处理。

@ranxianglei

Copy link
Copy Markdown
Owner Author

🤖 Powered by ework · qwen3.8-27b

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

本轮核实:「dirty」阻塞是过期信号,当前无冲突、无红项,未做任何 push。

live 验证(全部本 run 实测,非引用旧评论):

  1. GitHub 权威状态(单次 API 读取):PR mergeable: true,mergeable_state: behind——不是 dirty;head 仍是我上轮推的 6d14e5b7cc。
  2. 冲突探针:git merge-tree 把 PR 分支对当前 master dd0ef22aea 试合并 → 干净,零冲突。master 自 259cd87674 之后只进了日语文档(PR [PR] docs: add Japanese versions of repository documentation (#6072) #6076,纯 docs + 一行 ci.yml),与本 PR diff(仅 tests/plugin-render-endpoint.test.ts)零重叠。
  3. CI 全绿:镜像缓存停在 08:46(11 个分片 in_progress,已 25 分钟未刷新,判定为缓存滞后),故按政策做了单次 check-runs 读取(非轮询):48 项 = 36 success / 12 skipped / 0 failure,run 已完整跑完。

为何不 push:PR 处于 behind 而非 dirty——behind 不是合并阻塞,GitHub 合并时直接对最新 base 合成;此时再推(哪怕只合入 docs-only 的 master)只会作废刚跑完的绿 run 触发全量重跑,纯浪费。若下一轮镜像仍报 dirty,attempt 2/3 再把新 master 合进来。

八问:

  1. 是什么问题:系统转发「merge state: dirty」要求解冲突;核实后确认该信号过期,实际无冲突。
  2. 什么原因导致的:上轮(约 08:42)已把 master 合入并推送,PR 转为 behind/blocked;触发器读到的是合并前的旧 merge 状态,且镜像 check 缓存滞后 25 分钟。
  3. 影响范围与严重程度:无运行时影响;若误判为 dirty 强行 rebase 会白白重跑全量 CI。
  4. 怎么修复的:本轮无需修——live 三源交叉验证(GitHub API 状态 + merge-tree 试合并 + check-runs 实况)确认无冲突、CI 全绿,按「无决策依赖才有动作」原则停手不推。
  5. 是否有回归问题:不涉及(零代码改动,零 push)。
  6. 是否破坏缓存:不涉及。
  7. 是否改了设计方向:否。
  8. 是否引入新配置:否。

仍待 owner 拍板(上轮已报,状态不变):核心修复已经由 PR #4725 合入 master(#4732 已关),本 PR 现仅剩 #4732 回归测试增量,CI 已绿——合入(补回归钉)还是关闭(视为 #4725 已吸收),请定;关闭权在您,我不代关。

@ranxianglei

Copy link
Copy Markdown
Owner Author

🤖 Powered by ework · qwen3.8-27b

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

独立复审结论(专职 reviewer,非照抄前序):本 PR 现仅剩回归测试增量,我独立重做了全部验证,判定可合——且建议合入而非关闭(理由见第 4 问)。

独立验证证据(全部本轮实测,非引用旧评论):

  1. 有效 diff = 纯测试:git diff --stat origin/master...HEAD(三点,即 PR 对 merge-base 的真实贡献)只有 tests/plugin-render-endpoint.test.ts +71/-1;src/plugin-render.ts 与 master 逐字节一致(git diff 输出为空)。
  2. 修复本体已在 master:master src/plugin-render.ts:117(锚点回退 pos === -1 ? viewRows.length : pos)+ :131(尾部 flush while (ai < anchors.length))——即 [PR] chore: empty PR (no changes) #4725 合入的 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 修复,本 PR 源码侧无任何独有内容。
  3. 新测试有牙(本轮实测):我把 src/plugin-render.ts 临时还原成 bug 形态(锚点回退改回 if (pos === -1) continue; + 删尾部 flush)→ 测试 9(尾部折叠载体)精确失败、测试 10(中部锚负向)仍绿;还原后 10/10 全过。证明这两个测试真能钉住 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,不是恒真测试。
  4. master 缺这份覆盖:master 的 tests/plugin-render-endpoint.test.ts 只有 8 个测试,无一覆盖 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 尾部折叠载体(唯一的 acp_summary 命中是无关的 msgid 预留测试)。本 PR 恰好补上这两个 master 缺失的双向回归钉。
  5. 合并干净:git merge-tree 试合并 PR vs 当前 master dd0ef22aea → 干净零冲突;PR 处于 behind(master 此后只进了日语文档 [PR] docs: add Japanese versions of repository documentation (#6072) #6076),不阻塞合并。
  6. CI 全绿:镜像缓存滞后(00:46 快照早于 01:02 push),故按政策做单次 check-runs 读取:48 项 = 36 success / 12 skipped / 0 failed。

标签:bug / scope/wiring / p1(数据丢失类按 2026-10-19 规则不降档;rollout 0% 暂无人可触达,放量前必须已含此修复)。

八问:

  1. 是什么问题:plugin 车道历史渲染端点(POST /__bili/plugin/render)在「折叠恰好覆盖到请求窗口最后一行」时,整段折叠从渲染前缀里静默消失(覆盖行被抑制、acp_summary 载体也不发),模型丢失已压缩上下文。
  2. 什么原因导致的:锚点定位 findIndex(r => r.seq > maxCover) 返回 -1 时旧代码直接 continue(抑制了行、丢了锚),且合并循环无尾部 flush——两处缺陷叠加。-1 在此处恰好等价于「折叠到达窗口尾部」(压缩刚完成的普通态,无需客户端异常)。
  3. 影响范围与严重程度:仅 pluginLaneServerHistory 车道(当前 rollout 0%)= 潜在;该车道一放量即数据丢失级(整段折叠静默消失于模型上下文)。按数据丢失类规则定 p1。
  4. 怎么修复的:锚点位置回退到 viewRows.length(窗口尾)+ 合并循环后加尾部 flush——镜像兄弟实现 src/server/snapshot-render.ts 的既有模式。注意:修复本体已由 [PR] chore: empty PR (no changes) #4725 合入 master,本 PR 现只贡献回归测试。
  5. 是否有回归问题:无。源码与 master 逐字节一致(零行为变更);测试纯增不删不改;新测试双向钉住(尾部载体 + 中部锚不变),我实测 bug 形态下精确失败、修复形态下全过。
  6. 是否破坏缓存:不涉及。新载体只在「刚压完」当轮出现在尾部,下一轮 untilSeq 越过折叠末行后锚自动回中部,与 D 车道既有折叠重付剖面一致。
  7. 是否改了设计方向:否。纯缺陷修复 + 回归钉,向既有 D 车道模式收敛,无架构/边界/数据流转向。
  8. 是否引入新配置:否。无新 env/config/默认值。

待 owner 拍板:核心修复已在 master(#4725 已合、#4732 已关),本 PR 现仅剩 #4732 双向回归测试增量,CI 已绿、合并零冲突。我的独立判定:可合,且建议合入——master 目前有修复但没有防止复发的回归测试,本 PR 恰好补上这份缺失的钉(已实测有牙)。合入还是关闭(视为 #4725 已吸收),关闭权在您,我不代关。

@ranxianglei

Copy link
Copy Markdown
Owner Author

🤖 Powered by ework · qwen3.8-27b

[ework] CI fix verified green ✓

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

Labels

None yet

Projects

None yet

1 participant