Repository navigation
[PR] kernel: number demotable protected carriers at birth instead of BLOCKING them (#3999) - #4371
ranxianglei wants to merge 5 commits into
Conversation
8722d34 to
bdd1ef0
Compare
(ai: vllm-qwen/qwen3.8-27b) 上游冲突已解决:分支已 rebase 到最新 master( 冲突点与解法(共 2 处,均在 commit 1):
commit 2(host 测试对齐)在 rebase 中干净应用,无冲突。最终 diff 相对 master 恰为本 PR 原范围的 14 个文件(+444/−71),无夹带。 定向验证(本地,全绿):
八问:
结论:冲突已清,PR 可进入正常 review/CI 流程,等 CI 绿后可合(合并仍是人工操作)。 |
📦 Built Package ArtifactBranch: Latest build — install this exact versionnpm install -g billion-context@0.0.10111-pr.4371.4c6a697This exact version is immutable and reproducible. The rolling Recent builds (commit → version)
Download artifact
tar xzf billion-context-pr4371.tgz
npm install -g packageInstall instructions are refreshed on each push. |
(ai: vllm-qwen/qwen3.8-27b) 独立审核结论(我对 diff 重新做过,不复读 #3999 线程此前的八问)。 结构化八问
我额外做的(独立于审核本身)CI 两个红
已 push(head 现为 本地定向验证(已装 deps、kernel build 绿):新内核测试 行为变更披露(Deliverables 第 4 条)
合并判定代码层面我独立审核通过:核心不变量成立、无回归、KDD#14 守卫过、定向测试绿。合并前置仅剩 CI 在新 head |
6d6148c to
85d684d
Compare
(ai: vllm-qwen/qwen3.8-27b) Conflict rebase done — PR #4371 is no longer dirty. I rebased Conflicts resolved (5 sites):
Local verification (all green): Notes: (a) I did not edit the PR body — the 结构化八问(中文,供审核):
收工判定:冲突已解决、本地定向验证全绿、已 force-push(head |
…ING them (#3999) Decouple ref-blocking from fold-protection in assignRefsNode: only the permanently-pinned class (unrecoverable media, statically-protected tools) keeps a BLOCKED ref. Latest-per-identity protected carriers (durable/*, cumulative-snapshot tools) are now NUMBERED at birth while append-stable at the tail, so their later demotion inserts zero bytes instead of minting a tag mid-history - the #3837 per-round prefix-cache break. Fold exclusion stays at projection time (unit-projection/recommend carve via isMessageLatestProtected), independent of the ref value. Also matches rebuildCompressionState, which already numbered them. Bumps acp-kernel to 0.0.137.
…ract Host tests that asserted the old BLOCKED behavior for latest/durable carriers now assert the new contract: live carriers are numbered at birth (addressable) while fold-exclusion is carve-based. Reworks issue2419/2446/2447/2481 (guard proven directly on the stamped effectiveConfig), protected-latest-tools, protected-tool-paths (skill/*), session-continuity-proof scenario B, and plugin-fork #2676. Adds issue3999-dsh-append-stable e2e asserting the outbound body stays append-stable across two consecutive dsh runtime-context snapshots.
The PR bumped kernel/package.json to 0.0.161 but neither lockfile was regenerated, leaving the root lock recording acp-kernel 0.0.159. The lock-sync gate (#2704/#3782) regens both locks and fails on any drift. This staleness already existed on master (kernel 0.0.160 vs root lock 0.0.159); the bump merely widened it. Pure version-line regen, no structural churn. Un-blocks the `test` lane.
85d684d to
a13e385
Compare
(ai: vllm-qwen/qwen3.8-27b) Re-rebased onto the moved master — PR #4371 is clean again. Verified live first: master advanced 208 commits since my last rebase (now at Why it conflicted again: master landed Conflicts resolved (version-only, 4 sites):
Local verification (all green): Notes: (a) I did not edit the PR body — the 结构化八问(中文,供审核):
收工判定:冲突已解决、本地定向验证全绿、已 force-push(head |
…irth contract #3999 numbers demotable latest-protected carriers at birth instead of giving them the BLOCKED sentinel. Two comments still described the carrier as holding a BLOCKED ref, which is now only true for the permanently-protected class: - src/server/side-request.ts: the side-lane veto exists so the durable carrier goes through the kernel and gets a ref stamped (numeric now, not BLOCKED). - kernel/src/boundaries.ts: snapToNeighborVisible skips permanently-protected (BLOCKED) refs; demotable carriers are now visible snap targets.
ranxianglei
left a comment
There was a problem hiding this comment.
(ai: vllm-qwen/qwen3.8-27b)
Reviewed end-to-end: PR body, linked issue #3999 (sub-defect of #3837), the full diff (kernel + host tests + lockfiles), and every touched code path.
Correctness — sound. The fix decouples ref-blocking from fold-protection:
kernel/src/compress.tsassignRefsNode: ref-blocking (blockedFn) now covers only the permanently-pinned class —hasUnrecoverableMediaPayloadOR static protection (protectedTools/isToolProtected/isMessageProtected). The demotable latest-protected class (collectLatestProtected+isMessageLatestProtected) is no longer blocked, so those carriers get a numeric ref at birth (append-stable).- Fold exclusion is ref-independent and happens at projection time:
kernel/src/unit-projection.tsfilterProtectedToolMessagesstill carves outisMessageLatestProtected(msg, latest)(plushasUnrecoverableMediaPayload/ non-exemptisMessageProtected), andbuildProjectionSharedseedsbaseProtectedCallIdsfromlatestProtected.callIds. The live carrier is still excluded from folding while it is the latest — by identity, not by ref value. - The apply path is unchanged and safe:
applySingleRangerunsprojectUnit(the single shared projection, KDD #12); a model-cited range covering the live carrier carves it out (silent, like static protected tools) or no-ops if entirely protected. - The BLOCKED→numeric migration path (
renderDeferredRefs, #3939②/#3805) is untouched and still handles stale persisted state from pre-#3999 kernels or config-changed static protection. rebuildCompressionState(kernel/src/rebuild.ts) already calledassignRefswith noisProtected(always numbered) — the PR body's claim is accurate.
Tests — real teeth.
kernel/tests/issue3999-numbered-at-birth.test.ts(new, 3 tests): carrier numbered at first sight; two-shot demotion keeps the old carrier's ref and renders a byte-identical prefix (the #3837 symptom negated at the kernel level); staticprotectedToolsstays BLOCKED while the durable carrier is numbered.tests/issue3999-dsh-append-stable.test.ts(new e2e, real proxy): two consecutive shots, assertst2[0] === t1[0]byte-identical (demotion zero-insertion) and the newest snapshot is numbered at the tail.- Reworked host tests (issue2419/2446/2447/2481, protected-latest-tools, protected-tool-paths, plugin-fork, session-continuity-proof) are consistent with the new contract.
- Targeted suites run locally: kernel 16/16 pass, host 97/97 pass. No golden/wire-contract drift (no golden files in the diff). Full-suite verdict is the remote CI on the pushed head.
Behavior drift (旧值→新值) — disclosed:
- Demotable latest-protected carrier (e.g. dsh durable runtime-context snapshot): ref
BLOCKED(no tag) →mNNNNN(tag at birth). This is the intended fix. acp_statusprotected ranges: the live carrier was invisible (BLOCKED, skipped inrecommend.ts) → now listed as a protected range with a ref. Natural consequence; consistent with the existing numbered+fold-excluded precedent (unnamed results of name-only protected tool calls).snapToNeighborVisible(kernel/src/boundaries.ts): demotable carriers were skipped (BLOCKED) → now eligible as visible snap targets. Correct — they are visible.- Permanently-protected carriers: unchanged (still BLOCKED).
House conventions — compliant. kernel-change: line present in the PR body; version bump 0.0.198→0.0.199; both test layers (kernel + host) covered.
已顺手修:synced two stale comments that still described the carrier as holding a BLOCKED ref (now only true for the permanently-protected class) — src/server/side-request.ts:244 and kernel/src/boundaries.ts:408 + commit ecc81a9
Verdict: findings-only, no blockers. This PR touches kernel/ and carries a kernel-change: declaration, so per the authorization boundary I am NOT approving — the merge waits on the human-only kernel review tier. See the follow-up comment.
八问(中文,供人工审核):
- 是什么问题:dsh 会话里,每轮压缩把「最新受保护载体」的 tag 插到历史中间,破坏前缀缓存(单轮 5,701 tok 全价,最高 89,863 tok)。
- 什么原因导致的:ref 阻塞与折叠保护耦合——最新受保护载体出生时拿 BLOCKED 哨兵(不渲染 tag),demote 时才补发数字 ref,tag 被插到历史中间,前缀缓存失效。
- 影响范围与严重程度:仅 dsh 车道带 durable 载体的会话;特定条件触发(每轮 demote);严重度=缓存失效→成本上升(非不可用)。
- 怎么修复的:解耦——ref 阻塞只留「永久保护」类(静态 protectedTools + 不可恢复媒体),可 demote 的最新保护载体出生即编号(append-stable),折叠排除改到投影期(filterProtectedToolMessages 按 isMessageLatestProtected,与 ref 值无关)。
- 是否有回归问题:审过——永久保护仍 BLOCKED(不变);折叠排除在投影期(ref 无关,结果同);apply 路径 projectUnit 仍 fatal 抛错;迁移路径(renderDeferredRefs)只处理旧持久化态;acp_status 现在列出活载体(带 ref,自然推论,与既有「编号+折叠排除」先例一致);snapToNeighborVisible 现在把可 demote 载体当可见 snap 目标(正确,它们可见)。无回归。
- 是否破坏缓存:本 PR 正是修复前缀缓存失效;不破坏其他缓存/重试/游标/去重键。
- 是否改了设计方向:是——ref 阻塞与折叠保护解耦(kernel 内设计变更);理由:阻塞 ref 破坏 append-stability,而折叠本就该在投影期按身份排除。
- 是否引入了新的配置:不涉及。
|
🔶 需要决策 本 PR (#4371) 触碰 受门禁的 kernel diff:
我的审核结论: 无阻塞项;修复正确;测试扎实(定向 kernel 16/16 + host 97/97 通过)。唯一门禁是 human-only kernel 批准档。 请批准(或驳回)该 kernel 变更。 |
[bot] 🏷 (ai: vllm-qwen/qwen3.8-27b) Review complete — findings-only, no blockers. NOT approved (this PR touches What I verified (end-to-end: PR body, issue #3999, full diff, every touched path):
已顺手修: two stale comments that still described the carrier as holding a The full findings + the Chinese 八问 checklist are in my review above. Next step is yours: approve (or reject) the kernel change. |
) ecc81a9 synced two stale BLOCKED-ref comments; its side-request.ts edit is comment-only, which lane-guard (#2170) treats as a lane-logic change and requires a side-lane suite update alongside. A comment has no behavior to pin, so restore the line and let the kernel PR proceed; the comment re-sync can land with a real suite change later. The kernel/src/boundaries.ts comment sync from the same commit is kept (kernel/, not gated by lane-guard).
(ai: vllm-qwen/qwen3.8-27b) lane-guard fixed — pushed What I found (verified live first): On head Root cause: the PR's comment-sync commit Fix (small, mechanical): restored that one comment line to its pre-change form ( Notes on process:
中文八问
判定:lane-guard 已在新 head ( |
(ai: vllm-qwen/qwen3.8-27b) Re-verified live — already green, no further work needed this run. The triggering event was stale: it reported head Live state on the current PR head
No new fixes pushed this run. Stopping here per the "already green" rule. |
[bot] 🏷 (ai: vllm-qwen/qwen3.8-27b) head 已移动(5676c8e4c),我重新核对了 delta。 新提交 重审结论:
状态不变: 触碰 |
Decouples ref-blocking from fold-protection so durable / latest-per-identity protected carriers are numbered at birth instead of carrying the unaddressable
BLOCKEDsentinel. Sub-defect of #3837 (per-round prefix-cache breakage in dsh sessions); managed inside that issue's sub-defect checklist.Why
In the dsh plugin lane every new runtime-context snapshot demotes the previous one. Under the old code the live carrier was
BLOCKED_REFat birth (no wire tag) and only got a real number minted mid-history the instant it was superseded — inserting ~48 bytes of ACP tag into the outbound prefix and breaking the per-round prefix cache from that point on (#3837 user evidence: single-round 5,701 tok full-price; up to 89,863 tok on long sessions after client mid-history splicing). Ref assignment is kernel-owned (the id-never-reused contract + render pipeline), so the host cannot fix this — it can only choose whether to attach the classifier at all.The change (kernel,
acp-kernel0.0.136 → 0.0.137)assignRefsNode(kernel/src/compress.ts) now keeps aBLOCKEDref for ONLY the permanently-pinned class:compress.stripImages默认开启——否则带图消息不可压缩会形成只升不降的输入地板撑爆上下文 #2607), andprotectedTools/ predicates — every instance pinned forever).The demotable latest-per-identity class (
durable/*carriers, cumulative-snapshot tools liketodo_list) is now numbered at birth. While one sits at the tail a fresh tag is append-stable, so its later demotion inserts zero bytes. Fold exclusion moves entirely to projection time — the existingunit-projection.ts/recommend.tscarve viaisMessageLatestProtected, which is independent of the ref value — so numbering them never makes them foldable. This also matchesrebuildCompressionState, which always numbered them.Behavior change (old → new)
BLOCKED(no wire tag)mNNNNN(wire tag present, append-stable at tail)protectedToolsBLOCKEDBLOCKED— unchangedNo config surface added. No wire-shape change beyond the tag the kernel already emits for any numbered ref.
Tests
kernel/tests/issue3999-numbered-at-birth.test.ts: numbered at first sight; two-shot demotion zero-insertion (rendered outbound byte-stable across the demotion); boundary guard (static tools stillBLOCKED).tests/issue3999-dsh-append-stable.test.ts: two consecutive dsh-shaped requests through the real proxy assert the outbound body stays append-stable (demoted snapshot identical bytes, new snapshot appended at the tail).BLOCKEDdetail for latest/durable carriers (issue2419/2446/2447/2481, protected-latest-tools, protected-tool-pathsskill/*, session-continuity-proof scenario B, plugin-fork [bug]dsh 在191版本上或者说之前版本,分支(带上下文窗口)以及带上下文的子智能体会一直静默没反应 #2676) to the numbered-at-birth contract. Static-protectedToolssiblings are untouched and still assertBLOCKED.Both layers green on this head: kernel suite 1320 pass / 0 fail; root typecheck clean. Full bili-suite verdict comes from CI. Five local-only
CCR … cold disk restorefailures reproduce identically on clean master (environmental, not introduced here).kernel-change
kernel-change: decouple ref-blocking from fold-protection so demotable latest/durable protected carriers are numbered at birth (append-stable), eliminating the mid-history tag insertion that breaks the per-round prefix cache (#3837/#3999)Fixes #3999