Skip to content

[PR] feat: forbid unprompted/out-of-bounds compression (compress.requireNudge / requireRecommendation) - #5685

Merged
ranxianglei merged 12 commits into
masterfrom
2026-11-04_forbid-unprompted-compress
Nov 5, 2026
Merged

ranxianglei merged 12 commits into
masterfrom
2026-11-04_forbid-unprompted-compress

Conversation

@ranxianglei

Copy link
Copy Markdown
Owner

Closes #5683

Two opt-in policy gates for models that fold on their own (the qwen-27b case from the issue: unprompted compress calls all the time), plus web-panel toggles.

What

  • compress.requireNudge (bool, default off): a model-initiated compress call is refused with an error receipt unless a compression nudge actually reached the model this turn. Arm = post-gate delivery fact (round nudgeOutcome === "injected"; advisory, decide-directive and emergency injections all arm it). The arm persists across loop rounds of the same turn and dies with the next un-nudged turn — exactly the issue's 「注入这一轮直接压缩的放过」.
  • compress.requireRecommendation (bool, default off): every submitted range must stay within what bili currently recommends folding — the same live set nudge text / acp_status show (prepare-time offer when present, else live recompute; viable + dead-ref + minCompressRange filters). Judgment by COVERAGE not equality: subdividing a recommended span passes; refolds updating an active block are exempt (those refs never sit in fresh recommendation lists); a range escaping the set is refused whole, naming the offending span(s) and pointing at acp_status.

Both knobs merge global → provider → model per field like every other compress field (explicit false at a deeper level disables).

Enforcement design

One choke point: applyRanges in src/stream.ts is where EVERY lane's model-initiated compress call lands (proxy loop, OpenAI/Responses JSON wires, Anthropic proxy tools, and all native plugin lanes via /__bili/plugin/tool). The gates run there, before any kernel apply, so one enforcement covers every client and our refusal receipt deterministically wins over kernel-side rejections. bili's own overflow backstop folds ride the existing loopTracking:false discriminator and stay exempt — availability is unaffected even when the nudge channel itself is suppressed (self-heal D1 interaction documented in CONFIGURATION.md). Gate state is stamped per round in handle.ts from the prepare outcome into an in-memory session.transient field (src/unprompted-gate.ts); restart reads all-off until the first round re-stamps, which is safe because no tool call can reach applyRanges before its own round's prepare.

config surface

Two NEW boolean fields under the existing three-level compress hierarchy: requireNudge, requireRecommendation. No env vars (env discipline #2030). Neither existing mechanism expresses this: the injectTool/lane gates control whether bili OFFERS compression to the model, not what the model may DO with the tool once declared; per-provider/model scoping of a model-behavior policy only exists through the compress cascade. Considered and rejected: a lane-level kill switch (wrong layer — the tool surface must stay visible so nudges still work), an env var (policy belongs in config). Compat/migration: both default off ⇒ zero behavior change for every existing install; enabling is a pure addition; nothing to migrate.

behavior change disclosure

Default-off: no change for anyone who doesn't enable a knob. When enabled, the intended behavior change is precisely the feature: previously-honored unprompted/out-of-bounds model compress calls become refused error receipts (model-visible text names the knob and tells the model to continue without folding / consult acp_status). No threshold, timing, format or cache-key drift elsewhere.

Web panel

Two checkboxes on the compress card (en/zh labels + hints), hot-applied through the existing config PUT path (no restart); unchecked deletes the key so deeper-level settings re-surface.

Tests & verification

New tests/issue5683-forbid-unprompted-compress.test.ts: 16 tests covering parse/merge semantics, default-off success pin, timing gate (unarmed refusal / armed success / preflight-lane exemption / both-gates ordering), scope gate (in-offer + subdivision pass, outside + mixed-span atomic refusal naming spans, refold carve-out, empty-recommendation strict refusal), plugin-lane shape (live-recompute source, dead-ref span out of bounds). Local: typecheck clean, build clean (dist-external OK — no new deps), targeted suite + adjacent compress suites green (33 tests). Full-suite verdict = CI on this head.

No kernel changes (host-only fields); no new dependencies; docs updated in CONFIGURATION.md en/zh.

ework-agent and others added 6 commits November 4, 2026 02:07
…4599)

Master 9dc4c94 red on test (windows-latest, 22, 2) only: the two SSE
abort cells exhausted the 10s teardown poll (closed=0, ~11s each) while
the same code went green on ubuntu22/24 and windows24 shard-2 siblings
(pass durations 23-352ms).

The audit mandated by the constant's own note found no teardown hang:
relay.ts arms res.on('close') -> clientAbort.abort() synchronously with
no linger/backstop on this path, and no commit since d244fff touched
destroy/abort wiring. Residual latency is runner-side event-loop
starvation on loaded Windows runners (same family as the recorded 3s/6s
eras). Platform-scoped response: win32 doubles to 20s; every other
platform keeps the tight 10s gate so a genuine hang still fails fast.
#5428 made inline the pi lane default; this suite documents the spawn
contract (instance record + proxy origin, per-request stamps, the
shared-proxy delegate-child channel, /__bili/plugin/status over HTTP)
and was not updated with the flip. Under the inline default its
delegate-child stamp assertions get 0 stamped child requests (child
traffic reaches upstream unstamped, conv=null) and the /acp instance-
record assertion fails structurally. Pin BILI_PI_INLINE=0 for the whole
suite so the spawn-posture coverage stays deterministic; inline posture
is covered by tests/pi-inline-ws.test.ts / tests/pi-native.test.ts.
…40s raise (#4599)

Run 41776902208 flaked openai-sse at the 20s win32 budget (closed=0 after 20.5s; siblings 131-410ms in the same run). The flat-raise ladder (3s->6s->10s->20s->40s in 850eca9) measures the runner, not the teardown: the poller shares ONE event loop with whatever starves it, so a close event cannot arrive faster than the loop itself. Keep the win32 base at 20s and extend the window by the poll's own measured event-loop lag, capped at 2xbase (<=40s - the same worst-case ceiling as the flat raise, applied only when lag is actually observed; healthy-loop gate byte-for-byte unchanged so a genuine hang still fails fast). Arithmetic pinned by a regression test.
@ranxianglei ranxianglei changed the title feat: forbid unprompted/out-of-bounds compression (compress.requireNudge / requireRecommendation) [PR] feat: forbid unprompted/out-of-bounds compression (compress.requireNudge / requireRecommendation) Nov 4, 2026
@ranxianglei

Copy link
Copy Markdown
Owner Author

🤖 Powered by ework · qwen3.8-27b

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

查重: 不重复 —— 检索了 open/closed issue 与 PR,没有其他条目覆盖同一「模型主动压缩策略门」;相关条目只有来源需求 #5683(qwen-27b unprompted compress case)。
标签: scope/wiring、p3(opt-in 功能,默认关,不启用零行为变化)。

收到 PR 线程(#5685,Closes #5683)。初步状态:

  • PR open,head 18183be66,但 mergeable_state=dirty:分支基线是 2026-10-28 的 master(5594c13),现落后 806 个提交,src/stream.ts / src/server/handle.ts / src/config.ts 等热文件在 master 侧都有大量变更;
  • 该 head 上还没有任何 CI run(check-runs=0),无全局判定可用;
  • 接下来:① 完整 diff 审查 → ② rebase 到当前 master 解决冲突 → ③ 本地 typecheck/build + 定向测试 → ④ push 后以 CI 为全量判定。完成后按八问体例报结论。

ci-check added 2 commits November 4, 2026 23:44
Two opt-in compress policy gates for models that fold on their own
(e.g. qwen 27b), configurable globally / per provider / per model and
toggleable from the web panel compress card:

- compress.requireNudge: a model-initiated compress call is refused with
  an error receipt unless a compression nudge actually reached the model
  this turn (post-gate delivery fact: round nudgeOutcome "injected").
  The arm persists across loop rounds of the same turn and dies with the
  next un-nudged turn; stamped per round from the prepare outcome.
- compress.requireRecommendation: every submitted range must stay within
  what bili currently recommends folding (prepare-time offer when present,
  else live recompute; viable + dead-ref + minCompressRange filters).
  Judgment by coverage, not equality: subdividing a recommended span
  passes; refolds updating an active block are exempt; a range escaping
  the set is refused whole, naming the offending span(s).

Both gates run in applyRanges — the single choke point every lane's
model-initiated compress call funnels through (proxy loop, JSON wires,
anthropic proxy tools, and all native plugin lanes via /__bili/plugin/tool)
— so one enforcement covers every client. bili's own overflow backstop
folds ride loopTracking:false and stay exempt: availability unaffected.
Default off; no env vars; host-only fields (kernel untouched).
#5683)

16 tests: parse/merge semantics of both knobs (deepest-wins, explicit-false
disables, non-boolean rejected), default-off success pin, timing gate
(unarmed refusal / armed success / preflight-lane exemption / both-gates
ordering), scope gate (in-offer + subdivision pass, outside + mixed-span
refusal naming spans atomically, refold carve-out, empty-recommendation
strict refusal), and the plugin-lane shape (no prepare snapshot: live
recompute source, dead-ref span out of bounds).
@ranxianglei
ranxianglei force-pushed the 2026-11-04_forbid-unprompted-compress branch from 18183be to f392749 Compare November 4, 2026 15:45
@github-actions

github-actions Bot commented Nov 4, 2026 •

Copy link
Copy Markdown
Contributor

📦 Built Package Artifact

Branch: 2026-11-04_forbid-unprompted-compress (c42120f)

Latest build — install this exact version

npm install -g billion-context@0.0.8175-pr.5685.230395b

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
c42120f billion-context@0.0.8175-pr.5685.230395b build
6f38517 billion-context@0.0.8166-pr.5685.b057a52 build
bbe8cea billion-context@0.0.8160-pr.5685.cbfc19a build
f392749 billion-context@0.0.8157-pr.5685.25a7c59 build

Download artifact

  1. Download the artifact from the Actions run
  2. Extract the tarball and install:
tar xzf billion-context-pr5685.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

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

冲突已解决并推送。rebase 到当前 master(c9ba485),force-push 后 PR #5685 的 mergeable 已翻为 true,当前状态 blocked = 等新一轮 CI 跑完(推送时镜像缓存里还没有新 run 的记录,CI 红了我这个 bot 接着修)。

结构化八问

  1. 是什么问题:PR [PR] feat: forbid unprompted/out-of-bounds compression (compress.requireNudge / requireRecommendation) #5685(禁止未提示/越界压缩两个开关)的分支停在旧 master 上,而 master 之后大改了几乎整个 src/,分支和目标分支在同一批文件里撞出文本冲突(merge state: dirty),PR 完全没法合。
  2. 什么原因导致的:分支基于旧基线 5594c13;此后 master 合入了多个与本 PR 改同一区域的变更(In pi, Esc triggers compression injection. | pi中esc会触发压缩注入 #5293 会话字段、compressAtFoldPoint 折叠点特性、handle.ts 导入重构等),双方在同一位置各自新增代码 → 6 个文件文本冲突:src/config.ts、src/server/handle.ts、src/session.ts、src/stream.ts、src/web/client.ts、src/web/i18n.ts。
  3. 影响范围与严重程度:只影响本 PR 的可合并性(此前完全无法合并);不涉及任何已发布行为或用户面。
  4. 怎么修复的:把分支两个 commit(feat + test)rebase 到 c9ba485,冲突全部按「双方意图取并集」解——两边新增的都是互相独立的功能,谁都不删:config.ts 保留两套布尔解析循环;session.ts / i18n.ts / client.ts 保留双方各自的字段、文案和面板行;stream.ts / handle.ts 导入行取并集。另修了一处自动合并会埋的雷:handle.ts 的 config.js 导入块在冲突块里丢了 master 侧的 resolveModelEntry(第 755 行在用,丢了直接编译失败),已补回。随后把 PR 核心逻辑与 master 新签名逐项语义核对过:compressResult 的 reason 参数、nudgeOutcome === "injected" 字面量、liveCompressionRanges(RewriteCtx) 结构兼容、kernel 的 CompressibleRange 导出、Session.transient 落点——全部对得上,applyRanges 内两处 gate 的插入位置与 master 重构后的流程一致(gate 关时逐字节等价旧路径)。
  5. 是否有回归问题:无行为改动——rebase 只是把原 commit 原样搬到新基线,没有增删改任何逻辑行。本地定向验证:typecheck 干净;PR 自带回归套件 16/16 过;我触碰过的配置解析相关套件(compress-settings + compress-at-fold-point)49/49 过。全量回归交给远程 CI。
  6. 是否破坏缓存:不涉及(未触碰任何缓存/重试/游标/去重逻辑)。
  7. 是否改了设计方向:不涉及。
  8. 是否引入了新的配置:本次 rebase 本身没有引入;PR 自身内容含两个 opt-in 字段 compress.requireNudge / compress.requireRecommendation(默认关、无 env、global/provider/model 三级 + web 面板压缩卡片可切)——这是 PR 的功能本体,列出供可见。

收工判定:冲突阻塞已清除(mergeable=true),无需要决策的事项;等新一轮 CI 结果,红了由我继续跟。

ci-check added 2 commits November 4, 2026 23:55
…the #5683 scope gate (agent review cleanup, PR #5685)

The scope-gate if/else was inserted between the #4797 translation check and
its else branch, hijacking it: 'else { ranges = supersededRes.translatedRanges }'
now pairs with the gate test instead of the translation count. Behavior stayed
byte-identical only because supersededRefRejection returns a full identity
copy even when nothing was translated, but the surviving else reads as dead
logic and will mislead the next editor. Restore the pre-PR shape: adopt the
translated list unconditionally (master's original assigned in both branches),
keep the log-only check, drop the misleading else.
…erate artifacts (agent review fix, PR #5685)

The feature hand-edited the generated param-ref block in CONFIGURATION.md /
CONFIGURATION.zh-CN.md without touching the declared single source of truth
(website/config-reference/compress.yaml, #2107), which reds two CI jobs:
docs-sync (regenerate-then-diff over CONFIGURATION*.md, website/main.js,
website/docs/index.html) and config-surface-guard (#2643: every nested leaf
field needs a seed key entry). Add the two seed entries with desc text
identical to the merged table rows — regeneration now reproduces the
committed md byte-for-byte (verified: zero drift) — plus the website
main.js site-dict keys and docs table rows the generator owns.
@ranxianglei

Copy link
Copy Markdown
Owner Author

🤖 Powered by ework · qwen3.8-27b

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

进度更新——审查完成,两个修复已推送到 PR 分支(bbe8ceaa4),等 CI。

审查期间发现分支被重写为 f39274937(已 rebase 到当前 master c9ba485 之上,behind 0)——我此前做的 rebase 作废丢弃,改为在作者新历史之上追加两个标注 commit(保留原作者提交):

  1. 9c5e1ec73 refactor(清理):applyRanges 里 Provide a non-intrusive feature to disable compression, and allow web-based configuration. | 提供非注入禁止压缩功能,并允许web配置 #5683 scope gate 的 if/else 插在了 After the agent restarts, this session can no longer be compressed: the ref suggested by acp_status is flagged as "renum | 代理重启后该会话再也压不了缩:acp_status 建议的 ref 被 compress 判为「已重编号」,两面对 ref 的认知不一致 #4797 superseded-translated 赋值与其 else 之间,把那个 else 劫持了——else { ranges = supersededRes.translatedRanges } 现在配的是 gate 判断而不是翻译计数。行为因 supersededRefRejection 恒返回全量 identity 拷贝而保持逐字节等价(非回归),但残留的 else 读起来像死逻辑、会误导下一个编辑者。已恢复 PR 前形态:无条件先赋 translatedRanges(master 原本两个分支都赋),log-only 检查保留,误导性 else 删除。
  2. bbe8ceaa4 docs(修 CI 红):特性手改了 CONFIGURATION.md/zh-CN 里生成区域的表格行,但没动声明的唯一事实源 website/config-reference/compress.yaml([docs][website] 配置文档单一事实源:从声明式 schema 生成 CONFIGURATION.md 与网站 /docs/(一步到位) #2107)——这会让两个 CI job 必红:docs-sync(generate-then-diff)和 config-surface-guard(对现有配置文件的形态进行盘查,需要增加特殊ci专门屏蔽违规添加的配置 #2643:每个嵌套叶子字段必须有 seed key 条目)。已补两条 seed 条目(desc 与合并后的表格行逐字一致),重新生成后验证 md 零漂移(生成器复现了提交的 md 字节级一致 ⇒ docs-sync 必绿),main.js/docs/index.html 同步更新。

本地验证(最终树 bbe8cea):typecheck 干净、build OK、定向测试 89/89 通过(issue5683 套件 16 个 + compress-reject-reasons / compress-settings / config-surface-guard / fix-1124 / compress-fingerprint-refold)。PR 内容本身审查结论:方向正确、单一咽喉点、双模式推理到位、gate 双向纪律(#3617)齐全、16 测试套件扎实。CI 结果出来给八问终回复。

@ranxianglei

Copy link
Copy Markdown
Owner Author

🤖 Powered by ework · qwen3.8-27b

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

两个红 gate(config-surface-guard、docs-sync)的修复已经在分支上了——我诊断并独立做完修复的过程中,另一个 review-fix bot 把同样的修复推上来了;按查重纪律我弃掉了自己的重复 commit,改为对它的树做独立验证,全部绿。本轮我没有推任何新提交。

结构化八问

  1. 是什么问题:PR [PR] feat: forbid unprompted/out-of-bounds compression (compress.requireNudge / requireRecommendation) #5685 的两个 CI gate 红:config-surface-guard(对现有配置文件的形态进行盘查,需要增加特殊ci专门屏蔽违规添加的配置 #2643)和 docs-sync([docs][website] 配置文档单一事实源:从声明式 schema 生成 CONFIGURATION.md 与网站 /docs/(一步到位) #2107)。
  2. 什么原因导致的:本 PR 新增的 compress.requireNudge / compress.requireRecommendation 两个字段被手写进了 CONFIGURATION.md / .zh-CN.md 的参数表,但参数表的单一事实来源 website/config-reference/compress.yaml([docs][website] 配置文档单一事实源:从声明式 schema 生成 CONFIGURATION.md 与网站 /docs/(一步到位) #2107)里没有对应 seed 条目。config-surface-guard 要求每个配置文件叶子字段有 seed 或引用;docs-sync 在干净 checkout 上跑「重新生成 + diff」——从 yaml 重新生成会把那两行手写的删掉 → 漂移 → 红。是功能 PR 文档侧漏掉的收尾,不是 rebase 引入的。
  3. 影响范围与严重程度:只影响这两个 gate 是否绿;零运行时行为影响。
  4. 怎么修复的:补 seed 条目 + 重新生成站点产物(website/main.js 站点词典 + website/docs/index.html 表格行),纯机械补全。具体落地是分支上已有的 bbe8ceaa4(另一 bot 推的,与我独立做出的修复同根因同做法,seed id 用 cw.rnug/cw.rrec);我的重复 commit 未推送、已弃。另外该 bot 还有一个 9c5e1ec73 重构 commit,恰好修掉了我上一轮 rebase 语义审查时标记的那处误导性结构:scope gate 插进了 After the agent restarts, this session can no longer be compressed: the ref suggested by acp_status is flagged as "renum | 代理重启后该会话再也压不了缩:acp_status 建议的 ref 被 compress 判为「已重编号」,两面对 ref 的认知不一致 #4797 superseded 翻译的 if/else 中间、劫持了它的 else 分支——行为逐字节等价(supersededRefRejection 恒返回完整恒等副本),但残留的 else 读起来像死代码,已按 PR 前形态恢复为无条件采纳翻译列表。
  5. 是否有回归问题:无。我对远端头(bbe8ceaa4)本地验证全绿:config-surface-guard ✓;docs-sync 序列(generate + 四文件 git diff --exit-code)零漂移 ✓;check-coverage ✓;typecheck ✓;PR 回归套件 16/16 ✓。md 表格零改动(seed 文本与原手写行一致,再生成逐字节复现)。
  6. 是否破坏缓存:不涉及。
  7. 是否改了设计方向:不涉及(stream.ts 的重构只消除误导性死代码路径,行为不变)。
  8. 是否引入了新的配置:本次修复没有;两个字段本身是 PR 功能(默认关、无 env、三级可配),上一条回复已列。

收工判定:分支头 bbe8cea 已含完整修复且经我独立验证,等这两个 job 重跑结果;其余 test 矩阵仍在排队中,再有红我继续跟。

…bort-teardown flake, #4599 family)

The test (windows-latest, 22, 2) shard red at bbe8cea failed with the
in-archive signature: abort x proxy-{openai,responses}-sse socket not closed
within the absolute wall-clock budget (closed=0, ~10.6s) while the sibling
anthropic case passed in 214ms — runner event-loop starvation, zero
intersection with this PR's diff. The lag-aware budget fix (win32 base +
measured poll-lag extension, healthy-loop threshold byte-identical) is
converged in ci-fixes; per #4599 policy the fix rides the permanent branch.
@ranxianglei

Copy link
Copy Markdown
Owner Author

🤖 Powered by ework · qwen3.8-27b

(ai: vllm-qwen/qwen3.8-27b) 审查与收尾完成,结论如下(八问体例)。

1. 是什么问题:bili 对模型自己发起的压缩调用没有任何策略拦截面——#5683 里 qwen-27b 在没有收到任何压缩提示的情况下自行发起 compress。本 PR 加两个 opt-in 门:compress.requireNudge(没收到提示不许压)和 compress.requireRecommendation(只能压 bili 推荐范围内的消息)。

2. 什么原因导致的:applyRanges 这个所有压缩路径的咽喉点只校验「范围合不合法」,从不问「这一轮该不该压、压的是不是推荐集里的东西」——缺 timing 和 scope 两个判定维度。

3. 影响范围与严重程度:两门都默认关闭,不配置 = 零行为变更;开启后只约束模型发起的 compress,bili 自身的溢出兜底折叠经 loopTracking:false 豁免。面向会自行乱压的模型(如 qwen 27b),可按 provider/model 单独开。属体验/成本类防护,非缺陷修复。

4. 怎么修复的:单一咽喉点 applyRanges 双门。timing 门:prepare 每轮把「本轮 nudge 是否真正送达(nudgeOutcome==injected)」盖章进内存态 session.transient,loop 多轮保持武装、下一未提示轮自动解除;scope 门:提交范围必须被当前推荐集覆盖(覆盖判定而非精确相等——拆小段合法、重折活跃块更新摘要豁免),越界整体拒绝并回执点名越界跨度、指向 acp_status。plugin/proxy 双模式推理到位,内核未动,无新依赖。测试 16 例双向断言齐(#3617 纪律)。

5. 是否有回归问题:逐项审过既有行为——gate 关闭时管道逐字节不变(有 default-off 成功用例钉住);审查中发现并修掉一处结构瑕疵(PR 把新 gate 块插进原 superseded 翻译的 if/else 之间,劫持了 else 分支——行为等价但误导后人,已恢复为 master 原样的无条件赋值,独立 commit 9c5e1ec);preflight 兜底折叠、nudge 三种注入路径(advisory/decide-directive/emergency)全部确认走同一 armed 事实。本地定向验证:typecheck 干净、build 通过、相关 7 个测试套件 97/97。

6. 是否破坏缓存:不涉及——无缓存/重试/游标/去重键路径变更。

7. 是否改了设计方向:不转向。host-only 策略层加在既有咽喉点上,内核零改动,单写者契约不受影响。

8. 是否引入新配置:是,已按配置面纪律全登记。compress.requireNudge / compress.requireRecommendation 两个布尔,默认 off(global→provider→model 逐字段覆盖),CONFIGURATION.md 中英 + web 面板复选框(热生效)+ yaml seed 均已补齐。审查中发现原 PR 手改了生成块却没动 seed 源文件,会红 docs-sync 和 config-surface-guard 两个 CI job——已补 seed 并用官方生成器重生成、验证 md 字节级零漂移(commit bbe8cea)。

过程披露:① 审查期间分支被作者重写为已 rebase 到当前 master 的状态,我此前的整分支 rebase 作废,两处审查修复改为追加提交、完整保留作者历史;② CI 终态:全矩阵 run 41880828212 completed/success(head 6f38517);期间 windows-latest 单格 wire-exit-matrix abort-teardown flake 复发两次(继承性家族,#4599 在档,ci-fixes d7a1a91 的 lag-aware 预算已在树内),单次 rerun 后转绿,系统性加固已报备哨兵裁量,本分支未自行动预算。

标签:scope/wiring + p3(协议接线层的可选策略面,默认关闭无用户可见变化)。
收工判定:可合,待 owner 合并。

@ranxianglei

Copy link
Copy Markdown
Owner Author

🤖 Powered by ework · qwen3.8-27b

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

本轮红条 test (windows-latest, 22, 2) 已绿。判定为继承性已知 flake(#4599 家族),修复经 ci-fixes 收敛分支并入本 PR(另一 agent 推的,与我独立诊断结论一致),我在其头上做了独立验证,CI 全矩阵转绿。本 PR 侧我未推任何代码 commit。

结构化八问

  1. 是什么问题:PR [PR] feat: forbid unprompted/out-of-bounds compression (compress.requireNudge / requireRecommendation) #5685 唯一红条 = windows node22 的 test 分片 2:tests/wire-exit-matrix.test.ts 里 abort x proxy-openai-sse 与 abort x proxy-responses-sse 两个用例,等「客户端中断后上游 socket 关闭」轮满 10s 预算仍 closed=0。
  2. 什么原因导致的:不是代码回归,是 Windows runner 负载下的事件循环饥饿 flake——该文件头注释里完整记录了这个家族的历史(预算 3s→6s→10s 三次上调,[PR] release v0.1.209 #4982/[PR] fix: split header-less claude code subagents onto their own session lane (#4352) #4774/[PR] fix(window): size a child conversation from its parent's runtime-info #4683 时代即有,均录于 CI Control Center: Centralized CI Failure Handling & Status Sync (Comment all CI issues here; do not open new issues) | CI 总控: CI 失败集中处理与状态同步(所有 CI 问题在此评论, 勿开新 issue) #4599)。证据链:① 本 PR 14 个文件的 diff 完全不触碰 abort/teardown 路径;② 同一次 run 里同一文件在 ubuntu-22-分片2 全过、win-22 兄弟分片 3/4/5 全绿;③ 同进程内 anthropic-sse/json 兄弟用例 214ms/416ms 通过(代理的中断→销毁机制本身工作正常);④ 我本地在本 head 定向跑 4 个 abort 用例全绿;⑤ 机制上轮询器与上游 mock 共享同一个被饿死的事件循环,close 事件不可能比循环本身更快送达——绝对墙钟预算量的是 runner,不是 teardown。
  3. 影响范围与严重程度:只影响该 check 是否绿;零运行时行为影响(修复纯测试 harness 面)。
  4. 怎么修复的:我先按继承红流程确认签名并触发了失败 job 重跑;等待窗口内另一个 agent 按「继承红 → merge origin/ci-fixes」政策把 ci-fixes(d7a1a915b)并进了 PR 分支(commit 6f3851718),带入针对这个 flake 家族的根治版:lag-aware teardown 预算——win32 基线 20s、其他平台维持 10s 不变,轮询器按自己实测的事件循环滞后量延长窗口、上限 2×base(健康循环下与旧扁平门槛逐字节一致,真挂死仍会快速失败),外加一个钉住边界算术的回归用例。我的重跑触发被这次 push 取代(旧 run 取消),无重复劳动。
  5. 是否有回归问题:无。新 head 6f3851718 上独立验证:typecheck 干净;定向 5/5(4 个 abort 用例 + 新增算术用例);CI 推送后全矩阵绿——16/16 test 分片(含此前红的 win-22-2)、全部静态门禁/guards/docs-sync 绿。ci-fixes 带入的 diff 仅 3 个测试文件(wire-exit-matrix + 两条 pi e2e 姿态 pin),零 src 改动。
  6. 是否破坏缓存:不涉及。
  7. 是否改了设计方向:不涉及。
  8. 是否引入了新的配置:没有。

备注一条观测:镜像的 check 状态缓存在本轮长时间停更(快照冻结),我按允许的回退方式用少量间隔式单次 API 读取确认了最终状态,未做轮询。

收工判定:head 6f3851718 检查矩阵全绿,PR 可进入人工合并评审。

…commendation set (agent review addendum, PR #5685)

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

审查判定:APPROVE(可合)——GitHub 禁止作者账号 approve 自己的 PR(422),故以 review comment 形式提交本结论。

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

APPROVE — 独立审查完成:方向正确、单一咽喉点实现准确、默认关 = 零行为变化、双门双向断言齐全,不触碰 kernel/wire/缓存。可合(待 owner 合并;本审查推了一个顺手补测 commit,CI 将在新 head c42120f51 上重跑)。

结构化八问

  1. 是什么问题:qwen 系模型在没有收到任何压缩提示(nudge)、也没有推荐依据的情况下自行发起 compress(#5683);需要非侵入的开关禁止「未提示 / 越界压缩」,并允许 web 面板配置。
  2. 什么原因导致的:applyRanges(所有车道模型发起压缩的唯一执行点)只校验「范围合不合法」,从不问「这一轮该不该压、压的是不是推荐集里的东西」——nudge 只是建议文本,不构成拦截面。本 PR 在该点加两个 opt-in 策略门:requireNudge(本轮必须真正送达过 nudge——handle.ts 每轮把 nudgeOutcome === "injected" 盖进内存态 session.transient)与 requireRecommendation(提交跨度必须被当前推荐集覆盖——拆小段合法、重折活跃块合法、越界跨度整体拒绝且回执点名跨度并指向 acp_status)。
  3. 影响范围与严重程度:两门默认关 ⇒ 存量用户零变化;只有显式开启的路由改变行为(此前会被执行的自发/越界 compress 变为拒绝回执)。属体验/成本类防护功能,无存量用户受影响。
  4. 怎么修复的:单一咽喉点 + 每轮盖章 + 覆盖判定。timing 门在解析前运行(拒绝优先);scope 门在 #1001 顺序归一与 #4316 superseded 翻译之后运行,比对对象是「fold 将实际作用的 refs」。推荐集复用展示面的同一过滤链(viable + dead-ref 排除 + minCompressRange),与 nudge submitGate / acp_status liveCompressionRanges 逐行一致——用户看到什么,门就放行什么。preflight 自留 / 溢出兜底走既有的 loopTracking:false 豁免,nudge 通道自身被抑制时可用性也不受影响。
  5. 是否有回归问题:无。diff 触碰路径的既有行为逐项清点:
    • gate 关闭/未盖章路径:控制流不变、逐字节等价(default-off 成功用例钉住;compress 相邻套件全绿);
    • supersededRefRejection:「两个分支都赋 translatedRanges」改为无条件赋值——master 基线(c9ba485 stream.ts:1047/1050)本就两边同赋,语义完全等价(commit 9c5e1ec);superseded 回归套件(issue4797/issue4383)10/10 绿;
    • preflight 车道(loopTracking:false):豁免保持(专项测试钉住);
    • refold(更新活跃块摘要):coveredRefRuns 车出,不被 scope 门误杀(专项测试钉住);
    • 空推荐集:严格拒绝 + preflight 豁免保住可用性(专项测试钉住);
    • config 解析:非布尔值整块拒绝,与 compress 其余字段一致(测试钉住);
    • web 面板新行与既有 cafRow/abRow 模式完全一致(row() 自动挂入 box;取消勾选删 key 并清理空 compress 对象),与其他 quick toggle 行为一致;
    • 高危模式逐项过:fail-fast 未变吞错(拒绝 = 显式回执 + log 行)、无阈值/时序漂移(默认关)、输出格式不变(仅启用后新增回执文本)、缓存策略不受影响。
  6. 是否破坏缓存:不涉及。拒绝发生在 kernel apply 之前,历史前缀字节不动;gate 关闭时请求路径与原流程逐字节一致;无缓存键/去重游标/增量水位变更。
  7. 是否改了设计方向:不转向。host-only 策略层挂在既有咽喉点上,kernel/ 零改动,wire 格式/会话身份/存储格式未动;「单执行点 + loopTracking 判别器」与既有架构一致(#2146 breaker 豁免用同一机制)。
  8. 是否引入了新的配置:是,已按配置面纪律全登记——compress.requireNudge / compress.requireRecommendation,布尔,默认 off(unset = 禁用),随 global→provider→model 三级级联逐字段合并(深层显式 false 可覆盖),经既有 config PUT 热生效,无 env var(env 纪律 #2030);CONFIGURATION.md en/zh + website/config-reference/compress.yaml seed(cw.rnug/cw.rrec)+ 再生成产物已同步,config-surface-guard 绿。

测试有效性:17 例(含本审查补的 1 例),全部按 #3617 纪律双向断言(该触发时触发 / 不该触发时安静);原子性(blocks.length===0)、回执措辞(区分本门回执 vs kernel 回执)、plugin-lane ctx 形状(无 lastNudge → live recompute)均有覆盖。本地定向验证:typecheck 干净;新套件 17/17;相邻 7 套件(config-surface-guard/compress-settings/acp-status/compress-reject-reasons/compress-success-tail/compress-fingerprint-refold/compress-at-fold-point)95/95;superseded 回归 10/10。全量判定以远程 CI 为准。

已顺手修:scope 门的 minCompressRange 下限过滤原本没有测试钉住(offer 里低于下限的跨度应视为 out-of-bounds)——补 1 例钉住,commit c42120f(已推 PR 分支)。

一条非阻塞观测(不改代码):nudge.shouldInject=false 的回合里,fold 后的 hint(submitGate)会显示空列表,比 scope 门本身(跟随 acp_status 面)更保守——门比自己的 hint 略宽,方向安全(更宽 ≠ 数据丢失),仅记录在案。

结论:APPROVE,可合。

@ranxianglei

Copy link
Copy Markdown
Owner Author

🤖 Powered by ework · qwen3.8-27b

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

审查完成,判定:APPROVE(可合)。独立审完原 issue(#5683)、完整 diff 与全部触碰路径:单一咽喉点 applyRanges 双门实现准确、默认关零行为变化、推荐集与展示面(nudge/acp_status)过滤链逐行一致、preflight 豁免保住可用性、superseded 无条件赋值与 master 基线语义等价、web 面板行与既有 quick toggle 模式一致、配置面纪律全登记(en/zh + yaml seed + 再生成产物)。本地定向验证:typecheck 干净;新套件 17/17;相邻 7 套件 95/95;superseded 回归 10/10。八问全文见 GitHub PR #5685 的 review(GitHub 禁止作者账号 approve 自己的 PR,故以 review comment 形式提交,结论 = 可合,待 owner 合并)。

已顺手修:scope 门的 minCompressRange 下限过滤原本没有测试钉住(offer 里低于下限的跨度应视为 out-of-bounds)——补 1 例钉住 + commit c42120f(已推 PR 分支,CI 将在新 head 上重跑)。

非阻塞观测一条:nudge.shouldInject=false 回合里 fold 后 hint(submitGate)显示空列表,比 scope 门本身(跟随 acp_status 面)更保守——门略宽于自己的 hint,方向安全,仅记录。

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

复审确认(新 head c42120f):判定不变 — APPROVE,可合。

  • 本 head 相对上一审查头 6f38517 的唯一增量 = 上一轮审查自己补的回归钉 commit c42120f(仅 tests/issue5683-forbid-unprompted-compress.test.ts +15 行:minCompressRange 下限过滤的 out-of-bounds 钉)。该 commit 提交前已本地验证:套件 17/17、typecheck 干净。
  • 完整八问审查(方向/单咽喉点实现/双门双向断言/配置面登记/缓存与 kernel 零触碰)已在本 PR 的上一条 review 中给出——那条 review 正是在 c42120f 推送之后提交的,即针对的就是当前这个 head,不重复粘贴。
  • 镜像 check 缓存(本 head):0 failed;mergeable=true、无冲突。
  • 形式说明:GitHub 禁止作者账号 approve 自己的 PR(API 422,账号与作者同为 ranxianglei),故正式 approval 动作无法由 agent 执行——请 owner 直接合并。

收工判定:无新增发现、无需决策项、无 kernel 变更,可合。

@ranxianglei

Copy link
Copy Markdown
Owner Author

🤖 Powered by ework · qwen3.8-27b

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

复审完成(新 head c42120f):增量仅为上一轮审查自己补的测试钉 commit(已本地验证 17/17 + typecheck),完整八问 review 本就提交于该 head 之上,判定不变——APPROVE/可合;镜像缓存 0 failed、mergeable=true。GitHub 禁止作者账号自 approve(422),正式 approval 需 owner 直接合并。本轮无新增发现、无顺手修项。

@ranxianglei
ranxianglei merged commit a3f0e8c into master Nov 5, 2026
53 checks passed
@github-actions

github-actions Bot commented Nov 5, 2026

Copy link
Copy Markdown
Contributor

📦 Merged Build Published

This merge to master was published as 0.0.1034-master.a3f0e8c (rolling master tag).

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

@github-actions github-actions Bot mentioned this pull request Nov 7, 2026
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.

Provide a non-intrusive feature to disable compression, and allow web-based configuration. | 提供非注入禁止压缩功能,并允许web配置

1 participant