Repository navigation
[PR] fix(#5943): requireNudge judges a nudge credit window, not this-round arm - #5945
Conversation
📦 Built Package ArtifactBranch: Latest build — install this exact versionnpm install -g billion-context@0.0.8756-pr.5945.e84eae6This exact version is immutable and reproducible. The rolling Recent builds (commit → version)
Download artifact
tar xzf billion-context-pr5945.tgz
npm install -g packageInstall instructions are refreshed on each push. |
(ai: vllm-qwen/qwen3.8-27b) CI auto-fix run (attempt 1/3) — both red gates fixed and verified green on the new head 查重: 不重复 — this is the CI-blocker lane for this PR; before my push no earlier wake had landed a fix (branch head was still the failing sha What was red, and why:
Fix (one labeled commit,
Verification:
八问:
结论:我负责的两个红项(unused-exports、docs-sync)在 |
|
review |
[bot] 🏷 审完 #5945。代码本身正确、能真正修复现场;初版那两处 CI 红灯你已在 查重同 issue(#5943)的姊妹 PR #5946(consume-on-fold 语义)已是 closed / 未合并,本 PR #5945(no-consume)为存活版本——不构成并行冲突。我的独立分析也支持关掉 #5946 保留 #5945:现场是「一次成功折叠后,隔轮续压 4 次全被拒」,只有 no-consume 能让这几轮落在 20 轮窗口内放行;consume-on-fold 会在首次折叠时就把信用烧掉、把原抱怨原样复现。 结构化八问
CI 现状 & 行为变更披露
判定可合——逻辑正确、真正修复现场多轮续压,测试有牙(K±1 双向过期 / 衰减中刷新 / 折叠不消耗 / 非模型形态保持 / 延迟履约),消费面收敛无回归,CI 门全绿。合入前只需 rebase 一下 master。按规则我不代你 rebase / 合并。 |
|
冲突 |
cd98cca to
e6210e5
Compare
(ai: vllm-qwen/qwen3.8-27b) 冲突已解决,PR 分支已 rebase 到 master 并推送(新 head 冲突情况与处理:rebase 到 master(当时 本地验证(rebase 后全绿):unused-exports 门禁干净;docs-sync 重新生成后四个产物零漂移;typecheck、build 干净;定向套件 推送纪律:push 前 fetch 确认远端 head 未变(仍为 实时状态(本轮验证到的):CI 已在新 head 上重跑(快照 18 项排队中 / 0 失败);GitHub 的 mergeable 状态在本轮两次查询时仍在计算中(unknown),但本地 八问:
结论:冲突已解除,分支更新到 |
|
冲突 |
… arm compress.requireNudge previously refused every model-initiated compress except in the exact round where a nudge was injected: the per-prepare stamp re-set `armed` to a single-round boolean, so a model coming back one or several rounds later to finish a nudge's recommended cleanup (the common multi-round cleanup pattern) was refused on every attempt. Replace the single-round arm with a nudge CREDIT (src/unprompted-gate.ts): an actually-injected nudge mints NUDGE_CREDIT_ROUNDS (= 20) model rounds of eligibility; each new injection refreshes it; every un-nudged MODEL round decays it by one; non-model request shapes (countTokens / responsesCompact / local forges) hold it open without refreshing. Successful folds do NOT consume the credit — long-term strictness is preserved by growth-driven nudges (quiet sessions lapse back to strict refusal after K un-nudged rounds). Behavior change (opt-in knob only, default off): eligibility for model-initiated compress under compress.requireNudge extends from "the injection round only" to "within 20 model rounds of the last injected nudge". Refusal receipt text now names the window. Stamp field renamed armed -> nudgeInjected (write side); read-side UnpromptedGate keeps its shape. Credit is in-memory only (session.transient), lapses on restart. Docs (en/zh configuration.md + web i18n) updated to the credit-window semantics; tests pin delayed fulfillment, both expiry directions, refresh mid-decay, post-fold continuation and non-model hold.
…un-export internal gate types - website/config-reference/compress.yaml: desc_en/desc_zh/site_en/site_zh for compress.requireNudge now describe the 20-model-round nudge credit window (#5943) instead of the retired current-turn arm — the PR hand-edited the generated docs/configuration.{md,zh-CN.md} without updating the single source of truth, which is what the #2107 docs-sync drift guard caught. Regenerated website/main.js + website/docs/index.html from the updated seed. - src/unprompted-gate.ts: UnpromptedGate / UnpromptedGateStamp are referenced only inside unprompted-gate.ts — drop the leading export per the unused-exports gate (#1440 P6); UnpromptedGateState stays exported (imported by session.ts).
e6210e5 to
ea2b895
Compare
…in LIVE_FILES #5989 landed the suite without registering it; its spawnSync import trips the SPAWN_RE gate (#1248) so every PR head rebased past that merge fails all 11 test shards at pretest self-check before running any test. Concurrency-reviewed per #1248: fully mocked children + fake clock, the only real spawn is one bare node child for a dead pid — no ports, no zone band.
(ai: vllm-qwen/qwen3.8-27b) CI auto-fix attempt 1/3 — fixed & pushed. What I did this run:
Live state after push (mirror cache 02:31Z snapshot, head 结构化清单(八问)
判定:继承红已修并推送,新 CI run 进行中(0 failed / 12 pending);预期本轮分片转绿后本 PR 红灯全部清除。 |
(ai: vllm-qwen/qwen3.8-27b) 已实时核查:没有合并冲突,页面上看到的是分支保护门禁而非文本冲突——
所以无需 rebase:等最后几个 check 转绿、评审通过,合并按钮即可用。新 run 出结果我会跟一条确认。 |
(ai: vllm-qwen/qwen3.8-27b) 新 run 出结果了:全绿。head
|
ranxianglei
left a comment
There was a problem hiding this comment.
(ai: vllm-qwen/qwen3.8-27b)
APPROVE — correct root-cause fix, well-tested, cleanly scoped. No kernel/ touched; no new config surface; behavior change fully disclosed.
Reviewed against the true base 1f311dd8d5 (the branch merged master repeatedly, so the raw diff vs a stale base looks huge — the real PR is 12 files, +204/−61, three commits).
Correctness. Root cause confirmed: src/server/handle.ts re-stamped armed as a per-prepare single-round boolean (nudgeOutcome === "injected"), so applyRanges' requireNudge && !armed refused every multi-round cleanup continuation. The credit-window transition (src/unprompted-gate.ts:58) is sound:
- inject → mint
NUDGE_CREDIT_ROUNDS(=20); un-nudged model round → −1; non-model shape → hold; clamped ≥0; a successful fold does not consume it. - The
modelRoundpredicate (!countTokens && !responsesCompact && !prepared.codexForge && !prepared.threadsLane) is byte-identical to the preflight exclusion guard directly below the call site (handle.ts:2972) — the "mirrors preflight" comment holds. - Read side derives
armed: credit > 0; the OFF default is unchanged, so routes withoutrequireNudgesee zero behavior change. Legacy/malformed state is guarded byNumber.isFinite. session.transientis non-persisted (persist.ts:3283 "state/transient is non-droppable"), so the stored-shape rename (armed→credit) has no migration surface; restart lapses to OFF safely.- Scope gate
requireRecommendationis untouched — the relaxed timing does not weaken range validation (stale ranges still fail live validation). - Reasoned in both compression modes:
applyRangesis the single execution point for model-initiated compress in plugin and proxy modes alike, so the relaxation is uniform — no mode-specific break.
Tests. tests/issue5683-forbid-unprompted-compress.test.ts pins every transition both directions (gate discipline #3617): delayed fulfillment (the reported defect), expiry at K−1 (live) vs K (refused), refresh mid-decay, post-fold continuation (the consumption variant would refuse this), non-model-hold. Uses real storeUnpromptedGate+applyRanges, not mocks.
Docs / conventions. Behavior change disclosed old→new+why in both commit and PR body; en/zh configuration.md, web i18n, and the seed yaml (regenerated, fixing the #2107 drift) are all consistent; internal types un-exported per the unused-exports gate; deliberately no new config surface (K is a named constant) — correct per owner spec. The live-files.mjs addition registers #5989's unregistered issue5955 suite whose spawnSync trips the SPAWN_RE gate — a necessary, correctly-labeled few-line CI fix, not scope creep.
Non-blocking note (author's, not mine). The PR ships window semantics and flags that the issue's suggested one-shot variant (consume-on-first-fold) would not have fixed the 18:42–18:46 refusal storm — replay shows the 18:41 fold would eat the credit and the four refusals persist. Window semantics is the right default; if the owner wants one-shot as an option it's a small follow-up. Not a blocker.
CI 30/30 relevant green (test×shards×OS×node, static-gates, mysql-contract, gate); no kernel-guard gate present; mergeable — only the review gate holds it.
8问(中文)
- 是什么问题:开了 compress.requireNudge 后,模型只能在 nudge 实际注入的那一轮调 compress;隔轮回来把 nudge 推荐的剩余范围压完会被逐轮拒绝(现场 session 01a1b6a5:18:41 当轮压成功 5 块后,18:42–18:46 连续 4 轮 REFUSED 全白烧)。最常见的多轮清理式压缩被整个禁掉。
- 什么原因导致的:
src/server/handle.ts每轮 prepare 把armed重新盖成单轮布尔(nudgeOutcome === "injected"),资格无跨轮延续;src/stream.tsapplyRanges 里requireNudge && !armed即拒。根因是「资格 = 本轮布尔」这一设计,不是表面现象。 - 影响范围与严重程度:仅影响显式开启 compress.requireNudge 的路由(默认关,未开启者零变化)。开启者:跨轮清理压缩从「全拒」变为「窗口内放行」——属可用性修复(此前该常见用法完全不可用),非数据丢失、非安全面。
- 怎么修复的:把单轮武装布尔改成 nudge 信用窗口(K=20 模型轮):注入铸券、新 nudge 刷新、每个未提示模型轮衰减 1、非模型形态保持、成功折叠不消耗、安静会话 K 轮后回到严格拒绝;范围门 requireRecommendation 不动。
- 是否有回归问题:逐项过既有行为——(a) 未开 requireNudge 路由:OFF 默认不变,零变化;(b) 范围门 requireRecommendation:未触碰,放松时序不削弱范围校验(陈旧 range 仍走 live 校验被拒);(c) bili 自身溢出兜底折叠:走 loopTracking:false,仍豁免;(d) 重启:transient 不持久化,回落到 OFF 安全态,无迁移面;(e) 双压缩模式:applyRanges 是唯一执行点,plugin/proxy 对称放松,无模式特异性回归。结论:无回归。
- 是否破坏缓存:不涉及。不触碰前缀缓存 / 重试 / 增量游标 / 去重键;改动仅在一个内存计数器与一个策略门判决上。
- 是否改了设计方向:不改架构。仅在既有 #5683 未提示压缩门的内部,把「本轮武装」细化为「信用窗口」;数据流、边界、模块划分不变。
- 是否引入新配置:无。K 为代码常量 NUDGE_CREDIT_ROUNDS=20,刻意不开配置面(符合 owner spec:已有 knob 对,仅窗口长度固定)。无新 env/config/默认值。
判定:可合(APPROVE)。行为变更已在 PR 正文按旧值→新值+原因披露,属有意放宽且默认关,合并人已知悉。
[bot] 🏷 Review complete — APPROVE-level: clean, no blockers. Reviewed PR #5945 (= mirror #5947), head
Non-blocking (author's note, not mine): window semantics shipped; the issue's suggested one-shot (consume-on-first-fold) variant would not have fixed the reported 18:42–18:46 refusal storm — a small follow-up only if you want it offered as an option. Nothing needed before merge. |
|
冲突 |
Resolve the scripts/live-files.mjs conflict on the issue5955 LIVE_FILES registration: both sides added the same entry line, only the explanatory comment differed, so master's canonical comment was kept (superset of detail, references #5666). No change to the PR's requireNudge credit-window fix.
[bot] 🏷 冲突已解决并推送,PR 现在可合并。 发生了什么:PR #5945 落后 master 多个提交,master 前进到 怎么解的:把当前 master merge 进 PR 分支(保留原作者三个 commit、不 rebase 改写署名),冲突处取 master 侧注释(信息更全:reaped-pid / win32 taskkill / 引用 #5666),注册行仍为单条。已核对 PR 核心修复在自动合并后逐字节完好( 当前状态:已推送 待你操作:本 reviewer 凭据与 PR 作者同为 8问(中文)
判定:冲突已解、可合并;代码评审结论维持上一条 APPROVE-level 不变,待你 approve + merge。 |
(ai: vllm-qwen/qwen3.8-27b) 冲突已解除,CI 全绿。 本轮处理过程与结论(结构化八问):
当前状态(head 9ad3db7):30 个 check = 15 success + 15 skipped、0 失败; |
📦 Merged Build PublishedThis merge to master was published as npm install -g billion-context@0.0.1157-master.658499a # this exact build
npm install -g billion-context@master # always the newest merged build
|
是什么问题
开了
compress.requireNudge(禁止未提示压缩)后,模型只在「nudge 实际注入的那一轮」能调 compress,隔轮回来把 nudge 推荐的剩余范围压完 → 每一轮都被拒(现场:session 01a1b6a5,18:41 当轮压成功 5 块后,18:42–18:46 连续 4 轮 REFUSED,全部白烧)。多轮清理式压缩这个最常见用法被整个禁掉了。根因
src/server/handle.ts每轮 prepare 重新盖章armed: prepared.nudgeOutcome === "injected"—— 资格是单轮布尔,无跨轮延续。src/stream.tsapplyRanges 里requireNudge && !armed→ 拒。修法(nudge credit)
armed从「本轮布尔」改为 nudge 信用窗口(src/unprompted-gate.ts):NUDGE_CREDIT_ROUNDS常量,无新配置面);requireRecommendation范围门不动;拒收回执文案同步改为「信用过期 / 从未铸券」并写明窗口长度。compress.requireNudge的放行条件:旧 = 仅 nudge 注入当轮 → 新 = 距最近一次真实注入 ≤ 20 个模型轮内(新注入刷新、未提示模型轮逐轮衰减、折叠不消耗)。该开关默认未开,未开启者行为完全不变;已开启者的跨轮清理压缩从「全拒」变为「窗口内放行」。对 issue 修复建议第 3 条的偏离(已在 issue 线程披露)
issue 建议「券在首次成功折叠时消耗、下一轮边界作废」。按现场回放推演:18:41 那次当轮折叠就会吃掉券,18:42–18:46 的四连拒依旧发生——issue 标题现象(多轮清理全白拒)修不掉。故采用纯窗口语义;若 owner 更想要一次性语义,是几行内的 follow-up(消耗点加进 applyRanges 成功路径即可),等拍板。
验证
tests/issue5683-forbid-unprompted-compress.test.ts22/22 绿(新增 5 例:窗口内延迟履约、K±1 双向过期、衰减中刷新、折叠后继续、非模型形态保持);npm run typecheck干净;全量回归走 CI。Closes #5943