Skip to content

[PR] kernel: screen drops units that consume a retired block (#8014) - #8022

Open
ranxianglei wants to merge 7 commits into
masterfrom
2026-11-30_issue8014-retired-recommend
Open

ranxianglei wants to merge 7 commits into
masterfrom
2026-11-30_issue8014-retired-recommend

Conversation

@ranxianglei

Copy link
Copy Markdown
Owner

kernel-change: the recommend/nudge screen (kernel/src/recommend.ts) had no retired judgment — after a block was retired it kept advertising fold units that span it, while the apply lane (compress.ts retiredConsumed) refuses any range that would consume a retired block. The top recommendation was a guaranteed rejection on every turn, violating the #3236 contract "every advertised range must apply cleanly". The host side cannot solve this: the screen and the apply guard both live in the kernel, and the fix is to make the screen mirror the apply judgment (the #3236 one-projection discipline).

Closes #8014.

What

After a block is retired (acp_retire / blockOps.enabled), screenRecommendedUnits (kernel/src/recommend.ts) kept advertising fold units whose span consumes the retired block. The apply lane (applySingleRange, kernel/src/compress.ts) refuses any range that would consume a retired block — "their summaries are out of the resident view by explicit user decision" — so the top recommendation was a guaranteed rejection on EVERY turn. The screen had no retired judgment at all (no retired reference in recommend.ts / unit-projection.ts), while applySingleRange threw on it: the #3236 contract violated through its last shape.

Fix

Mirror the apply guard in the screen: screenRecommendedUnits now drops a unit whose projection.consumedBlockIds contains a retired block, with a budgeted warnScreenDrop reason. Unconditional (no refold carve): in apply the retired guard fires BEFORE the refold route, and a refold can only target restoredInline blocks — a retired block is not restoredInline — so a legitimate refold never consumes a retired block and this drop cannot break the refold route. Non-spanning units stay advertised.

Behavior change

  • Sessions WITHOUT a retired block: no change (the new check finds nothing; the advertised set is byte-identical to before).
  • Sessions WITH a retired block: the spanning unit that was a guaranteed apply-rejection is no longer advertised; the non-spanning units are. This is the intended fix — the advertised set now matches what apply accepts.

No model-facing text change: the new string is a warnScreenDrop host-log diagnostic, not model-visible.

Tests

  • New kernel/tests/issue8014-retired-recommend.test.ts: every advertised unit applies cleanly with a retired block mid-history, plus a control that the same stretch is still advertised when nothing is retired (no over-screening).
  • Existing issue3236-recommend-apply-consistency + issue5765-retire-rewrite suites pass; kernel typecheck clean.

kernel 0.0.217 → 0.0.218.

@ranxianglei ranxianglei added bug Something isn't working p2 scope/kernel labels Nov 30, 2026
@github-actions

github-actions Bot commented Nov 30, 2026 •

Copy link
Copy Markdown
Contributor

📦 Built Package Artifact

Branch: 2026-11-30_issue8014-retired-recommend (2b4b784)

Latest build — install this exact version

npm install -g billion-context@0.0.13217-pr.8022.483cdc6

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
2b4b784 billion-context@0.0.13217-pr.8022.483cdc6 build
5c943b6 billion-context@0.0.13043-pr.8022.9d7e6e5 build
2c4d123 billion-context@0.0.12956-pr.8022.fafc2a5 build
440b8df billion-context@0.0.12920-pr.8022.9880049 build
d12a138 billion-context@0.0.12881-pr.8022.27b94cd build
083f862 billion-context@0.0.12555-pr.8022.7d4fcf7 build
c40b246 billion-context@0.0.12550-pr.8022.35c97da build
b7e424f billion-context@0.0.12543-pr.8022.651165e build

Download artifact

  1. Download the artifact from the Actions run
  2. Extract the tarball and install:
tar xzf billion-context-pr8022.tgz
npm install -g package

Install instructions are refreshed on each push.

@ranxianglei ranxianglei changed the title kernel: screen drops units that consume a retired block (#8014) [PR] kernel: screen drops units that consume a retired block (#8014) Nov 30, 2026
@ranxianglei

Copy link
Copy Markdown
Owner Author

🤖 Powered by ework · qwen3.8-27b

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

查重: 发现并行 PR — #8019 (resec, 2026-11-30 06:19Z, 先于本 PR) 修同一个 #8014;本 PR (#8022) 是第二个。两者代码现已等价(见下),需要你拍板合哪个、关哪个。agent 无权关闭 PR。

Reviewed PR #8022 (head now 083f862, based on current master c18f6b7 — no stale base). Code verdict: correct, mergeable, no blockers. Details:

① Source issue — direction verified independently.

② Regression review — existing behaviors on the touched paths:

  1. Sessions without a retired block: the new check finds nothing → advertised set byte-identical (pinned by the control test + existing issue3236 suite).
  2. Sessions with a retired block: spanning units no longer advertised (previously: advertised + guaranteed rejection every turn — the bug); non-spanning units unchanged. Intended, disclosed in the PR body.
  3. Apply lane: untouched.
  4. The nudge path is the SOLE producer of advertised ranges (compress.ts:1502); panel.ts only consumes its output (panel.ts:180) — no other surface affected.
  5. Status rows: unchanged (KDD refactor: reapOrphanBlocks should live in acp-kernel, not the proxy #12 additive flags intact). Wire: unchanged. Model-facing text: none — the new string is a budgeted warnScreenDrop host-log diagnostic.
  6. Both compression modes: the screen is mode-agnostic (kernel-internal) — no mode-specific behavior.
  7. Golden pin (tests/golden/wire-contract/kernel.json) does not cover screen behavior — no regeneration needed. Verif: recommend.ts is not in verif/guarded-files.ts — no verif obligation.

③ Code review. The new check mirrors the apply guard's judgment byte-for-byte (consumedBlockIds.filter(id => blockById(state, id)?.retired === true), same as compress.ts:1808-1809), runs on the same projectUnit projection apply executes on (#3236 discipline), and sits after the fatal check but before the "nothing foldable" and #3371 refold carve — correct precedence. No as any, no console.error, comment explains the why.

④ Test validity. Real tests with teeth, both directions (#3617 gate discipline): retired case asserts no spanning unit AND every advertised unit applies cleanly (the #3236 contract itself); control asserts the same stretch stays advertised when unretired AND applies cleanly. Verified: fails on master (reproduces), passes on the branch. Existing issue3236 + issue5765 suites: 14/14 pass locally.

⑤ Diff cleanliness. 5 files, every line on-purpose: fix (+24/-2), new test (+198), version bump, two lockfile syncs (required by the lock-sync job — the first head b7e424f actually failed lock-sync; follow-up c40b246 fixed it).

⑤b Code cleanliness. Naming mirrors the apply side (retiredConsumed), no dead code, no magic values, style consistent.

Kernel Boundary: kernel-change: declared with reason; 0.0.217 → 0.0.218 + lockfile sync; reproducing regression test; in-thread report. Compliant (mechanical-bug exemption); human-only review tier still gates the merge.

CI (verified live): green on c40b246 — 39 success / 14 skipped / 0 failures, incl. the full test matrix (ubuntu/windows × node 22/24 × shards), static-gates, kernel-guard, lock-sync. Re-running on the new head below.

顺手修 (extra fix, commit 083f862): ported the fourth test case from parallel PR #8019's suite — "a retired+restoredInline block is not advertised either (no refold exception)". It pins the degenerate corner that distinguishes the unconditional drop from a carve-out: a block that is BOTH retired and restoredInline, spanned together with a restored-inline neighbour, is exactly the shape evaluateRefold classifies "refold" — a carve-out would have kept it advertised while apply rejects it. Verified it fails on master and passes on the fix. Test-only, no behavior change.

The duplicate — your call (both PRs are open, I cannot close either):

标签: 本环境镜像 label 端点未实现(已尝试 API,返回 endpoint not implemented),无法打标;意图标签: bug / scope/kernel / p2(会话可用,仅推荐项每轮必拒)。


八问:

  1. 是什么问题:块被 retire(acp_retire / blockOps)后,nudge/recommend 屏幕仍推荐跨越该块的折叠单元,而 apply 车道拒绝任何会消费 retired 块的范围——头号推荐每轮必然被拒,违反 [Bug] recommend/apply 对同一区间的 turn-integrity 判定永久不一致:acp_status 反复推荐的区间被 apply 侧整段拒绝(0.1.196,Range would split N turn(s) at the protected-zone boundary) #3236 契约「每个被推荐的范围必须能干净应用」。
  2. 什么原因导致的:屏幕(recommend.ts)完全没有 retired 判定,apply 车道(compress.ts retiredConsumed)却有——[Bug] recommend/apply 对同一区间的 turn-integrity 判定永久不一致:acp_status 反复推荐的区间被 apply 侧整段拒绝(0.1.196,Range would split N turn(s) at the protected-zone boundary) #3236 单一投影纪律(屏幕与 apply 共用同一判定)在最后一个面上失守:retired 守卫。
  3. 影响范围与严重程度:影响所有用过 retire 的会话(blockOps.enabled + acp_retire)。严重程度 p2:会话仍可用(其他范围可正常压缩、手动操作不受影响),但头号推荐每轮必拒,模型若反复尝试会驱动重试循环;无数据丢失、不致会话不可用。
  4. 怎么修复的:把 apply 守卫镜像进屏幕——单元的 projection.consumedBlockIds 含 retired 块即丢弃(带预算化 warnScreenDrop 诊断)。无条件、无 refold 例外:apply 里 retired 守卫先于 refold 路由触发,合法 refold 不可能消费 retired 块,故该丢弃不会破坏 refold 路径。
  5. 是否有回归问题:无。逐项审过:无 retired 块的会话推荐集字节级不变(控制测试钉住);apply 车道未动;nudge 路径是推荐范围唯一生产者,panel 只消费其输出;status 行、wire、模型可见文本均不变;两种压缩模式不受影响(屏幕与模式无关);golden pin 不覆盖屏幕行为;recommend.ts 不在 verif 守护清单。
  6. 是否破坏缓存:不涉及——未触碰缓存、重试、增量游标、去重键逻辑,只影响 nudge 推荐哪些范围。
  7. 是否改了设计方向:没有。是把屏幕对齐到既有 [Bug] recommend/apply 对同一区间的 turn-integrity 判定永久不一致:acp_status 反复推荐的区间被 apply 侧整段拒绝(0.1.196,Range would split N turn(s) at the protected-zone boundary) #3236 单一投影设计(屏幕本已镜像 fatal 投影、livelock 守卫、refold 判定,本次补上最后一个缺失面 retired 守卫),无架构变更。
  8. 是否引入了新的配置:没有。无新 env/config/默认值。

判定:可合并——修复正确、最小、测试有牙(含移植的退化角落用例),CI 绿,Kernel Boundary 合规。合并权在你(kernel 变更永远 human-gated);并行 PR #8019 的取舍也等你拍板。

ci-check added 3 commits December 3, 2026 11:27
…ommendation is no longer a guaranteed apply rejection (#8014); kernel 0.0.220

The recommend/nudge screen had no retired judgment: after a block was retired (acp_retire / blockOps.enabled), screenRecommendedUnits kept advertising fold units that span it, while the apply lane refuses any range that would consume a retired block ('their summaries are out of the resident view by explicit user decision'). The top recommendation was therefore a guaranteed rejection on every turn — the #3236 contract ('every advertised range must apply cleanly') violated through its last shape: the screen never looked at retired, while applySingleRange threw on it.

Mirror the apply guard (compress.ts retiredConsumed) in the screen: drop a unit whose consumedBlockIds contains a retired block, with a budgeted warnScreenDrop reason. Unconditional (no refold carve): in apply the retired guard fires BEFORE the refold route, and a refold can only target restoredInline blocks — a retired block is not restoredInline — so a legitimate refold never consumes a retired block and this drop cannot break the refold route. Non-spanning units stay advertised.

Regression test: every advertised unit applies cleanly with a retired block mid-history, plus a control that the same stretch is still advertised when nothing is retired.
The kernel version bump (0.0.217 -> 0.0.218) propagates to both lockfiles: kernel/package-lock.json (its own version field) and the root package-lock.json (the file:./kernel reference). The lock-sync CI job fails on any drift, so the bump and its lockfile sync ship together.
…t (ported from parallel PR #8019)

The parallel #8014 PR's suite carries a fourth case this thread's test
lacks: a block that is BOTH retired and restoredInline. A unit spanning it
also consumes the restored-inline neighbour, so evaluateRefold classifies
it "refold" — the exact shape a refold carve-out in the screen would have
kept advertised. Apply's retired guard runs before its refold route, so
the unit is a guaranteed rejection and must not be advertised. Ported in
intent (adapted to this file's helpers); verified it fails on master and
passes on the fix.
@ranxianglei
ranxianglei force-pushed the 2026-11-30_issue8014-retired-recommend branch from 083f862 to d12a138 Compare December 3, 2026 03:29
@ranxianglei

Copy link
Copy Markdown
Owner Author

🤖 Powered by ework · qwen3.8-27b

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

Merge conflict resolved — PR #8022 rebased onto current master, force-pushed.

What I did this run:

  1. Verified live state first: PR [PR] kernel: screen drops units that consume a retired block (#8014) #8022 head 083f862fe5b was mergeable_state: dirty vs master; CI on that head was fully green (30 checks, 0 failed) — so the only blocker was the conflict. No [ework:ci-held] marker on the branch head (no dead session to finish).
  2. Rebased the 3 PR commits onto master@1f3fcb56367. All conflicts were version-line only (no code conflicts): master had advanced the kernel 0.0.217 → 0.0.219 (via merged [PR] kernel: keep the signature anchor when hiding a consumed compress call #8124) while the PR carried 0.0.218.
  3. Resolution: kernel bumped 0.0.219 → 0.0.220 in kernel/package.json (required — the PR touches kernel/src/**, kernel version discipline), both lockfiles (kernel/package-lock.json, package-lock.json) synced to 0.0.220, and the two commit subjects' version tags corrected 0.0.218 → 0.0.220.
  4. No code touched: the PR's own diff (kernel/src/recommend.ts + kernel/tests/issue8014-retired-recommend.test.ts) applied cleanly; the rebased head's diff vs new master is exactly the original 5-file PR (265 insertions / 5 deletions). Master's kernel changes since the PR base (compress-tools / hide-consumed / packs / surface-config) don't touch recommend.ts or unit-projection.ts — no semantic overlap.
  5. Verified locally (targeted): kernel typecheck clean; 17/17 tests pass across the three suites the PR names (issue8014-retired-recommend, issue3236-recommend-apply-consistency, issue5765-retire-rewrite). Full-suite verdict = remote CI on the new head.
  6. Pushed (force, per the conflict-rebase mandate): new head d12a138eb6f, no [ework:ci-held] marker → this is the branch's one full CI pass. Re-fetched before push; no concurrent pushes on the branch.

Note: the PR body's line "kernel 0.0.217 → 0.0.218" is now stale — the actual bump on the rebased head is 0.0.219 → 0.0.220. I did not edit the PR body (lane rule); flagging it here instead. The kernel-change: declaration is already in the body, so no gate is blocked.


八问

  1. 是什么问题:PR [PR] kernel: screen drops units that consume a retired block (#8014) #8022(kernel:screen 丢弃消费 retired block 的 unit,[Bug][kernel] recommend keeps advertising ranges that consume retired blocks — apply rejects every turn | nudge 广告含 retired 块,apply 必拒 #8014)与基线分支 master 冲突(merge state dirty),无法合并。
  2. 什么原因导致的:PR 在途期间 master 合入了 [PR] kernel: keep the signature anchor when hiding a consumed compress call #8124,kernel 版本从 0.0.217 推进到 0.0.219,与 PR 携带的 0.0.218 在 kernel/package.json / kernel/package-lock.json / package-lock.json 三处版本行冲突——纯版本号冲突,无代码冲突。
  3. 影响范围与严重程度:仅影响本 PR 的可合并性;无用户面影响。严重度:PR 被阻塞,无外部影响。
  4. 怎么修复的:把 PR 的 3 个 commit rebase 到 master@1f3fcb56367;三处版本冲突按 kernel 版本纪律解为 0.0.219 → 0.0.220(PR 动了 kernel/src/** 必须 bump),两个 lockfile 同步 0.0.220,两个 commit 标题的版本标注同步更正;代码零改动,rebase 后 diff 与 master 的差异就是原 PR 的 5 个文件。
  5. 是否有回归问题:无。代码零改动;master 侧自 PR 分叉以来的 kernel 变更(compress-tools/hide-consumed/packs/surface-config)与 recommend.ts/unit-projection.ts 无语义交集。本地定向验证:kernel typecheck 干净;三个相关套件 17/17 通过(issue8014-retired-recommend、issue3236-recommend-apply-consistency、issue5765-retire-rewrite)。全量回归由新 head 的远程 CI 把关。
  6. 是否破坏缓存:不涉及(未触碰任何缓存/重试/增量游标逻辑)。
  7. 是否改了设计方向:不涉及(无架构/数据流变更)。
  8. 是否引入了新的配置:不涉及。附注:PR 正文 "kernel 0.0.217 → 0.0.218" 一行已过时,实际 bump 为 0.0.219 → 0.0.220;按车道规则未改 PR 正文,在此说明。

判定:冲突已解除并推送(最终 head d12a138eb6f,无 ci-held 标记,CI 运行中);CI 转绿后本 PR 即可由 owner 合并。

ci-check and others added 2 commits December 3, 2026 16:15
…sion conflict to 0.0.221

Both this PR (#8014) and master (#8153) independently bumped acp-kernel 0.0.219 -> 0.0.220, so the merge auto-resolved the version line to 0.0.220. The merged kernel now carries BOTH the #8014 recommend-screen change and master's #8153 band-nudge/hide-consumed changes, so it needs a fresh version: bumped 0.0.220 -> 0.0.221 in kernel/package.json, kernel/package-lock.json, and the root package-lock.json (acp-kernel file: dep). kernel-guard Rule 2 (src changed requires a version bump vs master) and lock-sync (lockfile matches npm regen) both pass. No code conflicts: master's kernel changes (compress/config/hide-consumed/nudge-text/types) and the PR's recommend.ts + test touch disjoint files. Verified locally: kernel typecheck, #8014 test (3/3), #8153 tests (20/20), root typecheck all green.
…nt with master

Master advanced past the previous sync (f09a487) by #8195 (ledger-window-guard) and #8198 (data-dir-channel), both host-only (src/, tests/, scripts/, docs/) — no kernel/ changes, so the acp-kernel version stays at 0.0.221 (PR's bump; master is still 0.0.220). No conflicts: the new master commits and the PR's kernel changes touch disjoint files. This clears the 'behind' state so the PR merges cleanly against the latest master.

@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: sglang-gpu0/qwen3.8-27b)

Review: #8022(kernel:recommend 屏掉跨越 retired block 的单元,#8014)—— 机制正确(#3236 单投影纪律的正确落地)、双向+角落钉住,可合(留人,kernel 一律人工)。

独立核对

  • 病灶成立:screenRecommendedUnits 对 retired 零判定(base 的 recommend.ts/unit-projection.ts 无 retired 字面命中),而 apply 侧 retiredConsumed 守卫会拒任何消费 retired block 的区间 → 退役块存活期间,顶层推荐每回合必然被拒——#3236「每个被宣告的区间必须能干净应用」契约的最后一个漏形。宿主侧修不了(屏与 apply 守卫都在 kernel),在屏上镜像 apply 判定是正解,不是堵。
  • 无条件屏掉(无 refold 豁免)的论证我核过:apply 侧 retired 守卫在 refold 路由之前触发;refold 只能打 restoredInline 块,retired 块不是 restoredInline → 合法 refold 永不消费 retired 块。第三个测试专门钉了 retired+restoredInline 角落(会被 classify 成 "refold" 的形状)也照屏——豁免论的死角被测试占掉了。
  • warnScreenDrop 有预算(与屏上其他 drop 同一诊断通道),字符串是宿主日志,非模型可见——body 的「无 MODEL-FACING 变化」属实(diff 里唯一新字符串就是这条)。
  • 无 retired 块的会话字节级不变(新检查找不到任何东西);对照组钉住「active 块的同一跨度仍被宣告」——无过度屏除。

本地实证(worktree @ 2c4d123):

  • GREEN:issue8014-retired-recommend(3)+ issue3236-recommend-apply-consistency + issue5765-retire-rewrite 合计 17/17 绿。
  • RED(kernel/src/recommend.ts 回退到 base 7d29483):1 绿/2 红——红的恰是 retired 主用例与 retired+restoredInline 角落,绿的恰是 active 对照(修前就成立,方向完美)。

合并前两件事

  1. CI:head 2c4d1236 的 check-runs 只有 gate/lane/docs 类 25 个,没有 test 分片——全套判决缺失。base 7d29483 是 master 祖先(之后 master 前进 94 个 commit,未动 recommend.ts),rebase 到当前 master 重跑 CI 拿 test 分片全绿再合。
  2. 版本堆积:本 PR bump 0.0.220→0.0.221,与 #8017(同 0.0.221)、#8001、#8085、#8223、#7946 撞号;#8018 只 bump 到 0.0.220(=master 现值)。这几个 kernel PR 谁后合谁 kernel-guard 红,需要依次再 bump——建议 owner 排合并顺序(本 PR 与 #8017 互相独立,无先后依赖)。

结论:内容正确、双向+角落钉住;rebase+重跑 CI 全绿后合,留人。

ework-agent added 2 commits December 4, 2026 08:39
…nt with master

Master advanced past the previous sync (7d29483) by a large host-only batch: #8055 (gate-regression-p0, the 824-cell gate matrix + host drivers + gate ledger), #8207 (rescue-kernel-decisions host-side fix + test), #8175 (circuit skipped-proxy hint), and assorted gate/CI/test commits. None touch kernel/ or the dependency manifests — the acp-kernel version stays at 0.0.221 (PR's bump; master is still 0.0.220). No conflicts: the new master commits and the PR's kernel changes touch disjoint files. Clears the 'behind' state.
…sion collision to 0.0.224

Master advanced past the previous sync (922c38e) with a large batch that DID touch kernel/: #8015 (autosplit span), #8016 (default warn sink per-core), #8242 (egress block coords), #8218 (compress prompt pricing), render-refs strategy, sync.ts fresh-fold, responses notifications, plus many host-only PRs. Two kernel version bumps landed on master (0.0.220 -> 0.0.222 -> 0.0.223), colliding with this PR's 0.0.221. kernel/src/recommend.ts auto-merged cleanly (PR's retired-block screening and master's changes touch disjoint regions). Resolved the version collision by bumping the merged kernel to 0.0.224 (above master's 0.0.223), keeping kernel-guard Rule 2 satisfied. Lockfiles regenerated-consistent.

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

bug Something isn't working p2 scope/kernel

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Bug][kernel] recommend keeps advertising ranges that consume retired blocks — apply rejects every turn | nudge 广告含 retired 块,apply 必拒

1 participant