Skip to content

[PR] compress.requireNudge single-round arming changed to 20-round nudge credit: the model returning on alternating rounds to | compress.requireNudge 的单轮武装改为 20 轮 nudge 信用:模型隔轮回来压缩不再被误拒(#5943) - #5946

Closed
ranxianglei wants to merge 3 commits into
masterfrom
2026-11-08_nudge-credit

Conversation

@ranxianglei

Copy link
Copy Markdown
Owner

问题(人话版)

开了 compress.requireNudge(禁止模型没提醒就自己压缩)之后,模型收到压缩提醒、老老实实去干活(读范围、写摘要、被 requireRecommendation 拒了再重试),干了几轮回来提交压缩时——每次都被拒。

原因:武装位是"单轮枪"。每轮 prepare 都把它重置成"这一轮有没有注入 nudge",模型干活的那几轮没有 nudge,武装就没了。现场(0.1.212,session 01a1b6a5):一次成功的 5 块大折叠(72%→38%)之后,模型收尾剩余范围的 4 次压缩调用连被拒 4 次,只能反复换范围碰运气。

修复

武装位改成 nudge 信用(credit):

  • nudge 真正送达(口径不变:injected 才武装,gated/vetoed/skipped 不算)后开启 20 轮窗口(常量 NUDGE_CREDIT_ROUNDS)
  • 窗口内没有新 nudge 的轮次不再解武
  • 模型完成一次折叠 = 消耗信用(同一轮内的 loop 重发仍放行,下一轮边界失效)
  • 更新的 nudge 注入 = 刷新窗口
  • 进程重启信用清零(本来就是 in-memory,语义一致)

不受影响:requireRecommendation 范围门照旧(信用滞留也只许压推荐集内);bili 自己的硬溢出兜底折叠(preflight lane)照旧豁免;开关默认关、关闭时字节级不变。

改动面:src/unprompted-gate.ts(credit 状态机 + 常量 + stampUnpromptedGate/consumeNudgeCredit)、src/server/handle.ts(prepare 改用 credit stamp)、src/stream.ts(提交点消耗 + 拒收回执改信用口径)、src/session.ts(轮计数器)、测试 4 新例、文案四件套(i18n/yaml/CHANGELOG,生成器已跑)。

验证

  • tests/issue5683-forbid-unprompted-compress.test.ts:21/21(既有 17 例 + 新增 4 例:窗口内隔轮履约放行 / 窗口末轮边界+过期拒 / 消耗后同轮放行+下轮拒 / 新 nudge 刷新)
  • nudge/compress/stream 相关测试面 344/344 绿
  • npm run typecheck 干净

Fixes #5943

…e-round flag

The old stamp reset the arm to "was a nudge injected THIS round" on every
prepare, so a model that spent several rounds doing the nudge's actual work
(reading ranges, writing the summary, retrying after a
requireRecommendation refusal) came back to find the arm gone and had every
delayed fulfillment refused.

A delivered nudge now opens a NUDGE_CREDIT_ROUNDS (20) prepare window:
- un-nudged rounds inside the window keep the credit live
- a committed model-initiated fold consumes the credit (same-turn loop
  re-requests still pass; the arm dies at the next round boundary)
- a newer nudge refreshes the window
- requireRecommendation scope gate, the hard-overflow backstop
  (loopTracking:false), and the default (knobs off) are untouched

Refs: issue #5943 (field evidence: session 01a1b6a5, four consecutive
requireNudge refusals right after a successful 5-block fold)
@github-actions

github-actions Bot commented Nov 8, 2026 •

Copy link
Copy Markdown
Contributor

📦 Built Package Artifact

Branch: 2026-11-08_nudge-credit (6ca0e91)

Latest build — install this exact version

npm install -g billion-context@0.0.8630-pr.5946.e33e37c

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
6ca0e91 billion-context@0.0.8630-pr.5946.e33e37c build
b3f9c4c billion-context@0.0.8627-pr.5946.6f5d1da build

Download artifact

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

Install instructions are refreshed on each push.

@ranxianglei ranxianglei changed the title compress.requireNudge 的单轮武装改为 20 轮 nudge 信用:模型隔轮回来压缩不再被误拒(#5943) [PR] compress.requireNudge single-round arming changed to 20-round nudge credit: the model returning on alternating rounds to | compress.requireNudge 的单轮武装改为 20 轮 nudge 信用:模型隔轮回来压缩不再被误拒(#5943) Nov 8, 2026
@ranxianglei

Copy link
Copy Markdown
Owner Author

🤖 Powered by ework · qwen3.8-27b

🔶 需要决策
(ai: vllm-qwen/qwen3.8-27b)

背景一句话:同一 issue #5943 有两个在途 PR(#5945 先到、#5946 后到),核心语义互斥——「成功折叠是否消耗 nudge 信用」;我用 issue 正文的事故时间线对两个方案各做了一次代码级回放,#5946 的「折叠即消耗」语义修不掉标题现象,需要你拍板以哪个为准。

查重结论:重复。 #5946 与 #5945 同症状(requireNudge 下多轮清理压缩被误拒)+ 同根因(prepare 每轮重盖 armed,资格是单轮布尔)+ 同机制族(单轮武装改 nudge 信用窗口),差异只在两处设计取舍:①成功折叠是否消耗信用;②窗口计数单位(#5945 按模型轮、非模型形态不衰减;#5946 按每次 prepare)。按先来后到,保留 #5945(11:21:30Z 开)、#5946(11:23:17Z 开)标 duplicate——agent 无关闭权,关不关由你定。

待决问题:信用语义取哪种?合哪个 PR?

我的推荐:C(实质 A 先行)。理由:#5946 经回放证明修不掉标题现象,合入即「修了个没修的」;#5945 修掉事故、测试含 K±1 边界、偏离已披露且正是在等这个裁决。不决定的默认行为:两个 PR 我都不能合也不能关(owner-only);方向性缺陷使 #5946 不宜合入,默认轨迹 = #5945 待 CI 转绿后等你确认合入,#5946 等你关闭。


为什么判断 #5946 修不掉事故(独立回放,非引用 #5945 结论)。issue 证据时间线(session 01a1b6a5,请求级 host,每模型轮 = 新 HTTP 请求 = 新 prepare):18:40 T1 nudge 注入(usage 72%)→ 18:41:11 模型当轮成功压 5 块(72%→38%)→ 18:42:27/18:43:29/18:44:15/18:46:21 连续 4 轮压剩余范围全部 REFUSED requireNudge。按 #5946 代码走:18:40 轮 stampUnpromptedGate(nudgeInjected=true) → armed、until=R+19;18:41 折叠提交走到 src/stream.ts 提交点 consumeNudgeCredit → consumed=true(同轮余量仍放行);18:42 起每轮 prepare 重 stamp,creditLive = prev.armed && prev.consumed !== true → false → armed=false → 4 连拒逐分复现。即 #5946 只救场景 1(延迟首次履约:nudge 轮没压、之后几轮回来压),救不了 issue 自认「更常见的现场」场景 3(主范围当轮压完、跨轮清理剩余范围)——而事故现场恰恰是场景 3。#5945 的不消耗语义下同时间线:18:42–18:46 信用仍在窗口内(20→16),4 次清理放行,事故修复。

结构化八问(审的是 #5946):

  1. 是什么问题:开 compress.requireNudge 后压缩资格只在 nudge 注入那一轮有效,模型隔轮回来把推荐范围的剩余部分压完 → 每轮被拒、白烧 tool call + 思考,回执还把「下轮再压」引导成「别压了」。
  2. 什么原因导致的:src/server/handle.ts prepare 每轮重盖 armed: nudgeOutcome === "injected"——单轮布尔,无跨轮延续、无履约概念,nudge 轮一结束资格蒸发。
  3. 影响范围与严重程度(按选项):仅显式开启该 opt-in 开关的会话(默认关 = 零变化);受影响会话多轮清理全拒、opt-in 功能实际不可用,p2(无数据丢失/缓存泄露,preflight 兜底不受此门影响)。若走 B 合入:事故现象保留,对 compress.requireNudge is only valid in the round where the nudge is injected: if the model comes back in a later round t | compress.requireNudge 只在 nudge 注入的那一轮有效:模型隔轮回来压缩就被拒,多轮清理式压缩全部白拒 #5943 验收标准不达成;走 A/C:零额外影响,由 [PR] fix(#5943): requireNudge judges a nudge credit window, not this-round arm #5945 承接。
  4. 怎么修复的([PR] compress.requireNudge single-round arming changed to 20-round nudge credit: the model returning on alternating rounds to | compress.requireNudge 的单轮武装改为 20 轮 nudge 信用:模型隔轮回来压缩不再被误拒(#5943) #5946 方案):armed 改 20 轮 nudge 信用(NUDGE_CREDIT_ROUNDS=20 常量)——真实注入开窗、新注入刷新、committed 折叠消耗(同轮放行、下一轮边界失效)、窗口尽过期;纯内存重启清零。我对实现的独立核验(状态机、preflight 经 loopTracking:false 豁免、所有模型车道汇入 applyRanges 单执行点、fork 子车道 gate-OFF 不变、默认关字节级不变)均成立;本地定向测试 21/21 + 相邻面 59/59 绿、typecheck 干净。缺陷在语义选择层,不在实现层。
  5. 是否有回归风险(按选项):[PR] compress.requireNudge single-round arming changed to 20-round nudge credit: the model returning on alternating rounds to | compress.requireNudge 的单轮武装改为 20 轮 nudge 信用:模型隔轮回来压缩不再被误拒(#5943) #5946 代码本身逐项审过既有行为——默认关路径字节不变、preflight 豁免不变、时序门先于范围门顺序不变、拒收回执文案变更已进 docs 四件套披露,未见无意回归。B 的风险是方向性的:合入 = 带着未修复的标题现象关 issue。A/C 无回归面。
  6. 是否破坏缓存:不涉及缓存/重试/增量游标/去重键。行为变更披露(若 B 合入):旧 = 资格仅 nudge 注入当轮 → 新 = 最近一次真实注入起 ≤20 轮内有效且首次成功折叠即消耗(仅开关开启时生效)。
  7. 是否改了设计方向:架构无转向(仍是 prepare 盖章 + applyRanges 单执行点),只是盖章事实从「单轮布尔」换成「信用状态机」。
  8. 是否引入新配置:无(K=20 为代码常量;i18n/yaml/CHANGELOG/docs 文案四件套已同步、生成器已跑)。

标签:GitHub PR #5946 = bug / p2 / scope/kernel / duplicate(按本 PR diff 独立判定:opt-in 功能缺陷、非 p1 类);镜像 5948 = pr + bug / scope/kernel / p2 / duplicate / needs-decision(同判定 + 待你裁决)。不打客户端标签——证据宿主为 qwen3.8-27b 请求级 host,无具体客户端指纹可判。

CI 状态(实时读取,head 6ca0e91):0 failed,13 项运行中/排队(test shards + static-gates),已完成项全部 success/skipped。

我的动作披露:review 中向 #5946 分支补了 2 个标注 commit——c3b7381e1b(test:钉死「被拒的折叠不消耗信用」,该分支本地 22/22)与 6ca0e91(docs:澄清 armedUntilRound 缺省字段语义)。若走 A/C 两者随分支作废;若走 B 则保留有效。

收工判定:#5946 实现质量过关但方向有缺陷(修不掉标题现象),不建议合入;推荐 C,等你拍板。

@ranxianglei

Copy link
Copy Markdown
Owner Author

作者确认评审回放成立,本 PR 关闭(duplicate of #5945)。

独立复核:按 #5946 的 consume 语义回放 issue 事故时间线(session 01a1b6a5,请求级 host),18:41 当轮主折叠触发 consumeNudgeCredit → 18:42–18:46 四个清理轮 armed=false,4 连拒逐分复现——本 PR 救场景 1(延迟首次履约)但救不了事故现场的场景 3(主范围当轮压完、跨轮清理),标题现象修不掉。

缺陷定位:issue 修复建议第 3 条(券在首次成功折叠时消耗)被事故自身时间线证伪——首次成功折叠正是 nudge 要求的主折叠,消耗后多轮清理全死;本 PR 是逐字实现该条,缺陷在语义选择层不在实现层(实现经评审逐项核验过关)。

处置:采纳评审推荐 C——以 #5945(纯 20 模型轮窗口、不消耗、非模型形态不衰减,K±1 边界测试齐)为准,等 owner 合并;一次性严格性不做朴素 consume-on-fold(那会重新引入本事故),若要更强严格性另立 issue 讨论。评审推入本分支的 c3b7381 / 6ca0e91 两个 commit 随本 PR 作废,致谢。

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

Labels

bug Something isn't working duplicate This issue or pull request already exists needs-decision p2 scope/kernel

Projects

None yet

1 participant