Skip to content

fix: stop advertising DEAD refs in the nudge decision directive and /acp panel (#3204) - #3213

Merged
ranxianglei merged 2 commits into
masterfrom
2026-10-15_fix-3204-dead-ref-nudge-panel
Oct 15, 2026
Merged

ranxianglei merged 2 commits into
masterfrom
2026-10-15_fix-3204-dead-ref-nudge-panel

Conversation

@ranxianglei

@ranxianglei ranxianglei commented Oct 14, 2026 •

Copy link
Copy Markdown
Owner

Closes #3204

是什么

#3195 把「失败回执 / acp_status / post-compress tail」三条面的 DEAD-ref 过滤补上了,但还有两条产线拿同一份未过滤的 nudge.compressibleRanges 对外宣称(同 #3192 根因:资格视图不消费 state.deadRefs):

  1. nudge 模型决策指令面(compress.nudgeModelDecided=true,opt-in):决策提示词把可压缩 span 列表直接发给模型,模型答 yes 后注入的指令是命令式的("Call your compress tool on exactly this span")。列表里罩着 DEAD ref 的 span 被照做必被闸门拒收(cannot be anchored),白烧一次 compress 调用并累加 breaker 连续失败计数;nudge arm 反复触发时反复踩同一个坑。
  2. nudge 决策指令与 /acp 面板仍会列出含 DEAD ref 的压缩区间(#3192 同根机制的另外两条产线) #3204 第二条产线 /acp 面板(plugin status JSON 的 compressibleRanges 字段 + 面板文本里的 span 列表):读同一份 live processTurn 结果、无 dead 过滤。fix: stop advertising DEAD refs as compressible in receipts and acp_status #3195 合并后 acp_status 工具输出不再列这类 span 而面板还列——两个面重新分裂(Compression failure recovery hints advertise protected or already covered refs as immediately compressible #2778 要消灭的那类不一致)。

怎么修

复用 #3195 已落的 excludeDeadRefRanges()(src/acp-status.ts):

  • 四个协议 prepare-* 决策分支取 ranges 处各包一层:excludeDeadRefRanges(turn.nudge.compressibleRanges ?? [], session.state.deadRefs)(openai / anthropic / google / responses);
  • src/plugin.ts 在 live 重算得到 nudge 后对其 compressibleRanges 包一层——一个过滤点同时覆盖面板文本(内核 buildStatusPanel)与 JSON 字段,两面不可能再分叉。

纯宿主侧;无配置面变更;无 kernel 变更。

与 #3195 的关系(合并顺序说明)

本 PR 的 excludeDeadRefRanges 与 #3195 加入 src/acp-status.ts 的同名函数逐字节相同(同位置、同注释)。两个 PR 谁先合入,另一个合并时 git identical-hunk 自动收敛为单份拷贝,无重复、无冲突。

行为变更披露

  • 决策指令面(仅 nudgeModelDecided=true 会话):罩住 DEAD ref 的 span 不再出现在决策提示词里,注入指令也不会以它为 Target;模型若仍引用此类 span,resolveDecisionRange 找不到包含它的存活区间 → 跳过注入(而非下达注定失败的命令)。旧行为:照常宣告并命令式指路 → 必然闸门拒收 + breaker 计数污染。新行为:不宣告、不指路。这是本修复的预期效果。
  • 面板面:compressibleRanges 字段与面板文本不再列出罩住 DEAD ref 的 span,与 acp_status 工具输出(fix: stop advertising DEAD refs as compressible in receipts and acp_status #3195)对齐。无阈值 / 时序 / 默认值漂移。

测试

新增 tests/issue3204-dead-ref-nudge-panel.test.ts(真实管线 e2e,两条产线各一):

  • 决策面:openai wire、nudgeModelDecided 开启、~50k 历史对 64k 窗口(78% usage,OVER-LIMIT 每轮确定性再武装);T3 回放丢一条中段 filler 消息并注入对应 state.deadRefs(与 fix: stop advertising DEAD refs as compressible in receipts and acp_status #3195 回归测试同一 seam)。断言第二轮决策提示词与任何注入指令的 Target span 均不罩死 ref。
  • 面板面:plugin lane、同尺寸历史、status 端点重算。断言 compressibleRanges 字段与面板文本均不列罩死 span。

红绿验证:未改代码两测均红(post-drop decision prompt must not offer the m00015-bracketing span m0013–m0016 / panel field must not list m00013–m0016 spanning m00015);修复后 pass 2/fail 0。本地定向:typecheck clean + 本文件 + nudge-model-decided + plugin-status-provenance 全绿(5/5);全量套件交给 CI。

Review addendum(commit 69eb01b)

审核发现本 PR 范围漏掉的第三条产线(同 #3192 根机制),已在本分支独立 commit 修复:

默认 prose nudge 面(useDecide=false,即未开 nudgeModelDecided 的会话——多数用户的默认路径):renderNudgeText 把 formatRanges(turn.nudge.compressibleRanges) 直接渲染进注入的 nudge 文本;且 formatRanges 按位置合并相邻区间(gap ≤ 1 slot),被丢消息的空槽会被桥接,罩住 DEAD ref 的 span 因此合并成一个大区间(实测复现:dead m00015 被桥进 m0001–m0030)。此面影响面大于决策指令面(opt-in)。

修法:把 dead 过滤收敛到各 lane 早段 top mutation 点(viableRanges(...) → excludeDeadRefRanges(viableRanges(...), session.state.deadRefs)),一个过滤点覆盖全部下游消费者——决策提示+指令、prose nudge、emergency override、preflight 长度门;同时移除首 commit 的逐 decide wrapper(语义等价,单一过滤点)。

行为变更披露(新增):当所有可压缩候选都被 DEAD ref 罩住时,emergencyNudge override 与 server 侧 immediate-forward / preflight 空区间门现在看到「诚实为空」的集合 → 拒绝 override / 直接放行,而不是像旧行为那样继续进入注定失败的 fold。决策指令与面板两面语义与原描述不变。

测试:tests/issue3204-dead-ref-nudge-panel.test.ts 新增 prose 面 e2e scenario(不修则红:post-drop prose nudge must not offer the m00015-bracketing span m0001–m0030;修后 3/3 绿)。本地定向验证:typecheck clean + 本文件 + 11 个 nudge 面套件(58/58)+ 8 个 panel/gate/preflight 套件(62/62);全量交 CI。

另已实测正文「合并顺序说明」:master b2868ca 上双向模拟合并 pr3195 ↔ pr3213,零冲突,identical hunk 自动收敛为单份拷贝。

措辞小勘误(不阻塞):正文称模型引用 dead span 时 resolveDecisionRange「跳过注入」——实际是回退到最大存活区间仍注入(仅当无任何存活区间才跳过);系既有语义,安全性质(永不以 dead span 为 Target)不受影响。

@github-actions

github-actions Bot commented Oct 14, 2026 •

Copy link
Copy Markdown
Contributor

📦 Built Package Artifact

Branch: 2026-10-15_fix-3204-dead-ref-nudge-panel (69eb01b)

Option A — Install this exact build (recommended)

npm install -g billion-context@0.0.3693-pr.3213.24df40a

This exact version is immutable and reproducible. The rolling pr tag tracks the newest test build across all PRs.

Option B — Download artifact

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

查重: 不重复 —— 这是 #3195 的指定续作,不是并行重复工作:

开始独立审核:拉取分支核对 diff、验证「与 #3195 逐字节相同」声明、检查测试有效性、看 CI。结论稍后按八问体例给出。

…3204 third line)

Review of #3213 found a third production line of the same #3192 root mechanism this PR's scope missed: the default prose nudge (useDecide=false, i.e. nudgeModelDecided off) renders formatRanges(turn.nudge.compressibleRanges) straight into the injected nudge text, and formatRanges merges positionally adjacent ranges across missing slots — so a dropped middle message's span gets bridged into one big span bracketing the dead ref (reproduced: m0001–m0030 bracketing dead m00015).

- Consolidate the dead-filter at each lane's early top mutation point (viable -> excludeDeadRefRanges), ahead of every consumer: decision prompt+directive, prose nudge, emergency override, preflight length gates. Removes the now-redundant per-decide wrappers from this PR's first commit.
- Behavior change (disclosed): when ALL candidates are dead, emergencyNudge override and the server immediate-forward / preflight empty-ranges gates now see an honestly-empty set and refuse/forward instead of proceeding into doomed folds. Decision-directive and panel semantics unchanged from the first commit.
- Test: new e2e scenario drives the default prose path through the real pipeline; red without the fix (post-drop nudge offered m0001–m0030), green with it.
@ranxianglei

Copy link
Copy Markdown
Owner Author

🤖 Powered by ework · qwen3.8-27b

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

审核结论:方向正确、与 #3195 分工干净、合并顺序声明成立;但审核中发现同机制的第三条产线(默认 prose nudge),已在 PR 分支补一个标注 commit(69eb01b,push 到本 PR 分支)。查重结论见本帖首条回复。

八问:

  1. 是什么问题:nudge 决策指令面(opt-in nudgeModelDecided)与 /acp 面板仍在对外列出罩住 DEAD ref 的压缩区间——模型照指令执行必被闸门拒收(cannot be anchored),白烧 compress 调用并累加 breaker 连续失败计数;且 fix: stop advertising DEAD refs as compressible in receipts and acp_status #3195 后 acp_status 工具与面板出现两种不一致视图。
  2. 什么原因导致的:资格视图(nudge.compressibleRanges,kernel buildCompressibleRanges 产出)完全不消费 state.deadRefs——与 The compress failure receipt is self-contradictory: the same message first declares the ref permanently DEAD, then lists the range containing that DEAD ref as the "current compressible range." | compress 失败回执自相矛盾:同一条消息先宣告 ref 永久 DEAD,再把含该 DEAD ref 的区间列为「当前可压缩范围」 #3192/fix: stop advertising DEAD refs as compressible in receipts and acp_status #3195 同根机制,只是还有下游面在读同一份未过滤数据。kernel 侧根治(围绕 DEAD ref 切分)已由 kernel: buildCompressibleRanges 应围绕 DEAD ref 切分区间,而不是让 DEAD ref 落进已宣告 span 的内部 #3205 单独跟踪;本 PR 是宿主侧过滤,层次与 fix: stop advertising DEAD refs as compressible in receipts and acp_status #3195 一致。
  3. 影响范围与严重程度:决策指令面仅 nudgeModelDecided=true 会话;面板面影响所有看面板的 plugin 用户。审核新发现第三条产线、影响面比前两条更宽:默认 prose nudge(useDecide=false 默认路径)经 kernel formatRanges 同样列出罩死 span——其位置合并逻辑会把缺失槽位桥接起来,丢一条中段消息就能把死 ref 罩进 m0001–m0030 这种大区间。严重程度:不致不可用(闸门最终拒收兜底),但每次触发白烧一次调用 + breaker 计数污染,nudge 反复武装时反复踩坑。
  4. 怎么修复的:复用 fix: stop advertising DEAD refs as compressible in receipts and acp_status #3195 的 excludeDeadRefRanges()。在原 PR 两个过滤点之外,把决策面过滤上提为每条 lane 顶部 mutation 点的唯一过滤点(turn.nudge.compressibleRanges = excludeDeadRefRanges(viableRanges(...), session.state.deadRefs)),一处覆盖全部消费者(决策提示词、resolveDecisionRange、prose nudge、emergencyNudge 覆盖判定、server 即时转发/preflight 空区间门),原决策分支内的冗余 wrapper 移除;测试文件新增第三条产线的用例。
  5. 是否有回归问题:逐项审过触碰路径的既有行为——(a) 四 lane viable-first→dead-exclusion-after 顺序正确;(b) 「候选全 DEAD」边界下行为从「继续推进、撞闸门」变为「诚实空集→拒绝/转发」,这正是修复意图(已写入 PR 正文 addendum 披露);(c) 无阈值/时序/默认值漂移;(d) 本地定向验证:typecheck clean,新测试文件 3/3 绿且红绿双向证明(仅回退 src 恰好 prose 断言红:post-drop prose nudge must not offer the m00015-bracketing span m0001–m0030),另跑 19 个相关套件(nudge 面 + 面板/preflight/图像仲裁)共 120 例全绿。一个措辞 nit:PR 正文说模型引用死 span 时「跳过注入」,实际 resolveDecisionRange 是回退到最大存活区间(仅过滤后集合为空才跳过)——既有语义、非本 PR 引入,安全性质(永不指向死 span)成立。
  6. 是否破坏缓存:不涉及——prefix cache、重试、增量游标、去重键均未触碰。
  7. 是否改了设计方向:没有。纯宿主侧过滤,层次与 fix: stop advertising DEAD refs as compressible in receipts and acp_status #3195 一致;kernel 侧根治仍归 kernel: buildCompressibleRanges 应围绕 DEAD ref 切分区间,而不是让 DEAD ref 落进已宣告 span 的内部 #3205。
  8. 是否引入了新的配置:无。

合并顺序验证:pr3195 ↔ pr3213 双向模拟合并(merge-base = 当前 master b2868ca),两方向零冲突,src/acp-status.ts identical hunk 自动收敛为单份拷贝——PR 正文声明成立 ✅。

CI 状态(重要):两个 head 目前都红,但失败全部来自既有的 #3212 CI 端口区红风暴(已有跟踪;PR #3215 的 test-only 修复在途、其自身 CI 全绿):zone-live / performSelfRestart(#3044)×4、hook e2e pinned-port(#2877 attachPolicy 翻转的过期断言)×2——失败测试与本 PR 管线零交集。每个 head 另有一个独立单腿 flake(旧 head:error-delivery proxy-openai-sse ×1,发生在不含我任何提交的原始 head 上;新 head:plugin-terminal-usage ×4,本地定向跑 9/9 全绿)——均与本 diff 无关。按红风暴防线规则不重复立项,#3212/#3215 已覆盖。

收工判定:代码就绪可合——方向、分工、实现、测试均成立;CI 门禁当前被无关的 #3212 红风暴挡住,#3215 落地后自然转绿(或请求重跑)。合并请你操作:#3213

@ranxianglei
ranxianglei merged commit c37ad25 into master Oct 15, 2026
34 of 41 checks passed
@github-actions

Copy link
Copy Markdown
Contributor

📦 Merged Build Published

This merge to master was published as 0.0.438-master.c37ad25 (rolling master tag).

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

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

nudge 决策指令与 /acp 面板仍会列出含 DEAD ref 的压缩区间(#3192 同根机制的另外两条产线)

1 participant