fix(nudge): same-turn growth re-inject after a full growth floor (closes #269) - #316
Conversation
📦 Built Extension ArtifactBranch: Option A — Install from npm PR tag (recommended)pi install npm:billion-context-pi@pr-316Each push to this PR publishes a new version under the Option B — Download artifact
tar xzf billion-context-pi-pr316.tgz
pi install ./packageThis comment is automatically updated on each push. |
[bot] 🏷 Review 结论:LGTM,无阻塞问题。 所有声明已对照 acp-kernel 0.0.55 源码逐条核实,本地 CI 检查全绿。 根因验证(两层均成立)
公式镜像准确
本地验证(branch review-316 @ 97f7b8e)
一个轻微观察(非阻塞,非回归) 合规项:无 version bump ✓,CHANGELOG/CONFIGURATION en+zh 同步更新(顺手修了 zh 旧笔误)✓,无 |
|
冲突了 解决下 |
#269) Per-turn dedup suppressed ALL kernel re-shows within one user turn, so a model that ignored a 78% pressure nudge was driven straight into the 95% emergency band. The kernel's pressure branch re-decides injection on every context event, so only the adapter layer can pace re-shows: - markNudgeShown now records tokenCount at injection; the nudge re-injects once the context has grown by max(minGrowthFloor, minGrowthRatio x adaptiveGrowth) (mirrors the kernel decideNudge cadence; 22.5K default) - drop re-anchor mirrors the kernel nudgeNode: after a successful compress the baseline re-anchors to the new scale, so regrowth into the pressure band is not held against the pre-compress peak - baseline maintenance runs on every context event (also idle ones), not only when shouldInject, or the re-anchor would never advance Tests: tests/nudge-reinject.test.ts (inject/suppress/re-inject cadence, drop re-anchor, emergency bypass unchanged).
97f7b8e to
a5b2763
Compare
# Conflicts: # CHANGELOG.md # src/runtime.ts
[bot] 🏷 冲突已解决并推回分支(merge commit 冲突来源:PR 开着期间 master 前进了 4 个 commit(PR #297 bili proxy 让位修复 + PR #318 acp-kernel 0.0.56 bump),与本 PR 同时动了同一批文件。实际文本冲突 2 处(
合并后关键复核 — 内核升级不影响本 PR:acp-kernel 0.0.56 的 nudge 逻辑在我镜像的每一处都与 0.0.55 逐字节一致( 验证(合并后):本地 typecheck clean、测试 612/615 pass 0 fail(3 个既有 skip)、build OK;GitHub CI 9/9 全绿(pr-validation、ubuntu/windows × Node 22/24 四路 test、e2e×2、docker、build-artifact)。 当前状态: 透明性注记:发现 master 移动之前,我先对原 commit 做过一次零内容 amend force-push( |
问题
issue #269:模型忽略 78% 压力 nudge 后,同轮内的所有后续 nudge 重示都被 per-turn 去重(Set)拦掉,直到 95% emergency 机械截断才放行 —— 没有中间的再次提醒机会。
根因(两层)
lastNudgeShownTokens/lastShownByTier),growth 分支确实有增长门槛;但 pressure 分支(75%+)完全不受 cadence 门控 —— 每个 context 事件都重新决策注入。nudgeShownFor(turnKey)Set 去重是为防止同轮多次事件重复注入(合理),但它不区分「同一决策的重复触发」和「增长后的新决策」,把后者也拦了。修法(适配器层增长感知)
markNudgeShown(turnKey, tokenCount):Set 之外并行 Map 记录注入时刻的 token 刻度max(minGrowthFloor, minGrowthRatio × adaptiveGrowth)(镜像内核 decideNudge 的防抖公式,默认 22.5K)→ 允许重注入;对 growth 分支与内核 cadence 等价(不会更激进),对 pressure 分支补上了原本缺失的增长节流shownAt − adaptiveGrowth以下时,基线重锚到新刻度 —— 否则压缩后重新长回压力带会被压缩前峰值压制,又是直冲 emergency(测试 B 专门覆盖)if (turn.nudge?.shouldInject):idle 事件也要推进 re-anchor,否则压缩轮不注入时基线永远停在旧峰值行为对照
测试
tests/nudge-reinject.test.ts(3 例):同轮注入/抑制/重注入 cadence、drop-reanchor、emergency 绕过。全量 591/595,唯一失败是本环境已知的runNpm captures stderr(master 同挂,网络环境相关)。Fixes #269