Skip to content

[PR] fix: in external-summary mode, #2749 guard scan no longer falsely reports rejected logs for historical compress calls (# | fix: external-summary 模式下 #2749 守卫扫描不再对历史 compress 调用误报 rejected 日志 (#5161) - #5227

Merged
ranxianglei merged 4 commits into
masterfrom
2026-10-30_external-summary-scan-log-noise
Oct 31, 2026

Conversation

@ranxianglei

Copy link
Copy Markdown
Owner

修什么

#5161:external-summary 模式下,每次 compress 都会重解析所有可见的历史 compress 调用(#2749 守卫扫描 visibleSummaryStubs,src/stream.ts),每个无 summary 的条目被 parseCompressInput 打一条 [acp-compress-input] rejected(reason=missing summary)warn。external 模式下模型的调用本来就不带 summary(advertised schema 把 summary 移出 required,src/external-summary-surface.ts:124;live 路径先经 withOptionalSummaries 补占位再解析),所以每 fold 一次 = 按「可见无 summary 调用数」各打一条误报,随会话变长 bursts 增长(报告实测 ~553 行/天、39 个 burst、每小时 70→97→122→169)。无任何 compress 真正失败——纯日志噪音 + O(可见调用数) 的重复解析。

修法

parseCompressInput 增加可选第三参 options: { quiet?: boolean }:quiet 时抑制该次解析的全部诊断日志(rejected / partial / 三类 salvage),解析结果与 salvage 行为完全不变。仅 #2749 扫描处(src/stream.ts visibleSummaryStubs)传 {quiet:true};其余 8 个 live 路径调用点保持原行为逐字节不变——真畸形 live 调用照常报警。

未取备选方案(扫描侧套用 withOptionalSummaries 归一化):会引入 stream ↔ external-summary-compress 循环导入,且改变解析语义(占位 summary 变成合法 range),比静默更侵入。

行为变更披露(old → new)

  • 日志输出:external-summary 模式下,每 fold 的 N 条(N = 可见无 summary 历史调用数)假 [acp-compress-input] rejected … missing summary warn → 0 条。live 路径日志不变。
  • wire 格式 / 会话状态 / 配置面 / [严重]t2压缩被截断为200字 #2749 守卫判定:全部不变——无 summary 条目产不出 range,进不了 stub 集合,守卫结果与修复前一致。
  • 未新增任何配置项/env/默认值。

测试

新 tests/issue5161-compress-scan-log-noise.test.ts(3 测,#3617 双向门禁):

  1. issue 验收标准:N=3 个可见无 summary 调用 + 1 次新 compress → 零条 [acp-compress-input] 日志,且新 fold 成功;
  2. 反方向:真·无 summary 的 LIVE 调用仍恰好打一条 rejected warn(防修过头把真实拒绝吞掉);
  3. quiet 扫描仍正常解析:stub 形状(200 字符+省略号)summary 照常收集,无 summary 条目不贡献任何东西。

测试有牙验证:临时还原修复后第 1、3 测红,恢复后绿。
本地定向:本文件 + tests/stub-resubmission-guard.test.ts(8/8)+ basic / proxy-basic / issue1494-compress-params / issue1495-partial-compress-drop / compress-reject-reasons / external-summary-runtime(合计 96/96);typecheck + build 绿。全量回归以 CI 为准。

查重: 无(open+closed issue/PR 均无覆盖此日志噪音的条目;与 #2749 同代码路径但不同缺陷——#2749 是守卫机制本身)。

Closes #5161

@github-actions

github-actions Bot commented Oct 30, 2026 •

Copy link
Copy Markdown
Contributor

📦 Built Package Artifact

Branch: 2026-10-30_external-summary-scan-log-noise (6ae12c4)

Latest build — install this exact version

npm install -g billion-context@0.0.7413-pr.5227.ea76e2f

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
6ae12c4 billion-context@0.0.7413-pr.5227.ea76e2f build
034b153 billion-context@0.0.7170-pr.5227.0e9f0e3 build
7b4f062 billion-context@0.0.7058-pr.5227.b152ad7 build

Download artifact

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

Install instructions are refreshed on each push.

@ranxianglei ranxianglei changed the title fix: external-summary 模式下 #2749 守卫扫描不再对历史 compress 调用误报 rejected 日志 (#5161) [PR] fix: external-summary 模式下 #2749 守卫扫描不再对历史 compress 调用误报 rejected 日志 (#5161) Oct 30, 2026
ci-sync added 2 commits October 30, 2026 21:48
… under the global legacy test baseline its sidecar never opens and the index reconstruction gate can never pass
@ranxianglei

Copy link
Copy Markdown
Owner Author

🤖 Powered by ework · qwen3.8-27b

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

查重:不重复。 open+closed 均无覆盖此「守卫扫描重复解析打误报」的条目;与 #2749 同代码路径但缺陷不同——#2749 是守卫机制本身(拦 stub 重提交),#5161 是该守卫每次 fold 重解析历史调用时把「external 模式合法的无 summary 调用」当畸形打 warn。

标签: bug + p3 + scope/wiring(日志噪音缺陷,宿主压缩管道内、非 kernel/;external-summary 模式对应客户端判不准,不瞎猜)。

审核方式: 拉到 PR 分支(pr-5227,head 034b153)逐行读 diff;本地定向跑了新测试 + 受影响套件,并做了「还原修复→变红」的有牙验证;全量回归以 CI 为准(当前 14 queued / 3 success / 0 failure,仍在跑)。

结构化八问

  1. 是什么问题:external-summary 模式下模型自己的 compress 调用本就不带 summary(schema 已把 summary 移出 required)。[严重]t2压缩被截断为200字 #2749 守卫每次 fold 都要重解析所有可见的历史 compress 调用来重建 stub 集合,每碰到一个「无 summary」条目就打一条 rejected … missing summary warn——纯日志噪音,且随会话变长按可见调用数线性增长(报告实测 ~553 行/天、每小时 70→97→122→169)。没有任何 compress 真正失败。

  2. 什么原因导致的:根因是「解析」与「扫描」职责混用——parseCompressInput 既解析又打诊断日志。live 路径上打日志是对的(真畸形要报警);但 [严重]t2压缩被截断为200字 #2749 扫描只是 bookkeeping,它只需要能解析出的 summary,却复用了同一个会打日志的入口,把 expected 的「无 summary」也当异常报了。

  3. 影响范围与严重程度:仅 external-summary 模式的日志面 + 每次 fold O(可见调用数) 的重复解析开销。功能零影响(守卫判定、wire、会话状态都不变)。严重度 p3(体验瑕疵/日志噪音)。

  4. 怎么修复的:给 parseCompressInput 加可选第三参 {quiet?:boolean},quiet 时用本地 note() 助手抑制该次解析的全部诊断日志(rejected/partial/三类 salvage),解析结果与 salvage 行为逐字节不变。只在 [严重]t2压缩被截断为200字 #2749 扫描处传 {quiet:true};其余 8 个 live 调用点保持原样(默认参 {})——真畸形 live 调用照常报警。未取「扫描侧套用 withOptionalSummaries 归一化」备选:它会引入 stream↔external-summary-compress 循环导入且改变解析语义(占位 summary 变成合法 range),比静默更侵入。

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

    • 守卫判定结果:不变。 我读了 visibleSummaryStubs(src/stream.ts)——它只消费 parsed.ranges[].summary,从不读 parsed.diagnostics;无 summary 条目产不出 range、进不了 stub 集合,所以静默日志对守卫输出零影响。
    • live 路径报警:不变。 8 个 live 调用点(external-summary-compress×2 / loop/core / preflight×2 / stream-openai / stream-responses / stream.ts:50)都传 ≤2 参 → 默认 {} → quiet=undefined → 照常打日志(T2 钉住:live 无 summary 恰一条 rejected)。
    • 高危模式逐项: 无阈值/时序/默认值漂移;无 fail-fast 变吞错(解析仍正常返回,只是不打日志);wire/输出格式不变。
    • 与 master 新合入的 [PR] fix: keep ordering-repair separators out of compression range analysis #5143(turn-separator-range-endpoints)无交互: [PR] fix: keep ordering-repair separators out of compression range analysis #5143 改的是 postCompressTail(line ~588)+ import(line 2),本 PR 只动 visibleSummaryStubs(line ~809),hunk 不相交;作者已 merge 最新 master(head 的 merge-base = 当前 master 44067a5bc),stream.ts 相对当前 master 只剩那 6 行 quiet 改动。
  6. 是否破坏缓存: 不涉及。缓存命中/重试/增量游标/去重键均未触碰。

  7. 是否改了设计方向: 不涉及。仍是同一守卫机制,只是给内部扫描开了个静默开关。

  8. 是否引入了新的配置: 不涉及。无新 env/config/默认值;{quiet} 是函数内部参数,不是配置面。

测试有效性(#3617 双向门禁): 3 测都有牙——T1(issue 验收:N=3 可见无 summary + 1 次新 fold → 零 [acp-compress-input] 行且 fold 成功)、T2(负向:live 真·无 summary 恰一条 rejected,防修过头)、T3(quiet 扫描仍正常收集 stub 形状 summary、无 summary 不贡献任何东西)。我本地独立复现了「有牙」: 临时去掉 {quiet:true} 后 T1/T3 红、T2 仍绿,恢复后 3/3 绿;受影响套件 stub-resubmission-guard + compress-reject-reasons + external-summary-runtime 共 35/35 绿。

一处需你知晓(非阻塞): head 里多了一个 ci-sync 标注的独立 commit 034b153——把 tests/plugin-fork.test.ts 的 #5140 cold-restore 用例在该单测内切到 BILI_STORAGE_UNIFIED="full"(finally 正确还原旧值),原因是全局 legacy 测试基线下该用例 sidecar 永不打开、重建门永不过。这是 merge 最新 master 后对齐测试环境的小修,断言逻辑没动、有独立标注,可接受;若你认为该 pin 应归 ci-fixes 而非本 PR,说一声即可。

判定: 方向对、修法最小且行为保持、测试有牙、已与最新 master 同步、未发现回归。建议 CI 全绿后可合(我不合并,PR 合并仅人工)。

@ranxianglei

Copy link
Copy Markdown
Owner Author

🤖 Powered by ework · qwen3.8-27b

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

收工小结(完整八问审核见上一条):PR #5227(修 #5161 external-summary 守卫扫描日志噪音)已审完,可合。

CI:当前 0 failed / 14 pending,test 矩阵仍在排队(gate×2 + pi-subagents-guard 已绿)。等 test 全绿即可合;我不合并(PR 合并仅人工)。若 test 红了我会定向排查是否本 PR 自身代码问题。

@ranxianglei ranxianglei changed the title [PR] fix: external-summary 模式下 #2749 守卫扫描不再对历史 compress 调用误报 rejected 日志 (#5161) [PR] fix: in external-summary mode, #2749 guard scan no longer falsely reports rejected logs for historical compress calls (# | fix: external-summary 模式下 #2749 守卫扫描不再对历史 compress 调用误报 rejected 日志 (#5161) Oct 31, 2026
@ranxianglei

Copy link
Copy Markdown
Owner Author

(ai: sglang-gpu0/qwen3.8-27b)

Merged current master into this branch (6ae12c4) — the only conflicts were two cosmetic hunks in tests/plugin-fork.test.ts (a comment wording + an if/else formatting difference around the inherited #5140 cold-restore test), resolved keeping this branch's phrasing. No content was changed by the merge itself.

Targeted local runs on the merged head are green: tests/issue5161-compress-scan-log-noise.test.ts 3/3 and tests/plugin-fork.test.ts 56/56 (the inherited #5140 regression from master). Re-run is queued behind the repo's CI backlog; the branch should now report clean once it finishes.

@ranxianglei

Copy link
Copy Markdown
Owner Author

🤖 Powered by ework · qwen3.8-27b

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

merge-guard 复核完成 — 对合并后 head(6ae12c49,分支 2026-10-30_external-summary-scan-log-noise)做了独立核验,结论:合并干净、修复完整、可直合当前 master,等这轮 CI。

逐项核验结果:

  1. 合并完整性:head = 分支侧 034b153 × master 侧 e193861(合并时的 master tip)。核心修复在 head 上完好——src/stream.ts:848 的 {quiet:true} 调用点(仅此一 hunk)+ src/compress-tool.ts 的 3 个 hunk(全部在 parseCompressInput 内:签名加 options、note() 助手、5 处日志改道)。无内容丢失。
  2. 冲突解决零残留:tests/plugin-fork.test.ts 在 head 上与当前 master 逐字节相同——两处 cosmetic 冲突解完后没有留下分支侧独有措辞,也没有重复测试块。
  3. 有效 diff 收敛到预期 3 文件:相对当前 master,本 PR 实际贡献 = src/compress-tool.ts(quiet 开关)+ src/stream.ts(quiet 调用点)+ 新测试 tests/issue5161-compress-scan-log-noise.test.ts(139 行)。其余 diff 项全是 master 在合并之后又前进的部分([PR] fix(loop): a failed compress must not kill the task — feed the model a recovery receipt instead of ending the turn #5231、[PR] Two installations differing by one version no longer deadlock on the same port; traffic is no longer sent in the clear ( | 两份安装差一个版本不再死锁在同一端口上,流量不再裸奔(#4125) #5303),不是本分支的内容。
  4. 与最新 master 仍可无冲突合并:master 已前进到 71d2494(合入 [PR] fix(loop): a failed compress must not kill the task — feed the model a recovery receipt instead of ending the turn #5231 failed-compress-receipt-retry、[PR] Two installations differing by one version no longer deadlock on the same port; traffic is no longer sent in the clear ( | 两份安装差一个版本不再死锁在同一端口上,流量不再裸奔(#4125) #5303 upward-adoption 等),git merge-tree 实测 clean,零冲突——GitHub 侧可以直接 merge,不需要再补一轮 merge。
  5. 一个值得注意的收敛:master 侧 [PR] fix(loop): a failed compress must not kill the task — feed the model a recovery receipt instead of ending the turn #5231 恰好带进了 ce27617ca——与本分支 034b153 同消息同内容的 [Bug][fork] Cold restore cannot use an intact unified raw tail for a non-retained parent (#4266 item 4) #5140 cold-restore 用例 unified-full pin(floors 7–10 那批 Windows 红大概率就是这个未 pin 的用例所致,ci-worker 当时在本分支修了它,[PR] fix(loop): a failed compress must not kill the task — feed the model a recovery receipt instead of ending the turn #5231 会话在自己分支独立修了同一处)。现在两侧字节一致,该疑点在新 head 上结构性消失。
  6. CI 现状(镜像缓存):新 head 上 23 项全部 queued / 0 failed,即上一条说的 backlog 排队重跑已在队列里。之前那批 Windows 红是合并前 head 的结果,以本轮为准。

判定:无需任何进一步动作。 等这轮 CI 出结果:全绿即可合(PR 合并仅人工);若再红,按 CI 总控流程先看 #4599 判继承性还是本 PR 自身问题。

@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.

审查完成(本地分支 @6ae12c49,已核对 src 全量 diff + 调用点面 + 回归批)。结论:代码通过,无阻塞项;CI 全绿即可人工合并。

逐项核验:

  1. 修法对症且最小(src/compress-tool.ts):parseCompressInput(input, callId?, options: { quiet?: boolean } = {}),单个 note() 助手包住全部五处诊断日志(double-escape salvage / quote-salvage / flat-summary salvage / rejected / partial)——没有只静默 rejected 而漏掉另外四个的偏科。返回值与 salvage 采纳逻辑零改动,quiet 只影响是否打日志。✓
  2. 只有一个 quiet 调用点:src/stream.ts visibleSummaryStubs(#2749 扫描)。核对了全仓 parseCompressInput 的其余 8 个调用点——live 工具路径(loop/core.ts、stream-openai/responses、stream.ts:51)、preflight 合成输入(恒带 summary,不会 reject)、external-summary-compress live 路径(走 withOptionalSummaries 归一化)——全部保持原样告警,无修过头也无漏网。✓
  3. 备选方案放弃理由成立:body 说明扫描侧套 withOptionalSummaries 会引入 stream↔external-summary-compress 循环导入、且占位 summary 会让条目变成合法 range 污染 stub 收集。quiet 参数是更窄的正解。✓
  4. #2749 守卫判定不受影响:无 summary 条目解析出 0 range,永远进不了 stub 集——静默只是消音,不是放行。✓
  5. 测试双向门禁到位(tests/issue5161-compress-scan-log-noise.test.ts,#3617 纪律):正向=3 个 visible 无 summary 历史调用+1 次真实 fold ⇒ 零 [acp-compress-input] 行且 fold 成功;反向①=真 live 无 summary 调用仍恰好一条 rejected warn(含 "missing summary" 理由);反向②=quiet 扫描仍收割真 stub 形状(199+safety 字符带)且无 summary 条目不贡献。用 logger 的 setLogCapture 程序化接缝断言,不靠 mock fs/log file。✓
  6. plugin-fork.test.ts 改动(+5/-4)是分支同步 master 时对 #5140 测试注释/格式的冲突解决(修正 legacy baseline 说明 + finally 单行化),非夹带行为变更。✓

非阻塞备注:

  • 分支落后 master 50 commit(body 称干净合过 e193861),GitHub 判 MERGEABLE;我核对了 merge-base..tip 期间 master 对这三个文件的后续触碰,与 visibleSummaryStubs / parseCompressInput 区域无语义重叠,不构成同步阻塞,CI 会自动带 master 跑。
  • 效果预期可复核:#5161 报告基线 ~553 行/天且随会话长度递增;此修复后该模式下的外部会话日志中 [acp-compress-input] rejected 应只出现在真正失败的 live 调用上。

本地验证(正式全量留给远程 CI,head 轮已入队,不盯):

  • 定向批 160/160 绿:issue5161 新套件 + stub-resubmission-guard + basic/proxy-basic + issue1494/issue1495 + compress-reject-reasons + external-summary-runtime + plugin-fork(即 body 列的全集)
  • tsc --noEmit exit 0
  • 无 kernel 改动、无配置/env 面变化 ⇒ 不触发 kernel-guard/version-guard ✓

@ranxianglei
ranxianglei merged commit f70055c into master Oct 31, 2026
41 of 51 checks passed
@github-actions

Copy link
Copy Markdown
Contributor

📦 Merged Build Published

This merge to master was published as 0.0.954-master.f70055c (rolling master tag).

npm install -g billion-context@0.0.954-master.f70055c  # 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.

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

Labels

bug Something isn't working p3 scope/wiring

Projects

None yet

1 participant