Skip to content

[PR] decideNudge(): rotate count-triggered T2/T3 distillation nudges with ready T1 on the growth path - #2519

Open
ranxianglei wants to merge 9 commits into
masterfrom
2026-10-09_nudge-tier-slot-rotation
Open

ranxianglei wants to merge 9 commits into
masterfrom
2026-10-09_nudge-tier-slot-rotation

Conversation

@ranxianglei

@ranxianglei ranxianglei commented Oct 9, 2026 •

Copy link
Copy Markdown
Owner

kernel-change: fix structural starvation of T2/T3 distillation nudges in decideNudge() — two sub-defects of one arbitration mechanism: (A) count-triggered tiers unreachable behind the T1-first short-circuit (#2513, port of acp-kernel#510 fixing acp-kernel#509); (B) mass-leg tiers unreachable under partial T1 compliance because the mass leg demands t2Pen > t1Eff (#5698, root cause of the #5671 production incident). Host side cannot express either fix through config; owner requested the root fix in the #5671 discussion. In-repo kernel/ per #2092.

Closes #2513
Closes #5698

Problem — one mechanism, two starvation shapes

decideNudge()'s growth path short-circuits on t1Eff >= tierThresholds[1] before any higher tier can be reached, and its pressure path picks max-pending among all tiers — which keeps being T1, because T1's pending stays high precisely BECAUSE nothing folds it. Two shapes:

A (count-triggered, #2513): an explicitly lowered tiers.tier2Trigger / tier3Trigger was structurally dead in any session whose raw compressible mass stayed above the T1 threshold. Production instance (billion-context-pi#628, 256K window): 22 active T1 blocks (~8.8K summary tokens) + t1Eff 100K–400K → zero T2 nudges across the whole session.

B (mass-leg under partial compliance, #5698): the T2 mass leg requires t2Pen >= tierThresholds[2] && t2Pen > t1Eff. When a host model only partially complies with each T1 nudge (production logs: 3–6K folded per offered ~50K), t1Eff stays ≥ 50K forever, so even a T2 backlog far past its own threshold (measured: 112K vs 447K) can never win a slot — summary blocks accumulate monotonically until the session ceiling dies (#5671: floor 17%→42% over 12h, 229 active blocks, zero T2/T3 fires; one manual T2 distillation reclaims 91.6%). No config can express "prefer T2 when T1 stops delivering": tierNudgeTokens moves thresholds, not the else-if structure (verified byte-identical no-op experimentally).

Fix A: slot rotation (count-triggered tiers)

Count-ready tiers now join a rotation pool with a ready T1 on the growth path:

  • T1 keeps first pick until it has gone (nudge.lastInjectedTier !== 1);
  • then the slot hands to the count-ready tier with the oldest cadence stamp (never-shown = oldest; tie → lower tier);
  • next cycle back to T1 — strict alternation; neither side starves whether the model ignores or complies with one of them.

Rotation memory is a new OPTIONAL state field nudge.lastInjectedTier, deliberately NOT cleared by the compression-success reset (which still clears lastShownByTier/baselines): reusing the existing per-tier stamps would let a model that keeps draining raw ranges restart every tie at T1 — the exact production shape of #628. Absent field = null = legacy T1-first, so persisted pre-fix states need no migration (adapters unchanged).

Fix B: T1 harvest-stall detection (mass-leg tiers)

Make partial compliance MEASURABLE as T1-channel ineffectiveness:

  • Arm: a T1 nudge fire records the offered raw mass (breakdown.pendingT1) in state.nudge.lastT1FirePending (consume-once).
  • Measure: on successful applyCompression, realized tokensCompressed is compared against it: a distillation fold (new block tier ≥ 2) clears the stall unconditionally — progress on the higher tiers by definition; otherwise a T1-shaped fold harvesting less than STALL_HARVEST_RATIO (0.5) of the offered mass latches state.nudge.t1HarvestStall, at/above ratio clears it. No-op calls are not evidence and leave the armed measurement in place.
  • Consume: decideNudge reads the flag only when tiers.enabled:
    • growth band: stalled + a higher tier's MASS leg crossed its OWN threshold + its per-tier cadence met → that tier takes the slot BEFORE T1 (the legacy > t1Eff demand drops for this path only — the stall flag IS the evidence the lower channel cannot deliver);
    • pressure band: stalled + max(t2,t3) >= minPressureBenefit → T1 is removed from candidates so max-pending picks the tier that actually delivers; below the floor the drop would suppress the whole nudge, so legacy behavior wins;
    • reasons carry [T1 harvest stall] for observability.

Untouched by design: flat 50K growth cadence (KDD #8), the #379 mass-as-demand philosophy (the stall is consulted only once a higher tier's mass leg passed its own threshold — mass remains the need signal), #194 first-sight re-arm, the minPressureBenefit gate, and reason-string formats outside the appended marker. Eager lanes (harvest ≥ 50%) never latch, so their behavior is unchanged.

How A and B compose: the stall override sits ABOVE the #509 count-ready pool — explicit count triggers keep working independently of the flag (pinned), and per-tier cadence applies to the redirected slot exactly as before (pinned). Default triggers (1000/2000) leave the pool empty, so on stock config only B can redirect, and only after measured evidence.

Intentional behavior change (old → new)

Case Old New
Explicitly lowered tier2Trigger/tier3Trigger, met, while t1Eff ≥ T1 threshold T2/T3 nudge NEVER fires (T1 short-circuit) count-ready tier alternates slots with T1 (first slot after a T1 goes to it)
Partial T1 compliance (last successful T1-shaped fold harvested < 50% of offered mass) + T2 mass leg past its own threshold T2 NEVER fires while t1Eff stays high; summary backlog grows unboundedly (#5671 treadmill) next eligible slot goes to T2 (cadence as usual); repeats until a compliant harvest or a distillation clears the latch
Same stall, pressure band, remaining tiers clear minPressureBenefit max-pending picks T1 again T1 dropped from candidates; delivering tier runs
Stall latched but remaining tiers below the benefit floor / cadence-unmet / mass leg not ready legacy arbitration legacy arbitration (stall only redirects when a delivering channel exists)
Default triggers (1000/2000), no stall evidence T1-first cascade byte-identical (pool empty + flag absent/false; pinned)
Pre-fix persisted snapshots (both new fields absent) — byte-identical arbitration (no detection without evidence; pinned)

Why: in both shapes the arbitration consumed "big pending" as "deliverable", and T1's pending is structurally big exactly when it is NOT deliverable. A makes the explicit count demand reachable; B makes the implicit mass demand reachable once evidence shows T1 cannot serve it.

Accompanying doc fix (separate labeled commit)

TierConfig JSDoc documented "Default 5" / "Default 10"; actual defaults since #379 are 1000/2000 (kernel/src/config.ts:8). Fixed, plus README nudge section documents the rotation semantics. Same mechanism domain (#379/#509 count-path semantics); fixed in passing per the 小问题直接修 policy.

Verification (head 6cbffcd, base current master 0aace2f)

  • Kernel suite npm --prefix kernel test: 1591 pass / 0 fail, including 9 new harvest-stall rows: core latch→slot handoff, full-compliance never latches, distillation clears (even when the armed measurement was already consumed), legacy absent-flag byte-identity, pressure drop AND keep-T1-below-floor, cadence respect, no-op-not-evidence, count-trigger independence from the flag.
  • Red-check: reverting only kernel/src/{compress,types,state}.ts makes 7/9 stall tests fail (the 2 passing rows pin unchanged behavior by design). Earlier red-check for A: 5/5 rotation tests fail pre-fix.
  • Snapshot-stability follow-ups from CI rounds 2-3: fcf1e080d stores the harvest-stall flag absent-only (a clear DELETES the key instead of storing false) and 6cbffcdde drops the feat: add pi-package keyword so pi.dev gallery indexes billion-context (clean, un-bundled) #509 lastInjectedTier: null initializer (its sole reader already normalizes via ?? null) — otherwise re-hydrated legacy sessions would pick up default-valued nudge keys and drift the storage-render / storage-corpus digest pins. Verified locally: storage-corpus 9/9, kernel suite 1591/1591.
  • Root: npm run typecheck clean + npm run build green on this head; targeted bili suites (kernel-tier-defaults, compress-recovery-ranges, compress-success-tail, storage-corpus golden consumers) green locally. Full bili suite/e2e left to CI (local-testing discipline). No wire/golden changes.

Notes

awork added 2 commits October 9, 2026 19:04
…th path (#2513)

The growth path of decideNudge() short-circuited on t1Eff >= the T1 mass
threshold before ever reaching the tier-2/tier-3 count branches, so an
explicitly lowered tiers.tier2Trigger/tier3Trigger was structurally dead in
any session whose raw compressible mass stayed above the threshold
(billion-context-pi#628: 22 active T1 blocks + t1Eff 100K-400K, zero T2
nudges across the whole session).

Fix (issue direction A, ported from acp-kernel#510 fixing acp-kernel#509,
migrated here as #2513): count-ready tiers now join a rotation pool with a
ready T1 on the growth path. T1 keeps first pick until it has gone
(nudge.lastInjectedTier !== 1); then the slot hands to the count-ready tier
with the oldest cadence stamp (never-shown = oldest, tie -> lower tier) and
back to T1 the next cycle — neither side starves whether the model ignores
or complies with one of them.

Rotation memory lives in a new OPTIONAL state field nudge.lastInjectedTier,
deliberately NOT cleared by the compression-success reset (which still clears
lastShownByTier/baselines): using the existing per-tier stamps would let a
model that keeps draining raw ranges restart every tie at T1 — the exact
production shape of #628. Absent field = null = legacy T1-first, so persisted
pre-fix states need no migration.

With the default triggers (1000/2000) the candidate pool stays empty and the
legacy cascade runs unchanged — default behavior is byte-identical (pinned by
a dedicated test). The pressure path, token-mass cascade, first-sight bypass
and reason-string formats are untouched.
… -> 1000/2000 since #379)

The TierConfig JSDoc still documented "Default 5" / "Default 10" while
the actual defaults have been 1000 / 2000 ever since #379 turned the count
path off by default. Same mechanism domain as #509 (the count path's
semantics), so it rides along as its own labeled commit: fix the drifted
values and document the new rotation behavior in the README nudge section.
@github-actions

github-actions Bot commented Oct 9, 2026 •

Copy link
Copy Markdown
Contributor

📦 Built Package Artifact

Branch: 2026-10-09_nudge-tier-slot-rotation (6cbffcd)

Latest build — install this exact version

npm install -g billion-context@0.0.8208-pr.2519.18641e1

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

Recent builds (commit → version)

commit version build
6cbffcd billion-context@0.0.8208-pr.2519.18641e1 build
fcf1e08 billion-context@0.0.8202-pr.2519.cf35de2 build
cff2d79 billion-context@0.0.8198-pr.2519.86f772a build
56b68bc billion-context@0.0.8196-pr.2519.98ea45a build

Download artifact

  1. Download the artifact from the Actions run
  2. Extract the tarball and install:
tar xzf billion-context-pr2519.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] 🏷 Review complete. Evidence: branch sits on current master 7268bba1f (no stale base); full 7-file diff read segment by segment; local run of the kernel suite on the PR head confirms 1280 pass / 0 fail; red-check confirmed — reverting only kernel/src/compress.ts to master fails exactly the 5 rotation tests (44/5 in nudge.test.ts) while the default-drift pin passes pre-fix by design; CI 25/26 green at check time (kernel-guard, version-guard, lane-guard, docs-sync, all e2e lanes, both ubuntu test matrices — only windows-node22 still in_progress).

结构化八问

  1. 是什么问题:显式调低 tier2Trigger/tier3Trigger 后,count 触发的 T2/T3 distillation nudge 在 raw compressible mass 持续高于 T1 阈值的会话里永远不触发——trigger 配置形同虚设。
  2. 什么原因导致的:根因在决策点顺序而非阈值——growth path 仲裁存在结构性 T1 短路:t1Eff >= threshold 直接返回 T1,count-ready 分支在 t1Eff 持续高时不可达。生产形态(billion-context-pi#628:22 个 T1 block、t1Eff 100K–400K、整场 0 次 T2 nudge)即此机制的直接产物。表面症状是「T2 nudge 不响」,病因是仲裁结构,修法因此落在 decideNudge 内部而不是加旁路。
  3. 影响范围与严重程度:仅「显式调低 trigger + t1Eff 持续高位」的会话(大窗口长会话的 pi/dsh 用户)——distillation 完全失效、上下文持续膨胀;默认 trigger(1000/2000)用户字节级无变化(pool 恒空 → 走 legacy cascade)。特定条件下功能失效,非数据丢失。
  4. 怎么修复的:在决策点修,不堵症状——growth path 内建显式 count 候选池(countReady + 该 tier cadence 已满足),不受 t1Eff 影响;槽位轮换:T1 保留首轮优先(lastInjectedTier !== 1),之后交给 cadence stamp 最老的 count-ready tier(never-shown = 最老,tie → 低 tier),下轮回到 T1。reason 字符串逐字沿用 legacy 格式;token-mass 路径保留 legacy cascade(fix: merge all system/developer messages into one leading message (SGLang #377) #379 的 implicit-vs-implicit 语义不动)。
  5. 是否有回归问题:无。触碰路径既有行为逐项清点:pressure/over-limit 路径(逻辑未动,仅在注入处同步盖 lastInjectedTier 戳,只影响后续 growth-path 排序)/ token-mass cascade(pool 空时原样保留)/ first-sight mass bypass(growthReady 构成未变)/ flat-50K cadence 契约(growthFloor 语义不变,每增长一个 floor 仍只发一次 nudge,不分 tier)/ 默认 trigger(pin 测试钉住字节级一致)/ 持久化(lastInjectedTier 为可选字段,absent→null→legacy T1-first,无迁移,旧 adapter 忽略多余键)/ golden 与 wire(无 golden 变更,reason 格式不变)/ terminalStreak、minPressureBenefit、emergency(未触碰)。一处一致性观察:host 侧 reanchorNudgeOnUsageDrop(src/session.ts:535)同样不清 lastInjectedTier——与 kernel 侧语义一致,最坏情形是 usage-drop 重锚后多一轮 distill 槽,不会饿死(oldest-stamp 逻辑主导),判定为有意设计而非遗漏。
  6. 是否破坏缓存:不涉及。tier 选择不触及 prefix-cache 机制(head system 稳定性、acp_summary 锚定均不变);无重试/去重/游标变更。
  7. 是否改了设计方向:不涉及。现有仲裁函数内的槽位轮换 + 一个可选内部状态字段,无架构/边界/数据流转向。两种压缩模式均已推演:决策是 mode-agnostic 的 kernel 逻辑,pluginMode 仍由 host 抑制 nudge 注入,proxyMode 载体(acp_summary)不变。
  8. 是否引入了新的配置:不涉及。无新 env/config 字段,lastInjectedTier 是内部状态而非 config surface。版本动的是 kernel 自身版本(0.0.109→0.0.110,CI 强制的 kernel 版本纪律),根 package 版本未动。

行为变更清单(与 PR 正文披露一致):显式调低 trigger 的会话——旧:T1 在 t1Eff ≥ 阈值期间永远独占 → 新:T1/T2/T3 槽位轮换(T1 首轮优先保留,其后 oldest-stamp count-ready tier)。默认配置会话:无变化(字节级)。

顺手小修(已在 PR 分支补两个独立标注 commit,本地验证:nudge 50/50、kernel 全套 1281/0、typecheck clean):

  • kernel: align re-wrapped comment indent in decideNudge — compress.ts:1820-1829 注释换行残留 3 空格缩进,恢复与周围代码一致的 2 空格。
  • kernel: pin dual count-ready pool selection — 补缺失测试:多候选选择循环(T2+T3 同时 count-ready)原本零覆盖,钉住「oldest-stamp 胜过低 tier」与「tie → 低 tier」。首个草稿断言写错(期望 T2 实际得 T1)——该失败本身反向验证了「distill 后下一轮槽位正确交还 T1」的交替语义,修正 setup 后通过。

判定:方向打到根因、回归清点干净、行为变更已按旧值→新值披露、证据链完整(本地红绿双向 + CI)——可合。kernel/ 变更按 Kernel Boundary 属 human-only(不可 auto-merge),请手动合并:#2519 (上述两个 review commit 推送后 CI 会在新 head 上重跑,全绿即可合。)

ci-check added 2 commits November 5, 2026 11:26
# Conflicts:
#	kernel/package.json
#	kernel/src/types.ts
#	package-lock.json
…5698)

When a host model only partially complies with T1 compression nudges
(folds a few K of the offered mass each time), decideNudge's growth
cascade starves T2/T3 distillation forever: the T2 mass leg demands
t2Pen > t1Eff behind a T1-first short-circuit, so a persistently high
t1Eff makes the distillation slot structurally unreachable even after
its own threshold passes — summary blocks accumulate monotonically
until the session ceiling (#5671 production incident; #5698 root cause).

T1 harvest-stall detection:

- A T1 nudge fire records the offered raw mass (breakdown.pendingT1)
  in state.nudge.lastT1FirePending (consume-once).
- On successful applyCompression, realized tokensCompressed is compared
  against it: a distillation fold (new tier >= 2 block) clears the stall
  unconditionally; otherwise a T1-shaped fold harvesting less than
  STALL_HARVEST_RATIO (0.5) of the offered mass latches
  state.nudge.t1HarvestStall, at/above ratio clears it. No-op calls are
  not evidence and leave the armed measurement in place.
- decideNudge consumes the flag only when tiers.enabled: in the growth
  band a stalled T1 yields its slot to a cadence-met T2/T3 whose own
  mass threshold is met (the legacy "> t1Eff" demand drops for this
  path); in the pressure band the stall removes T1 from candidates when
  max(t2,t3) clears minPressureBenefit, so arbitration picks the tier
  that actually delivers. Reasons carry "[T1 harvest stall]".

Composes with the #509 count-trigger slot rotation already on this
branch: the stall override sits above the count-ready pool, explicit
count triggers keep working independently of the flag, and per-tier
cadence applies to the redirected slot as usual.

Untouched by design: flat 50K growth cadence (KDD #8), the #379
mass-as-demand philosophy (the stall is consulted only once a higher
tier's mass leg crossed its own threshold), #194 first-sight re-arm,
and the minPressureBenefit gate. Compatibility: both new state fields
are optional — pre-fix snapshots lack them, detection stays off, and
arbitration is byte-identical (pinned). Eager lanes never latch.

Tests: kernel/tests/nudge.test.ts +9 rows (core latch to slot handoff,
full-compliance never latches, distillation clears, legacy absent-flag
byte-identity, pressure drop/keep, cadence respect, no-op-not-evidence,
count-trigger independence). Red-check: 7/9 fail without the fix.
@ranxianglei ranxianglei changed the title decideNudge(): rotate count-triggered T2/T3 distillation nudges with ready T1 on the growth path [PR] decideNudge(): rotate count-triggered T2/T3 distillation nudges with ready T1 on the growth path Nov 5, 2026
The nudge-slot-rotation change bumped kernel/package.json to 0.0.181 but
left kernel/package-lock.json echoing 0.0.180. lock-sync regenerates the
kernel lockfile (npm install --package-lock-only) and fails on any drift,
so the job went red. Regenerate so the two version fields agree again.
Pure lockfile sync — no dependency or semantic change.
@ranxianglei

Copy link
Copy Markdown
Owner Author

🤖 Powered by ework · qwen3.8-27b

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

lock-sync 红灯已修复并推回 PR 分支(新 head cff2d7928)。

是什么问题:这个 PR 把内核版本从 0.0.180 升到 0.0.181(kernel/package.json —— 内核源码改动按 Kernel Boundary 规则必须升版本),但漏了同步 kernel/package-lock.json,锁文件里两处版本号还停在 0.0.180。CI 的 lock-sync 用 npm install --package-lock-only 重生成内核锁文件再对 diff,发现版本号不一致就报红。

什么原因导致:升了 package.json 版本号却没重新生成对应 lockfile(两者版本号必须一致)。纯机械遗漏,不是逻辑错误。根目录 package-lock.json 是干净的,只有内核锁文件漂了。

影响范围与严重程度:只卡住本 PR 的 CI(lock-sync 红),不影响任何运行行为或最终用户;属于发版流程里的锁文件一致性门禁,不是功能缺陷。

怎么修复的:在 PR 分支上重新生成 kernel/package-lock.json(和 CI 完全同一条命令),让版本号回到 0.0.181 与 package.json 对齐,单独提一个 commit。纯锁文件同步,零依赖变更、零语义改动。

是否有回归问题:无。改动只有内核锁文件里两行版本号回显(0.0.180→0.0.181),不碰任何依赖解析或代码路径;本地连跑两次重生成幂等、无残留 diff。

是否破坏缓存:不涉及。纯 manifest 版本字段,与运行时缓存/重试/游标无关。

是否改了设计方向:不涉及。只是补齐一次漏掉的锁文件再生成。

是否引入新配置:不涉及。无新增 env/config/默认值。

验证:新 head cff2d7928 上 lock-sync = completed/success;其余前置门禁(kernel-guard / version-guard / pi-subagents-guard / lane-guard / docs-sync / docs-coverage / unused-exports / test-import-graph / plan)全部绿。剩余 test 分片 + static-gates 仍在跑(全量套件,不在本次红灯范围内)。

判定:本次红灯(lock-sync)已闭环,PR 无合并冲突,可等全量测试收尾后由人工合并。

@ranxianglei

Copy link
Copy Markdown
Owner Author

🤖 Powered by ework · qwen3.8-27b

🔶 需要决策
(ai: vllm-qwen/qwen3.8-27b)

PR #2519(head cff2d7928)现在 test 全 11 个分片红。上一轮我已把能机械修的 lock-sync 修掉并转绿(见上条);这一轮是测试套件失败,我把根因逐条查清后判断它不属于「小机械修复」范围,按规则停手等拍板,并已打 needs-decision 标签。

逐条定性(基于 CI 日志失败签名 + PR diff)

① storage-render golden ×4(chat/anthropic/responses/google)——本 PR 自身特性导致,属预期副作用
失败签名只漂在 nudge 这一个 state-key:state-key divergence: nudge=cd7db6f0… (golden 643217067e…)。
根因:本 PR 给持久化的 NudgeState 新增了可选字段 t1HarvestStall(kernel/src/state.ts 的 createInitialState() 初始化为 false,kernel/src/types.ts 声明),会话状态的序列化 digest 因此变化 → 与已提交的 golden 快照对不上。这是特性的预期结果,不是数据损坏。错误信息本身也给了处置:node --import tsx scripts/update-storage-render-goldens.ts,审阅 diff,并在 PR 正文说明理由。
→ 重生成 golden = 为一个 kernel 行为改动提交快照变更,且理由应由 PR 作者在本 PR 正文给出(§7.3 wire-contract-ledger / §7.4 kernel 人工把关)。CI 工程师擅自代做会掩盖「diff 里除新字段外是否还有意外数值漂移」的风险,不在我的授权内。

② #2817 persona cross-wire(main.stats.requests 期望 9 实得 8)——provenance 未定
断言的是主会话请求计数(tests/issue2817-crosswire-persona-fold.test.ts:196)。本 PR 只改了 decideNudge 档位轮转 + applyCompression 的 stall 计量,没碰 persona fork / session-id 路由,机制上看不出与本特性的直接因果。可能是 master 继承红 / flaky / 真实回归,需本地定向重跑才能定性。

③ #5418 watermark fastpath A/B(B stamp 0: measured wire total null !== 2)——基本排除由本 PR 引起
本 PR 完全没碰 watermark/fastpath 盖戳代码(src/server/fastpath-scan.ts、pf-* 握手)。更可能是 hermetic 双代理 harness 的时序 flaky,或 master 侧继承红。

为什么我不直接修

  • ① 的 golden 重生成需作者确认并写理由(kernel 面,人工把关);盲重生成可能掩盖真实回归(违「疏不堵」原则)。
  • ②③ 要本地 npm install+build+定向重跑才能量性,占用共享舰队资源;且无论结论如何,处置权都在作者/owner,不在自动修车道。
  • ci-fixes 哨兵分支当前落后于 master(0 commits ahead),没有可合并的现成 master 修复,「继承红 → merge ci-fixes」这条路走不通。

选项

默认(不回复时):按 A —— 等 PR 作者补 golden 重生成 + PR 正文理由 + 本地重跑定性 ②③;在此之前我不再动该 PR 分支。

收工判定

本轮:lock-sync 机械修复已完成并转绿(cff2d7928);test 全红的根因 = 本 PR 自身的 kernel 特性(新增持久化字段)+ 两条待定性测试,超出小机械修复范围 → 已打 needs-decision,停手等待拍板。

…able (#5698)

A stored false serializes into every measured session's persisted nudge
state and drifts the storage-render goldens for zero information; an
initializer in createInitialState did the same for fresh sessions.
Absent-only storage: a latch stores true, a clear deletes the key (the
createInitialState default is likewise omitted). Consumers already test
=== true, so behavior is unchanged and feature-inactive snapshots stay
byte-identical to pre-feature ones — no golden regeneration needed.

@ranxianglei ranxianglei left a comment

Copy link
Copy Markdown
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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

结论:findings-only,不 approve。 本 PR 触碰 kernel/**(compress.ts / state.ts / types.ts)且正文首行带 kernel-change: 声明 —— 按 Kernel Boundary(AGENTS.md「Kernel Boundary」§1「Declare before you touch」+ §3「Human-only review, always」)与本次审核 HARD RULE,kernel 变更一律 human-only、agent 不得 approve。技术面我已独立审完:实现正确、方向成立、测试有牙、无阻塞性缺陷;是否合入需 owner 授权。已在下方补「🔶 需要决策」评论并打 needs-decision 标签。

结构化八问

  1. 是什么问题:decideNudge() 的 tier 仲裁在两种形状下结构性饿死 T2/T3 蒸馏 —— (A) growth 路径 T1-first 短路,使显式调低的 tier2Trigger/tier3Trigger 在 raw pending 持续 ≥ T1 阈值的会话里永远够不着(#2513,生产实例 billion-context-pi#628:22 个 T1 块 + t1Eff 100K–400K → 全程零 T2 nudge);(B) T2/T3 mass 腿要求 t2Pen > t1Eff,模型部分顺从(每次只折 3–6K)时 t1Eff 恒 ≥ 50K,mass 腿永不满足、摘要块只增不减直到顶死会话(#5698,#5671 生产事故根因)。
  2. 什么原因导致的:仲裁把「pending 大」误当「可交付」。T1 的 pending 恰恰在它不可交付时最大 —— T1-first 短路 + > t1Eff 门槛把这个自相矛盾固化了。#5698 实验证明宿主配置改不动(stopgap tierNudgeTokens.t2=30000 与 baseline 逐字节相同),只能在 kernel 调度层修。
  3. 影响范围与严重程度:#5698 为 p1(会话被顶死;生产 floor 17%→42%/12h、229 活跃块、零 T2/T3 触发;手工一次 T2 蒸馏回收 91.6%);#2513 为 p2(显式低触发器形同虚设)。两者都只在「raw pending 长期高 + 模型部分顺从 / 显式低触发器」下触发,默认配置不受影响。
  4. 怎么修复的:A = growth 路径把 count-ready tier 拉进与 ready T1 的轮转池(T1 先选一次 → 交给最老 cadence stamp 的 count-ready tier,never-shown=最老、tie→低 tier → 再回 T1,严格交替),轮转记忆用新可选字段 lastInjectedTier(刻意不随压缩成功复位,防模型反复抽干 raw range 把每次平局重置回 T1);B = T1 收获停滞检测 —— T1 nudge fire 时记下 offered pendingT1(consume-once),下次成功折叠按 tokensCompressed/offered < 0.5 判停滞(蒸馏折叠无条件清除;no-op 不算证据),停滞后 mass 腿过自身阈值即抢 slot(此路径专属地放宽 > t1Eff)、pressure 档在剩余 tier 能过 minPressureBenefit 时把 T1 移出候选(低于 floor 则保持 legacy,避免整条 nudge 被抑制)。
  5. 是否有回归问题:逐项核过既有行为 —— flat 50K cadence(KDD #8)未动;#379 mass-as-demand 未动(stall 只在 mass 腿已过自身阈值后才被咨询,mass 仍是 need 信号);minPressureBenefit gate 未动;reason 串仅在新增 [T1 harvest stall] 标记处追加。默认触发器 (1000/2000) 下轮转池为空 → 逐字节不变(有测试钉);旧持久化快照缺新字段 → 走 legacy 仲裁(有测试钉)。未见无意回归。
  6. 是否破坏缓存:不涉及。纯仲裁决策改动,不动 wire/golden/前缀渲染;diff 无任何 wire/golden 文件。
  7. 是否改了设计方向:不改架构,只在既有仲裁阶梯内加两条可达路径 + 三个可选内部状态字段。数据流不变。
  8. 是否引入新配置:不引入新的用户配置项。复用既有 tiers.tier2Trigger/tier3Trigger + nudge.tierGrowthTokens.{t1,t2,t3}。新增的 lastInjectedTier/lastT1FirePending/t1HarvestStall 是 kernel 内部状态字段(全部 optional,absent=legacy),非配置面。

独立核验记录(非照抄 issue 结论)

  • 控制流端到端追读 kernel/src/compress.ts:2240-2356(growth 阶梯)+ :2196-2239(pressure 档 drop-T1)+ :875-896(applyCompression 收获停滞测量)+ :1518-1526(nudgeNode 武装 lastInjectedTier/lastT1FirePending):A/B 两路均正确落地;config.tiers.enabled=false 退化为纯 T1(不变);所有新字段读法都是 === true / ?? null / ?? 0,缺省即 legacy。
  • 迁移安全:三新字段全 optional(types.ts:133-155),createInitialState() 显式初始化(state.ts),宿主水合 src/state-hydration.ts:31 用 { ...fresh.nudge, ...(parsed.nudge ?? {}) } spread —— 旧态载入得安全缺省、新态往返完整;宿主 abort-absorb 路径(src/session.ts:1056-1057)刻意不动这三字段(abort = no-op,与 kernel no-op 语义一致,正确)。
  • 测试有牙:kernel/tests/nudge.test.ts 每个 gate 都双向断言(latch / never-latch、drop-T1 / keep-T1-below-floor、cadence respect、no-op-not-evidence、count-independence-from-flag),并对默认配置与 legacy 快照各有一行逐字节钉;red-check 声明 revert compress/state/types → 7/9 stall + 5/5 rotation 失败(2 个通过行按设计钉住不变行为)。非恒真断言。
  • verif 守卫(KDD #14):compress.ts 在守护清单内(verif/guarded-files.ts:13),但新增构造(for-loop / non-null / .some / .has)在该文件里早已大量存在(pre-PR 已有 32 个 for (、3 个 non-null-dot、.some×3、.has×13),不构成子语言越界 → subset-guard 不会因本 PR 新红。(本地未能实跑该守卫:此工作区未装 tsx,属环境限制而非代码问题;该守卫随在途 CI test shard 跑。)
  • 版本纪律:kernel 0.0.180 → 0.0.181,lockfile 同步 —— 末 commit cff2d7928 修了一处真实的 lock-sync red(package.json 已 bump 而 kernel/package-lock.json 仍 echo 0.0.180)。
  • 顺手文档修(独立标注 commit 0b71a9578):TierConfig JSDoc “Default 5/10” → “Default 1000/2000 (#379)”,已对 kernel/src/config.ts:8 核实属实(真实默认即 1000/2000)。

一处设计取舍(非缺陷,已文档化 + 钉测)

stall override 位于 #509 count-ready 池之上 —— 同时存在 latched stall 与 count-ready tier 时,mass-leg stall 路径优先于 count 轮转。正文「How A and B compose」与测试(#5698 × #509)都已说明并钉住,属有意为之,非疏漏。

CI(读镜像缓存,未轮询 gh)

关键门禁已绿:kernel-guard ✅(校验 kernel-change 声明 + 版本纪律)、gate ✅、test-import-graph ✅、mysql-contract ✅;全量 test shard(ubuntu/windows × node22/24,含 verif 守卫)+ static-gates 仍在途(13 pending)。合入判定以在途 head 全绿为准。

阻塞项

仅 kernel-change 授权边界(HARD RULE),非技术缺陷。技术面我认为可合。请见下方「🔶 需要决策」评论走 owner 授权流程。

@ranxianglei

Copy link
Copy Markdown
Owner Author

🔶 需要决策

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

请 owner 授权本 kernel 变更合入。本 PR 触碰 kernel/** 且正文带 kernel-change: 声明,按 Kernel Boundary(AGENTS.md「Kernel Boundary」§1/§3)与审核 HARD RULE,kernel 变更为 human-only、agent 不得 approve。技术面我已独立审完、无阻塞缺陷(详见上方 findings-only review),仅卡在授权边界。

选项:

  • A 授权合入 —— 技术面已核(实现正确、默认配置逐字节不变、旧快照迁移安全、测试有牙)。建议 A。
  • B 回滚或要求补充(如需要我把某一取舍再拆细,例如 stall override 与 count-ready 池的优先级顺序)。

@ranxianglei

Copy link
Copy Markdown
Owner Author

🤖 Powered by ework · qwen3.8-27b

🔶 需要决策
(ai: vllm-qwen/qwen3.8-27b)

CI 状态更正 + 归因边界(接我前两条诊断;head 已推进到作者的 fcf1e080d「absent-only 存 t1HarvestStall」快照稳定化修复)。

先摆正一处过时信息:授权请求里写「全量 test shard … 在途」。实际 run 41971511702(head_sha 确认 = fcf1e080d)已跑完并判红,11 个分片全红。此刻「授权合入」= 合入一个红构建。kernel 授权本身是你的决定、我不碰;我只把 CI gate 的真实状态报准供你判断。

红的构成

  1. storage-render golden ×4(chat/anthropic/responses/google)——确定性失败,只漂在 nudge 这一个 state-key。作者 absent-only 修复后产出 digest 从 cd7db6f0→02af9f8f,仍 ≠ golden 的 643217067e。二选一、需作者定:①测试语料真触发了 stall(t1HarvestStall=true 被持久化)→ 该快照必须重生成并在 PR 正文写理由;②语料未触发 → 说明 golden 相对 master 已陈旧(继承漂移)。这是本特性自己的持久化面,非我能代做的机械步骤。
  2. storage-corpus(round-trip/twinfile/zstd)+ storage-engine full-mode restart ×4 + dsh-guard stamping ×2 + [Bug] dsh 车道切模型 fork 出的 _sub: 会话不继承父会话 fold 块:上游上下文从 ~83K 瞬间膨胀到 794K、命中归 0、节省转负(0.1.187/0.1.188) #2817 persona(requests 9→8)+ [Bug][dsh] Plugin lane performs a full re-parse and resends the entire body every round (81 MiB → hundreds of MB AST), w | [Bug][dsh] plugin 车道每轮全量解析重发 body(81 MiB→数百 MB AST)是 #5403 OOM 的生产者:用水位线断言替换逐条复核,服务端只解析新增尾段 #5418 watermark(B stamp null)——落在本 PR 窄 kernel diff(compress/state/types.ts)没碰的子系统(unified-storage / dsh / persona / watermark),看不到与本特性的直接因果。我无法干净归因:master 主 CI(workflow「CI」)近期没有可参照的绿基线——最近两次是 cancel/failure(旧 commit c9ba4856),当前 tip 0aace2f20 上没有已完成的绿主 CI;ci-fixes 哨兵又落后于 master(0 commits ahead,无可合并的现成修复)。这批更可能是继承红或 flaky,需一条干净的 master 基线或本地定向重跑才能分清。

为何停手:小机械修复边界内没有可落地的修法——golden 重生成是作者对自己特性的取舍;第 2 组归因未定且处置权在作者/owner;ci-fixes 走不通。needs-decision 标签已在位。

选项

默认(不回复时):按 A —— hold 合入;作者处理 golden;第 2 组转 #4599 求 master 基线;期间我不再动该分支。

收工判定:本轮无新增代码改动(作者已自行推 fcf1e080d);我把 CI 实际状态摆正(红、非在途)、给出红的构成与归因边界,维持 needs-decision 等待拍板。

…tay stable (#5698)

The #509 rotation memory was initialized to null in createInitialState.
Newer master hydration fills missing nudge keys from the fresh defaults,
so every re-hydrated legacy session picked up nudge.lastInjectedTier=null
and all nine storage-corpus digest pins drifted (folded/twinfile/zstd red
in CI). The sole reader already normalizes via (lastInjectedTier ?? null),
so dropping the initializer is behavior-neutral: absent = never injected =
legacy T1-first, and undefined keys drop out of persisted snapshots.
@ranxianglei

Copy link
Copy Markdown
Owner Author

🤖 Powered by ework · qwen3.8-27b

[bot] 🏷 PR review lane complete (ai: vllm-qwen/qwen3.8-27b).

判定:不 approve(HARD RULE — kernel 变更)。 本 PR 触碰 kernel/src/{compress,state,types}.ts 且正文带 kernel-change: 声明 → 按 Kernel Boundary §1/§3,kernel 变更为 human-only,agent 不得 approve。技术面独立审完:实现正确、方向成立、测试有牙、无阻塞缺陷。

已产出:

  • findings-only GitHub review(event=COMMENT):端到端追读 growth 阶梯 / pressure drop-T1 / 收获停滞测量 / nudge 武装;核验迁移安全(3 个新可选 NudgeState 字段 + 宿主水合 spread + abort-absorb 不动新字段);默认配置逐字节不变与旧快照回退均有测试钉;版本纪律 0.0.180→0.0.181 + lockfile 同步。
  • 🔶 需要决策 评论:请 owner 授权合入(选项 A 批准 / B 回滚,建议 A)。
  • needs-decision 标签已打。

方向关:通过。 #2513(p2,count-trigger 饿死→Fix A slot rotation)+ #5698(p1,#5671 生产根因→Fix B harvest-stall);两者均被实验证明宿主配置修不动,正确落在 kernel 仲裁层。

CI: 关键门禁绿(kernel-guard/gate/test-import-graph/mysql-contract),全量 test shard + static-gates 在途。合入以在途 head 全绿为准。

下一步:等 owner 对 kernel-change 拍板。 无小问题需顺手修,未开新 issue。

@ranxianglei

Copy link
Copy Markdown
Owner Author

🤖 Powered by ework · qwen3.8-27b

🔶 需要决策
(ai: vllm-qwen/qwen3.8-27b)

进展(接前两条):作者连续两个 absent-only 修复(fcf1e080d t1HarvestStall、6cbffcdde lastInjectedTier)已把本特性自己的持久化面清干净——我在 6cbffcdde 的 ubuntu22‑shard1 上确认 storage-render golden ×4 已转绿;按 6cbffcdde 提交说明,lastInjectedTier 被 master hydration 回填成 null 也正是那九条 storage-corpus digest pin 漂移的根因,应一并修复(其余分片仍在跑,待全矩阵确认)。

现在只剩 3 条红,且都落在本 PR 窄 kernel diff 没碰的子系统:

这 3 条在分支所有 head(cff2d7928 / fcf1e080d / 6cbffcdde)上逐字同红,而 PR 的 diff 只动 compress/state/types.ts(nudge 逻辑),不碰 dsh/persona/watermark —— 高度指向继承自 master(master 主 CI 近期本就是 cancel/failure,无绿基线可参照),不是本 PR 的回归。

我的判断:本 PR 自身引入的红(storage-render / storage-corpus golden)已被作者根治;剩下 3 条是 master 侧问题,不该拿它们卡本 PR 的合并。

选项

默认(不回复时):按 A —— 记为继承红、转 #4599、不阻塞本 PR;期间我不再动分支。

收工判定:本轮无代码改动(作者自行推进至 6cbffcdde);我确认了作者的修复已清掉本特性的 golden 红、并把剩余 3 条定性为疑似继承 master 红,给出 A/B/C 等待拍板。

@ranxianglei

Copy link
Copy Markdown
Owner Author

🤖 Powered by ework · qwen3.8-27b

🔶 需要决策
(ai: vllm-qwen/qwen3.8-27b)

重复触发、head 与 run 未变(仍 6cbffcdde / run 41977712072),但全部分片现已跑完,我据此把上一条里「待全矩阵确认」的部分补齐了:

作者的两个 absent-only 修复已清掉本特性全部持久化面红(两个分片逐一核实):

全矩阵现在只剩同一批继承红(都落在本 PR 窄 kernel diff 没碰的子系统 dsh/persona/watermark):dsh-guard stamping(跨多个分片)、#2817 persona(requests 期望 9 实得 8)、#5418 watermark(B stamp null)。它们在所有分支 head(cff2d7928/fcf1e080d/6cbffcdde)上逐字同红,而 PR diff 只动 compress/state/types.ts(nudge 逻辑)、不触碰这些代码路径 → 判定为继承自 master,非本 PR 回归。

决策不变(接上一条 A/B/C,此处压缩复述以便独立阅读):

默认(不回复时)= A。needs-decision 标签已在位。

收工判定:本轮无代码改动(作者自行推进至 6cbffcdde);全矩阵跑完后我补齐了「存储 golden 已全绿」的确认,剩余收敛到 3 条疑似继承 master 红,维持等待拍板。

@ranxianglei

Copy link
Copy Markdown
Owner Author

🤖 Powered by ework · qwen3.8-27b

[ework] auto-fix stalled: test (windows-latest, 22, 4), test (ubuntu-latest, 24, 1), test (ubuntu-latest, 22, 1), test (ubuntu-latest, 22, 2), test (windows-latest, 22, 3), test (windows-latest, 22, 2), test (ubuntu-latest, 24, 3), test (ubuntu-latest, 22, 3), test (ubuntu-latest, 24, 2), test (windows-latest, 22, 1) — stopping for human review

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