Skip to content

fix(config): make tier-2/3 distillation reachable by default (closes #628) - #629

Open
ranxianglei wants to merge 1 commit into
masterfrom
2026-10-07_tier-trigger-defaults
Open

ranxianglei wants to merge 1 commit into
masterfrom
2026-10-07_tier-trigger-defaults

Conversation

@ranxianglei

@ranxianglei ranxianglei commented Oct 7, 2026 •

Copy link
Copy Markdown
Owner

Closes #628

What this changes

Behavior change disclosure: the adapter-level effective tier-distillation count-trigger defaults change from the kernel framework defaults:

Setting Old (effective) New (effective)
tiers.tier2Trigger 1000 (kernel default — count path effectively off) 10
tiers.tier3Trigger 2000 (kernel default — count path effectively off) 20

Why: under the kernel defaults, tier-1 summaries accumulate without bound. The token-mass path (tier2Threshold = nudgeGrowthTokens × 1.5 = 75K and t2Pen > t1Eff) is unreachable at realistic summary sizes (~400–2K per block), and the growth path's T1-first ordering keeps firing T1 nudges while ≥50K compressible messages exist. Production evidence (#628): session 01a11102, 256K window, 22 active tier-1 blocks over ~200 turns → ~570K per request, window overflow every turn, zero tier-2 nudges ever fired.

10/20 restores the pre-acp-kernel#379 2:1 ratio. Re-triggering is bounded by the kernel's per-tier cadence guard (at least one growth floor of new tokens between same-tier re-nudges), so the cache-sawtooth concern that motivated #379 does not recur at this cadence.

What does NOT change:

  • The acp-kernel pin stays 0.0.98; kernel framework defaults are unchanged — other hosts are unaffected. This is an adapter-level effective default only.
  • tier2GrowthMultiplier stays 1.5: the count path becomes primary, the mass path remains a secondary backstop.
  • Explicit coreOverrides.tiers.* always win over the Pi effective defaults (per key). Anyone who wants the kernel's count-off behavior passes { tiers: { tier2Trigger: 1000, tier3Trigger: 2000 } }.

Implementation

Single insertion point in resolveConfig() (src/config.ts): right after defaultConfig(limit, overrides), apply tier2Trigger = 10 / tier3Trigger = 20 unless the caller explicitly set them via coreOverrides.tiers. All config consumers already funnel through runtime.configFor() → resolveConfig(), so the rewrite-guard recovery hint in tierReadyHint (src/compress-tool.ts) consistently picks up the new thresholds. Docs: dedicated section added to CONFIGURATION.md + CONFIGURATION.zh-CN.md.

Evidence

  • New tests/tier-triggers-default.test.ts — 4 tests:
    • default assertions (10/20, tiers.enabled untouched);
    • explicit coreOverrides.tiers.* win per key;
    • behavioral repro through the real pipeline: 20 messages → 10 real applyCompression pairs → 10 active tier-1 blocks → processTurn fires nudge.tier === 2 with reason "T2 distill ready: 10 tier-1 blocks >= tier2Trigger 10";
    • control: identical session state stays silent under kernel framework defaults (pins the original defect).
  • Targeted suite (config / tier / e2e-config / user-config — 7 files): 114/114 pass. Typecheck + build clean. Full regression left to CI.

Related

  • Kernel-side scheduling counterpart (growth-path T1-first ordering starves T2/T3 even when triggers are met): now tracked in billion-context, where the kernel code lives — issue #2513 (migrated from acp-kernel#509 per owner instruction), fix PR #2519 (open, nudge.lastInjectedTier slot rotation). Complementary to this PR: #2519 makes the scheduler honor count-ready T2/T3 under sustained high t1Eff; this PR makes the count trigger itself reachable (10/20 instead of 1000/2000). acp-kernel#509 / acp-kernel PR#510 remain open per owner decision.
  • Note: per AGENTS.md §7.4 this changes a fallback/default value (product decision) — human merge required.

@github-actions

github-actions Bot commented Oct 7, 2026 •

Copy link
Copy Markdown
Contributor

📦 Built Extension Artifact

Branch: 2026-10-07_tier-trigger-defaults (fad9b79)

Option A — Install from npm PR tag (recommended)

pi install npm:billion-context-pi@pr-629

Each push to this PR publishes a new version under the pr-629 npm tag.

Option B — Download artifact

  1. Download the artifact from the Actions run
  2. Extract the tarball and install:
tar xzf billion-context-pi-pr629.tgz
pi install ./package

This comment is automatically updated on each push.

@ranxianglei
ranxianglei force-pushed the 2026-10-07_tier-trigger-defaults branch from 5ad882a to fad9b79 Compare October 7, 2026 11:21
@ranxianglei

Copy link
Copy Markdown
Owner Author

🤖 Powered by ework · qwen3.8-27b

[bot] 🏷 PR 核对完成:已 rebase 到当前 master,验证通过,等 CI 绿后可人工合并。

拉取分支逐条核对了 PR 描述(单一插入点、文档、4 个测试均属实),并补做了一件事:分支落后 master 18 个提交(k̂ 校准 #598/#601、host-floor freshness guard、nudge 死区等),已按 §7.2 rebase 到 f9dc713——无冲突,新 head fad9b79 已推送。rebase 后本地验证:typecheck ✅、build ✅、定向套件(config/tier/e2e-config/user-config/tier-ready-hint/enabled/surface/prompts-config 共 8 文件)132/132 绿。旧 head 的 CI 除 windows-latest(22) 外全绿,已被新 head 的 CI 取代,以新一轮为准。

结构化七问:

  1. 是什么问题:默认配置下 tier-2 蒸馏 nudge 是死代码——count / token 体量 / 相对体量三个触发条件全部不可达,tier-1 块无限堆积;生产会话(tier2Trigger: 1000 makes tier-2 distillation nudge unreachable, causing infinite tier-1 block accumulation and context bloat #628)实测每请求 ~570K、256K 窗口每轮溢出。
  2. 什么原因导致的:acp-kernel#379 为消灭缓存锯齿把 count 路径整个关掉(1000/2000),但体量路径在现实 summary 规模下同样独立不可达(summary ~400–2K/块,t2Pen > t1Eff 几乎恒假),两条路互斥后 T2 没有任何入口;增长路径上 T1-first 顺序进一步饿死 T2(已单独立项 acp-kernel#509)。
  3. 怎么修复的:适配器层面应用 Pi 生效默认 tier2Trigger=10 / tier3Trigger=20(恢复 test(compress): make multi-block afterTokens scale guard non-vacuous (#378) #379 前 2:1 比例),单一插入点在 resolveConfig(),显式 coreOverrides.tiers.* 按 key 优先;内核框架默认与钉版(0.0.98)不动,其他宿主零影响。
  4. 是否有回归问题:无。审过的既有行为:resolveConfig() 是 config 唯一漏斗(核实 src/ 内无其他 defaultConfig 调用方,runtime.configFor() 收口);tierReadyHint 随之在 10/20 块时出现——有意的一致性变更,已披露;tiers.enabled、per-tier cadence 守卫、压力路径、紧急截断均未触碰。行为变更披露:生效默认 tier2Trigger 1000→10、tier3Trigger 2000→20(PR 描述与 CONFIGURATION.md 均已列明旧值→新值+原因+逃生舱 JSON)。
  5. 是否破坏缓存:test(compress): make multi-block afterTokens scale guard non-vacuous (#378) #379 担心的锯齿不会复发——同层再 nudge 受 per-tier cadence 守卫限制(两次之间至少一个 growth floor 的新 token),且 nudge 是建议性的;tier2GrowthMultiplier 保持 1.5(count 做主、体量留 backstop),变更面最小。
  6. 是否改了设计方向:无架构转向。一个产品级决策:Pi 从内核框架手里接管「count 触发生效默认」(内核保持 count-off)。理由(生产先崩的是上下文而非缓存;Pi 长会话高块积累率)与逃生舱已写入 CONFIGURATION.md / .zh-CN.md 专节。
  7. 是否引入了新的配置:无新键。两个既有键的生效默认值变化(见第 4 条披露),代码级、不从 acp.json 读取,迁移成本为零。

测试有效性:新增 4 个测试有牙——默认值断言、per-key 覆盖优先、走真实管线(10 次真 applyCompression → 10 个活跃 T1 块 → processTurn 发出 tier===2、reason 精确匹配)的行为复现、内核默认下的静默对照组(把原缺陷钉死)。bug 回归时抓得住。

diff 整洁度:4 文件 +118/-0,每行都与本 PR 目的相关(代码+测试+双语文档),无跑题改动。

判定:代码与行为核对通过,rebase 干净,定向验证全绿。按 AGENTS.md §7.4,改默认值属产品决策,不走 auto-merge——CI 绿后请人工合并。

@ranxianglei

Copy link
Copy Markdown
Owner Author

🤖 Powered by ework · qwen3.8-27b

[bot] 🏷 CI 全绿确认:rebase 后的 head fad9b79(基于当前 master f9dc713)9/9 checks 全部通过——build-artifact、test (ubuntu-22 / ubuntu-24 / windows-22 / windows-24)、e2e (ubuntu / windows)、pr-validation、docker。

无回归发现,无需进一步改动。按 §7.4 等待人工合并即可:#629

This branch has not been deployed

No deployments
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.

tier2Trigger: 1000 makes tier-2 distillation nudge unreachable, causing infinite tier-1 block accumulation and context bloat

1 participant