Repository navigation
feat(#1997): throughput-adaptive nudge cadence (compress.nudgeAdaptive) - #2035
ranxianglei wants to merge 3 commits into
Conversation
📦 Built Package ArtifactBranch: Option A — Install this exact build (recommended)npm install -g billion-context@0.0.2400-pr.2035.db0d75bThis exact version is immutable and reproducible. The rolling Option B — Download artifact
tar xzf billion-context-pr2035.tgz
npm install -g packageInstall instructions are refreshed on each push. |
New README.md FAQ continuation lines and the paper §6.3 paragraphs carried a leading space inconsistent with surrounding style. Cosmetic only; renders unchanged. Labeled incidental fix per the small-fixes-in-passing policy.
…ew fix) KDD#7 said the proxy 'suppresses tool + nudge injection' in plugin mode. Since #451 the proxy-side nudge IS injected in BOTH modes (ephemeral trailing user message; the agent has no nudge channel of its own) — see src/server.ts 'Inject in BOTH modes (#451)' and TECHNICAL-NOTES.md 'Two compression modes' table row 'Proxy-injected nudge | yes | yes'. The stale wording is the source of the incorrect plugin-mode claim in the #2035 PR description. Factual doc fix only; no behavior change.
[bot] 🏷 Review 完成 — 可合并(需人工合并:feat + 新配置面,按 §7.4 不满足 auto-merge,留 human)。 查重:无重复——本 PR 即 #1997 的实现(设计已经 owner floor 12「同意开工」预批),字段名/默认值/三级级联与批准稿完全一致。 结构化七问:
行为变更 flag:默认 OFF → 零行为变化;ON → 每请求 growthFloor/growthCap 变为移动值 S(即功能本身,已在正文与文档披露)。 review 中发现的小问题,已直接修(不止报告):
判定:方向正确(预批设计原样落地)、无回归、测试有牙(边界/clamp/同引用/级联/解析拒绝均有断言)、diff 干净——可合并,请人工合并:#2035 |
[bot] 🏷 CI 补报(windows-22 单测 flake,已重跑转绿) 上一轮回复末尾说"正在重跑",结果如下: 现象:两个 review 小修 commit 推上去后(doc-only),主 CI workflow 仅 判定为环境性 flake,非本 PR 回归,证据链:
处置:已触发 failed-job 重跑,整个 run 现已 结论不变:可合并(需人工 merge——feat + 新配置面,§7.4 人工通道)。 |
|
Related: the default-cadence side of this landed as #2278 (window-scaled default step, 20k..50k band — fixes the #2110 RC2 starvation for sub-1M windows). #2035 remains complementary: it adds the opt-in throughput-adaptive cadence (nudgeAdaptive / nudgeGrowthMin / nudgeGrowthMax) on top of the scaled default, with |
Adds an opt-in adaptive nudge growth step driven by the session's recent per-call input throughput: large arrivals (bulk file/log reads) widen the step so folding does not interrupt the work; small arrivals (quiet interactive turns) narrow it so context stays lean. Clamped to [nudgeGrowthMin, nudgeGrowthMax] and seeded from nudgeGrowthTokens until three samples exist. The signal references growth magnitude AND call count (a bounded window of recent requests), not wall-clock time or cache occupancy. New opt-in fields under compress (default OFF = byte-for-byte unchanged): nudgeAdaptive (bool), nudgeGrowthMin (num, default 10000), nudgeGrowthMax (num, default 200000). Pure/deterministic step computation lives in the new src/nudge-adaptive.ts; the band is overlaid onto the already-resolved per-request config in compress-settings.ts (applyAdaptiveNudgeStep); server.ts samples rawInputTokens into a bounded per-session ring (persisted via session.metadata) at session bind and applies the band. Docs: CONFIGURATION en/zh field reference, README en/zh FAQ, paper §6.3 en/zh (throughput signal vs the cache-occupancy denominator artifact). Tests: tests/nudge-adaptive.test.ts (deterministic unit + integration). Closes #1997
New README.md FAQ continuation lines and the paper §6.3 paragraphs carried a leading space inconsistent with surrounding style. Cosmetic only; renders unchanged. Labeled incidental fix per the small-fixes-in-passing policy.
…ew fix) KDD#7 said the proxy 'suppresses tool + nudge injection' in plugin mode. Since #451 the proxy-side nudge IS injected in BOTH modes (ephemeral trailing user message; the agent has no nudge channel of its own) — see src/server.ts 'Inject in BOTH modes (#451)' and TECHNICAL-NOTES.md 'Two compression modes' table row 'Proxy-injected nudge | yes | yes'. The stale wording is the source of the incorrect plugin-mode claim in the #2035 PR description. Factual doc fix only; no behavior change.
abc1586 to
3676e0f
Compare
[bot] 🏷 收到,已核对并顺手把 #2035 rebase 到当前 master(零冲突)。先一个事实更正,再给交互分析: ① 事实更正:#2278 尚未 landed。API 核实: ② 机制层交互分析(结论:不冲突,顺序二选一均可):
③ 建议合并顺序:#2035 先合(seed 零接缝),#2278 后合时我补 seed 对齐 follow-up;若 owner 更想先落 #2278(修 #2110 starvation 紧迫性更高),也可以——代价只是上述瞬态 seed 不一致,我同样可以先把 seed 对齐 commit 加进 #2035 再等 #2278。请拍板顺序。 ④ Rebase 报告(新 head
|
[bot] 🏷 CI 补报:rebased head 全部 13 条 workflow lane 当前状态汇总:
|
Closes #1997
What
Opt-in throughput-adaptive nudge cadence. When enabled, the fixed
compress.nudgeGrowthTokensstep is replaced by an adaptive step derived from the session's recent per-call input throughput: large arrivals (bulk file/log reads) widen the step so folding does not interrupt the work; small arrivals (quiet interactive turns) narrow it so context stays lean. Clamped to [nudgeGrowthMin,nudgeGrowthMax] and seeded fromnudgeGrowthTokensuntil three samples exist. The signal references growth magnitude and call count (a bounded window of recent requests) — not wall-clock time or cache occupancy (see the paper §6.3 note on the cache-occupancy denominator artifact).Config surface (new fields — owner-approved pre-implementation)
Three optional fields under
compress(three-level cascade global→provider→model, per-field deepest-wins, exactly like every other compress field):nudgeAdaptive?: boolean— master switch. Default unset/false→ byte-for-byte identical to today.nudgeGrowthMin?: number— default10000. Lower clamp.nudgeGrowthMax?: number— default200000. Upper clamp.Why the existing surface cannot express this:
nudgeGrowthTokensis a single STATIC step (it flattens the kernel's adaptive band to a constant); no field makes the step track observed throughput. Alternatives considered and rejected: re-introducing window-percentage scaling (forbidden by #379/#380), and cache-/occupancy-driven gating (owner rejected — a low-water fold's apparent miss is a denominator effect while the absolute re-computed tokens stay in the tens of thousands; the trade strongly favors compression). Internal tuning constants (window=8, min-samples=3, proportionality=1) are deliberately NOT exposed as config, to avoid surface bloat.Behavior change (flagged)
nudgeAdaptiveunset,applyAdaptiveNudgeStepreturns the resolved config untouched — no allocation, no band change.nudge.growthFloor/growthCapbecomes a moving valueSinstead of the static step. This is the intended feature.Both compression modes reasoned (§6):
Scope
bili-only — no acp-kernel change (verified kernel 0.0.100
resolveAdaptiveGrowth = min(growthCap, max(growthFloor, round(limit×growthRatio))), so pinningfloor == cap == Sdrives the effective step exactly for any window). Files: newsrc/nudge-adaptive.ts(pure/deterministic step),src/config.ts(type + parser + misplaced-key hints),src/compress-settings.ts(merge picks +applyAdaptiveNudgeStep),src/server.ts(samplerawInputTokensinto a bounded per-session ring persisted viasession.metadata, then overlay the band at session bind), docs en/zh + paper §6.3, teststests/nudge-adaptive.test.ts.Verification
typecheck ✓ · build ✓ · deterministic unit+integration suite (65) ✓ · focused regression over changed-surface suites (
store/e2e-compress-cascade/issue453-backstop/fork-ccr-adoption/cache-friendly-plugin/absorb-plugin/issue402/issue532, 74) ✓. Rebased onto current master (clean, no conflicts). Full regression delegated to CI.