Repository navigation
fix: break the nudge-decide × self-heal suppression deadlock (Closes #3004) - #3019
Conversation
📦 Built Package ArtifactBranch: Option A — Install this exact build (recommended)npm install -g billion-context@0.0.3410-pr.3019.492ed3bThis exact version is immutable and reproducible. The rolling Option B — Download artifact
tar xzf billion-context-pr3019.tgz
npm install -g packageInstall instructions are refreshed on each push. |
8ffc448 to
a03c01d
Compare
Session df251671 pinned at 765K/984K tokens with state.blocks=0 for 4h12m: the model-decided gate vetoed every tier-1 arm (decision side calls starved by host-inherited reasoning knobs against a 200-token budget), the pre-gate INJECT ledger armed suppress-nudge after 5 rounds that delivered nothing, and the latched suppression then gated willInjectNudge — which gates the very fallback branch that breaks it. Circular wait, no timeout, zero compression. Four coordinated fixes (one mechanism family): - decide-ladder fallback outranks latched suppression in all four prepare lanes (the failure-recovery path must reach the model); consumeFallback keeps it a one-shot punch-through per DECIDE_FALLBACK_THRESHOLD failures. - SELF_HEAL_SUPPRESS_CAP_MS (10 min wall-clock) bounds the suppress-nudge latch; re-arming costs a fresh full SELF_HEAL_WINDOW of idle rounds. - decision side calls strip host reasoning knobs (reasoning_effort / thinking / thinkingConfig / reasoning) so the tiny output budget reaches the one-line JSON verdict; main requests are untouched. - Prepared.nudgeOutcome records post-gate delivery truth; self-heal streaks credit ACTUAL injections only, diagNudge labels pending-gate arms INJECT-PENDING instead of INJECT, vetoed arms log an explicit "nothing sent this round" line. Regression tests: tests/issue3004-nudge-decide-selfheal.test.ts (deadlock repro incl. one-shot semantics + cap expiry + channel reopen; starvation shape asserting the side body drops reasoning knobs while the main request keeps them; false-ledger asserting vetoed rounds never arm suppression).
a03c01d to
6429766
Compare
[bot] 🏷 Review 完成。分支已 rebase 到最新 master(原 head 落后 233+ 提交;期间 master 又前进 9 个 storage/web 提交,与本 PR 零文件交集,二次 rebase 后 behind=0),新 head ① 原 issue 方向核对(#3004):取证三机制(decide side call 饿死、投递台账说谎、循环等待)在 reporter 版本 v0.1.195 上逐一核实存在,事故因果链成立;修的是循环等待这个根因而非「压缩没触发」的症状;PR 对取证的两点更正(recordDecision 本就有日志计数;"no" 按设计重置 ladder)与当前 master 代码一致。#7/#8 已按机制域拆出 #3016/#3017,符合一 issue 一机制域规矩。方向无问题。 八问结论:
测试有效性:7 个回归测试断言有牙——死锁复现钉住 one-shot 语义(punch-through 消息内容差、ladder 归零、锁存自身穿透后仍存活、cap 到期清理、通道重开后 standing veto 仍生效)、starvation shape 做 wire 级断言(side body 丢旋钮而主请求保留 判定:可合。 四个行为变更(BC#1–#4)均已在 PR 正文披露 old→new + WHY,无静默漂移。合并动作留给人工:#3019 |
📦 Merged Build PublishedThis merge to master was published as npm install -g billion-context@0.0.375-master.f394b09 # this exact build
npm install -g billion-context@master # always the newest merged build
|
…pe docs (#3008) Delta-only rebase onto master (#3019 merged the shared mechanisms): - dropped from this PR (covered by #3019): stripClientReasoning (master has per-protocol stripDecisionReasoningFields incl. google nested generationConfig), SELF_HEAL_SUPPRESS_MAX_MS 30min cap (master has SELF_HEAL_SUPPRESS_CAP_MS 10min at top-of-evaluate + fallback punch-through + re-arm guard), TECHNICAL-NOTES D1 English hunks. - kept, unique: codexCompactGatePre now reads the evidence-grade input baseline (statusInputBaseline) instead of raw stats.lastInputTokens — an estimate-grade phantom reading self-disabled the safety valve at >=0.9x limit (#1492/#1839 discipline); comment corrected (90% is bili's backstop line, not codex's own point — 78.7% observed, client point unobservable). - kept: docs honesty — codexCompact interception covers explicit requests only; codex-tui auto-compaction is pure client-side and never transits the proxy (detect/rebase path #2372); conflict-watch remediation no longer claims 'intercepts native compaction by default'; zh D1 aligned with the merged 10-min cap. Closes #3008
…pe docs (#3008) Delta-only rebase onto master (#3019 merged the shared mechanisms): - dropped from this PR (covered by #3019): stripClientReasoning (master has per-protocol stripDecisionReasoningFields incl. google nested generationConfig), SELF_HEAL_SUPPRESS_MAX_MS 30min cap (master has SELF_HEAL_SUPPRESS_CAP_MS 10min at top-of-evaluate + fallback punch-through + re-arm guard), TECHNICAL-NOTES D1 English hunks. - kept, unique: codexCompactGatePre now reads the evidence-grade input baseline (statusInputBaseline) instead of raw stats.lastInputTokens — an estimate-grade phantom reading self-disabled the safety valve at >=0.9x limit (#1492/#1839 discipline); comment corrected (90% is bili's backstop line, not codex's own point — 78.7% observed, client point unobservable). - kept: docs honesty — codexCompact interception covers explicit requests only; codex-tui auto-compaction is pure client-side and never transits the proxy (detect/rebase path #2372); conflict-watch remediation no longer claims 'intercepts native compaction by default'; zh D1 aligned with the merged 10-min cap. Closes #3008
是什么问题
Session df251671(dsh profile
dsh-tui,plugin v0.1.195)4h46m 内从 14K 长到 766K tokens,零压缩(state.blocks=0、tokensSaved=0),最后钉死在 765,712/984,464(77.78%)。完整取证包见 issue 附件。根因是三个各自合理的机制互相咬死:{...parsed}构造、只改 token budget;host 侧 reasoning 旋钮原样随行(dsh cordis patch 给默认模型设了reasoningEffort: max)。200 token 默认预算下,reasoning 质量先把整个预算烧完,一行 JSON 判决都来不及产出 →message.content为空 → "empty response" 硬失败 → ladder 计数为链路从未有过的原因累加(事故里 5 次 gate 中 3 次这样死)。INJECT T1日志标签和 self-heal idle streak 都信 pre-gate 的willInjectNudge;异步 decide gate 随后否决时,什么也没送达,轮次却仍计「已 nudge」。5 个这样的轮次武装了suppress-nudge。willInjectNudge,而它 gate 住的本就是能打破抑制的 ladder-fallback 分支;释放条件又等「压缩证据」——只有 nudge 才能引来的证据。锁存跑了 4h12m、零 blocks,直到会话死亡。修法(一个机制族,四个协同改动)
consumeFallback保证每 3 连败只 punch-through 一次SELF_HEAL_SUPPRESS_CAP_MS = 10 min(wall-clock)reasoning_effort/thinking/thinkingConfig/reasoning,按协议)Prepared.nudgeOutcomepost-gate 投递事实(+INJECT-PENDING标签 + 否决轮显式日志行)行为变更(old → new,必须披露)
nudgeModelDecidedOFF 的会话字节级不变(legacy 路径 armed 即注入);ON 时模型否决的轮次不再计入抑制。WHY:对模型从未收到过的通道武装抑制正是本事故的起点。nudge INJECT T1→ decide gate 未决时标INJECT-PENDING T1(判决紧随既有[acp-decide]行);每个被否决的 arm 新增[acp-decide] tier-1 nudge arm not injected (...)行。Prepared.nudgeOutcome字段、导出常量SELF_HEAL_SUPPRESS_CAP_MS、导出函数stripDecisionReasoningFields()。无新增 config key / env / CLI flag。Config surface
无新增。全部改动骑在既有机制上(decide ladder、self-heal 状态机、既有 knobs);常量沿用 #2155 先例(代码常量而非配置)。
验证
tests/issue3004-nudge-decide-selfheal.test.ts(7 测试):死锁复现(含 one-shot 语义 + cap 到期 + 通道重开)、starvation shape(side body 丢 reasoning 旋钮而主请求保留的 wire 断言)、false-ledger(否决轮永不武装抑制)、strip 函数 ×4 协议与 cap 语义单测。本地全绿(整文件 ×2 跑)。nudge-model-decided(新功能:增加模型完全决策的压缩时机nudge触发 #2228 lane)、issue2155-self-heal、nudge-decide——与新文件合计 32/32。npm run typecheckclean。127.0.0.1:8199活上游,此处不存在)——CI(.github/workflows/ci-e2e.yml)对本 diff 自动触发(触碰src/server.ts+src/server/**)。kernel/、pi-subagents/;无持久化格式、版本、release-flow 变更。Review tier
ephemeral 决策 side call 的 wire-shape 变更 + fallback 默认行为变更 → 按 §7.4 留在 human-review tier(不满足 auto-merge)。
对 issue 取证的更正(逐条对照当前 master 验证后)
其余指控全部属实,两点更正:
runNudgeDecision本就记录每次[acp-decide]结果并维护 ladder 计数;缺的是 prepare 层投递事实与 self-heal 感知(本 PR 修复)。"no"本来就按设计重置 ladder(它证明链路健康),只有硬失败才累加;事故的 3 次失败全是 empty/malformed,即真硬失败。新的 vetoed-arm 日志行让两种形态可 grep,区分目的已达成。Closes #3004