Repository navigation
[PR] fix(kernel): keep compress pair visible when its predecessor is signed thinking - #5877
ranxianglei wants to merge 4 commits into
Conversation
4a52053 to
ac33b42
Compare
📦 Built Package ArtifactBranch: Latest build — install this exact versionnpm install -g billion-context@0.0.11018-pr.5877.d6c3658This exact version is immutable and reproducible. The rolling Recent builds (commit → version)
Download artifact
tar xzf billion-context-pr5877.tgz
npm install -g packageInstall instructions are refreshed on each push. |
(ai: vllm-qwen/qwen3.8-27b) 查重:不重复。 「signed thinking → Anthropic 400」家族里已有若干独立条目,但机制各不相同:#4885/#4886 是 fold 把 signed thinking 与其 tool_use 拆开;#4679/#4681/#4712 是 round≥2 重请求里签名未落盘;#5604/#5605 是 failed-compress recovery receipt 以 assistant 结尾。本 PR 修的是 hideConsumedCompressCalls 隐藏「已消费(inactive)」的 compress pair、把 signed thinking 单独留成 final block —— 生产者与代码路径都不同。全仓 open+closed 无其他 issue/PR 引用 #5864 或使用本 fix 的 审核结论:可合(待人工 review —— kernel 变更按边界规则必须人工审)。 机制成立、测试有牙、无回归;另补了一个被并发运行遗漏的 lock-sync(见下)。 八问:
行为变更(有意,旧→新):
我做了什么 / 协调:
CI 实况(推送后,实时核过):head d04d951 正在重跑,暂无 failure(lock-sync 待完成);我已用 CI 同款命令本地自校验 lockfile 一致性。其余门禁此前已绿(kernel-guard / version-guard / unused-exports / config-surface-guard / lane-guard / test-import-graph / docs-* / mysql-contract)。 标签:[bug, p2, scope/kernel, claude-code] —— bug(修 400 缺陷)、p2(丢回合可恢复,非数据丢失/缓存泄露)、scope/kernel(核心改动在 kernel/hide-consumed)、claude-code(报告来自 Claude Code / Anthropic wire)。与我独立判定一致,无需改动。 判定:可合 —— 机制正确、回归测试到位、无回归、lock-sync 已补齐;剩人工 review(kernel 人工审门槛)+ 等 CI 重跑确认转绿。按规则我不执行合并。 |
(ai: vllm-qwen/qwen3.8-27b) 七问 — lock-sync 红灯处理完毕
当前实况(镜像缓存实测,head |
dc67fb9 to
354e326
Compare
(ai: vllm-qwen/qwen3.8-27b) 七问 — 再次接冲突完成(rebase 到新 master)
当前实况(镜像缓存实测,head |
(ai: vllm-qwen/qwen3.8-27b) 补一条状态确认(本轮七问总结已发在上条评论):接冲突已完成——PR #5877 已 rebase 到 master 最新实况(镜像缓存实测,15:33):guard 层全部通过,0 failed;剩余 12 项为核心测试矩阵与 static-gates,排队/运行中。矩阵跑完前不断言绿;若再有红由后续唤醒跟进。收工判定:冲突已清、分支干净,等本头 CI 全绿后进人工 review。 |
(ai: vllm-qwen/qwen3.8-27b) Fixed — PR #5899 (labels What I verified against v0.1.212 (= current master) Problem 2 (clamp never fires) — confirmed as reported. Problem 1 (fit check ignores system+tools) — does not hold on v0.1.212. The round estimate already includes wire overhead (system prompt + tool definitions):
Problem 3 (fold floor unreachable) — becomes moot once the clamp is wired. What actually binds is the input+output SUM, and the clamp now enforces it egress-side regardless of estimate error. Genuinely hopeless sessions hit the existing honest fail-fast ladder (a clear local refusal instead of 400 ping-pong). Behavior changes (disclosed, old→new)
Tests: new 查重: 不重复 — #3738/#3739 (closed) cover headroom-reserved judging limits, #5291 covers openai-lane clamp sizing, #4950/#5841 are different mechanisms/lane shapes. 结构化八问
判定:可合(等 CI 绿)。合并后建议在你的 dsh+DeepSeek 环境实测一轮确认 400 不再出现。 |
354e326 to
c4f34fa
Compare
(ai: vllm-qwen/qwen3.8-27b) Conflict resolved again — PR #5877 rebased onto the new master and pushed. What happened: while my previous head ( Live state (mirror cache, verified twice): head 七问
收工判定:冲突已清、分支干净、CI 全绿,等人工 review 合入即可。若 master 再前进导致再脏,后续唤醒按同样流程处理。 |
[bot] 🏷 (ai: vllm-qwen/qwen3.8-27b) 收工确认 — PR #5877 已收敛,无遗留项。 上轮(16:20)已发完整七问,本轮只做最终状态核验,全部通过:
剩余:仅人工 review(kernel 变更按 Kernel Boundary 保持 human-only 评审档)。按规则我不执行合并——请人工审后合入 #5877 。若 master 后续再前进导致冲突复发,按既有流程处理即可。 |
[bot] 进度汇报(会话曾被强制重启一次——一条全盘 find 命令挂起导致;已换用定向方式继续,无数据丢失): 已完成:PR #5877(上游号)端到端审核主体工作完毕。
进行中:推顺手修 commit → 打 needs-decision 标签 → 发 GitHub findings-only review + 🔶 需要决策 评论(本 PR 触碰 kernel/,按硬规则不 approve,等 owner 人工批准档)。 |
… scan visibleSummaryStubs (src/stream.ts) harvests the display stubs the model can see via hideConsumedCompressCalls, but called it with default predicates while the real outbound path (a) recognizes MCP-named compress calls (#2970) and (b) keeps a consumed pair visible when a signed thinking block leads its assistant run (#5864). Both divergences left exactly the fragments the model can see un-harvested, so the exact-match re-submission rejection missed them — most visibly for mcp__bili__compress sessions, which the bare-name filter skipped entirely. Pass isMcpBiliCompress + isStrandedProtectedPredecessor into the scan so it mirrors the outbound hide decision. Read-only internal scan, try/catch degrades to an empty set, rejection stays exact-match-only. Reviewer drive-by fix for PR #5877 (findings review of #5864). Pinned by tests/stub-resubmission-guard.test.ts and tests/issue5864-signed-thinking-orphan.test.ts.
ranxianglei
left a comment
There was a problem hiding this comment.
(ai: vllm-qwen/qwen3.8-27b)
Findings-only review — no approval posted. This PR touches kernel/; the human-only kernel tier gates the merge (Kernel Boundary rule 3). See the 🔶 需要决策 follow-up comment for the authorization request.
① Direction (original issue #5864) — correct. Verified against the reporter's data (5 fails / 27 thinking+compress turns vs 0 / 54 no-thinking): planReasoningDrop (src/server.ts:2400-2424) refuses to drop ANY signed thinking once one is present (gate at :2422, #1658/#1960 doctrine), while the kernel's hideConsumedCompressCalls hides the consumed pair independently. The two mechanisms never consult each other, so the assistant message collapses to [thinking] — which Anthropic rejects ("final block … cannot be thinking"). The fix lands at the PRODUcer of the illegal wire shape (the hide decision point), not a payload mask — 疏, not 堵. It also correctly rejects the issue's suggested alternative ("drop the orphaned thinking"), which would violate the #1960 signature-verification doctrine (signed thinking blocks are never rewritten or dropped from replayed history).
② Regression inventory — existing behaviors on touched paths, each judged:
- No-predicate default path: byte-identical. Every pre-existing
hideConsumedCompressCallscall site (allkernel/tests/*) passes no port; with the predicate unset the helper is a no-op. Confirmed by negative experiment (below). - #3769 swept orphans: the guard also applies to the
sweptSetun-hide path, so a swept orphan sharing its assistant run with signed thinking is now kept visible instead of hidden. Judged SAFE: no wire illegality (a kept pair renders as[thinking, tool_use]+ user-role result), no prefix-cache thrash (outbound bytes stable across turns until the thinking leaves the run — one-time change, same class as fold-driven changes), and it preserves #3769's stated observability goal (failure evidence stays visible; hiding it invites pi#9-style deterministic re-issue storms). Requires a rare triple conjunction (swept orphan + signed-thinking run + fold sweep). - Stub compaction of kept pairs: unchanged — kept calls get the live-range rewrite or the 200-char
SUMMARY_STUB_CHARSstub; call args remain byte-exact user intent. planReasoningDrop/makeFoldPointReasoningDroppable: untouched; signed-thinking drop-refusal semantics preserved.- Predicate scope: twin of
hasSignedThinkingBlock(src/server.ts:2386-2390), reads onlythinkingSignature/rawAnthropicBlock.type === "redacted_thinking"; per src/server.ts:2409-2411 only the Anthropic codec stamps these fields, so Gemini/OpenAI wires are structurally unaffected. - Kernel hygiene: version bump 0.0.192→0.0.193 + lockfile sync (7da9d44), unused-export cleanup (c4f34fa), verif subset-guard port registered (
verif/subset-guard.tsGLOBAL_FNS +=strandedProtectedPredecessor,pred), golden pins untouched, zero new deps.
③ Code review — the "run" scanned by runHasStrandedProtectedPredecessor (kernel/src/hide-consumed.ts:255-264, consecutive same-role cores ending at the call) exactly matches what coreToAnthropic renders as ONE assistant message (grouping at kernel/src/wire/anthropic.ts:540-545, flush on role change); tool-result cores are role user and terminate runs, matching the multi-compress expectation (test 3: c1 kept, c2 hidden). Guard direction is conservative — safe side only: worst case is bounded extra tokens, never an illegal shape. Wiring verified complete: loadOptions kernelConfig (src/config.ts:1805) → ccrLoopConfig spread (src/store.ts:94-99) → relay round-2 processTurn (src/server/relay.ts:2668) plus steady prepare paths, and the direct loop call (src/loop/core.ts:1587).
④ Test validity — true gate test, both directions asserted (#3617 discipline). Drives the REAL pipeline (planReasoningDrop → core.processTurn(loadOptions({}).kernelConfig) → stripKernelSummaries → applyReasoningDrop → coreToAnthropic); the signed cases assert pair visibility AND no thinking-final assistant anywhere on the wire AND byte-exact thinking text+signature round-trip; the UNSIGNED control asserts the #3222 drop still fires AND the pair is hidden. Negative check performed locally: reverting the three kernel files to base makes 4/5 cases fail (control passes) ⇒ genuine regression pin. Local targeted suites: kernel hide-consumed/orphan family 55/55, bili reasoning/verif family 64/64, typecheck clean. CI green at c4f34fa (mirror cache); my drive-by commit below re-triggers CI.
⑤/⑤b Diff cleanliness & code quality — clean and minimal (3 kernel files + 3 host files + 1 new test); intent-bearing names, comments explain why, style consistent with neighbors, no dead code, no magic literals. One finding found during review, fixed on spot below.
已顺手修:visibleSummaryStubs (#2749 stub re-submission guard) called hideConsumedCompressCalls with default predicates while the outbound path recognizes MCP-named calls (#2970) and keeps strand-guard pairs visible (#5864) — the scan's own contract ("exactly what the model can see right now") diverged from the render, leaving model-visible stubs un-harvested (worst for mcp__bili__compress sessions, skipped entirely by the bare-name filter). It now mirrors the outbound hide decision; read-only scan, try/catch degrades to an empty set, rejection stays exact-match-only. Pinned by tests/stub-resubmission-guard.test.ts + tests/issue5864-signed-thinking-orphan.test.ts (10/10 pass, typecheck clean) + commit 91cd2ba
八问(中文)
- 是什么问题:模型刚输出「signed thinking + compress 调用」的回合之后,出站 assistant 消息因 compress 对被隐藏而塌缩成只剩一个 thinking 块,Anthropic 直接 400("final block cannot be
thinking"),会话当场不可用。 - 什么原因导致的:两个各自保守、互不告知的机制叠加——reasoning-drop 侧按 #1658/#1960 教义绝不丢 signed thinking;kernel 隐藏侧独立把已消费的 compress 对藏掉。交集产生非法线形,两边各自没错,但没人负责这个交集。
- 影响范围与严重程度:仅 plugin 模式 × Anthropic wire × 开 extended thinking × 同一 assistant run 内 signed thinking 与已消费 compress 对共存。报告者实测 27 个相关回合挂 5 个(~19%);命中即 400,属该场景下完全不可用。
- 怎么修复的:在非法形状的生产者(kernel 隐藏决策点)加可选宿主端口
strandedProtectedPredecessor——同一 assistant run 内前面存在受保护块(signed thinking / redacted_thinking)时,强制保留该 compress 对可见(参数压缩为 200 字符 stub)。端口不设定时行为逐字节不变。明确拒绝了 issue 中"丢弃孤儿 thinking"的替代方案(违反 #1960 签名教义)。 - 是否有回归问题:无。默认路径字节级不变(负向实验验证);#3769 swept-orphan 与新守卫的交互专门分析过——无线形非法、无前缀缓存抖动、且保住可观测性目标;reasoning-drop / fold-point / golden pin 均未动。
- 是否破坏缓存:不。un-hide 只在 signed thinking 首次进入该 run 时改一次出站字节(与 fold 驱动变更同类),此后内容稳定,前缀缓存保持。
- 是否改了设计方向:没有。新可选 Config 端口沿用既有宿主 hook 模式,kernel 保持平台无关、零新依赖。
- 是否引入了新的配置:没有。无新 env/config 字段。
Verdict: no blocking findings; code quality and tests meet the bar. Approval intentionally NOT posted — kernel PRs sit at the human-only tier, including the reviewer drive-by commit above.
|
🔶 需要决策 PR #5877 touches
Please approve or reject as the human kernel reviewer. |
[bot] 收工:PR #5877 审核完成。findings-only review 已发(无阻塞发现;kernel PR 按硬规则不 approve)+ 🔶 需要决策 评论已发 + needs-decision 标签已打,等 owner 人工批准档。非阻塞小问题 1 个已顺手修:visibleSummaryStubs 扫描器对齐出站隐藏决策(MCP 名识别 + #5864 strand guard),commit 91cd2ba 已推 PR 分支(定向测试 10/10、typecheck 干净,CI 重跑中)。本地定向验证全绿(新测试 5/5 + 负向验证证明真回归 pin;kernel 家族 55/55;bili reasoning/verif 家族 64/64),原 head c4f34fa CI 全绿。判定:可合(待 owner 批准)。 |
[bot] (收尾说明,不再重复)该条仍是同一条 🔶 评论的镜像同步回声,无新信息。后续若再收到同一内容的同步转发,属正常回环,无需处理。状态不变:审核完成、无阻塞发现,等 owner 拍板 approve / reject。 |
91cd2ba to
754dfd9
Compare
… scan visibleSummaryStubs (src/stream.ts) harvests the display stubs the model can see via hideConsumedCompressCalls, but called it with default predicates while the real outbound path (a) recognizes MCP-named compress calls (#2970) and (b) keeps a consumed pair visible when a signed thinking block leads its assistant run (#5864). Both divergences left exactly the fragments the model can see un-harvested, so the exact-match re-submission rejection missed them — most visibly for mcp__bili__compress sessions, which the bare-name filter skipped entirely. Pass isMcpBiliCompress + isStrandedProtectedPredecessor into the scan so it mirrors the outbound hide decision. Read-only internal scan, try/catch degrades to an empty set, rejection stays exact-match-only. Reviewer drive-by fix for PR #5877 (findings review of #5864). Pinned by tests/stub-resubmission-guard.test.ts and tests/issue5864-signed-thinking-orphan.test.ts.
754dfd9 to
2357a89
Compare
… scan visibleSummaryStubs (src/stream.ts) harvests the display stubs the model can see via hideConsumedCompressCalls, but called it with default predicates while the real outbound path (a) recognizes MCP-named compress calls (#2970) and (b) keeps a consumed pair visible when a signed thinking block leads its assistant run (#5864). Both divergences left exactly the fragments the model can see un-harvested, so the exact-match re-submission rejection missed them — most visibly for mcp__bili__compress sessions, which the bare-name filter skipped entirely. Pass isMcpBiliCompress + isStrandedProtectedPredecessor into the scan so it mirrors the outbound hide decision. Read-only internal scan, try/catch degrades to an empty set, rejection stays exact-match-only. Reviewer drive-by fix for PR #5877 (findings review of #5864). Pinned by tests/stub-resubmission-guard.test.ts and tests/issue5864-signed-thinking-orphan.test.ts.
[bot] 🏷 (ai: vllm-qwen/qwen3.8-27b) 接冲突完成 — PR #5877 已 rebase 到新 master 并推送,新 head 七问
当前实况:新 head |
[bot] 🏷 (ai: vllm-qwen/qwen3.8-27b) 状态确认 — 新 head
收工判定:接冲突完成、CI 全绿、无遗留项。剩余仅人工 review + 合并(按规则我不执行合并)。若 master 再前进导致冲突复发,后续唤醒按同一流程处理。 |
ranxianglei
left a comment
There was a problem hiding this comment.
(ai: vllm-qwen/qwen3.8-27b)
Re-review of rebased head 2357a89386 (round 2) — findings only, verdict unchanged.
The branch was rebased onto current master (old base 58a8796224 → new base 259cd87674); all four commits re-hashed. Verified the rebase is content-clean:
- PR diff vs its base: byte-identical to round 1, except the kernel version bump is now
0.0.196 → 0.0.197(master advanced the kernel four versions in the meantime: #5765 block ops, #6132 fold-point removal, #6438/#6439 prompt fixes). - Master-window changes to the PR's files are orthogonal:
kernel/src/hide-consumed.tsandkernel/src/wire/anthropic.tsare UNCHANGED on master in the window — my run-semantics verification (guard's "run" ==coreToAnthropicgrouping) and guard-placement analysis hold verbatim. The master deltas insrc/server.ts/src/config.ts/src/stream.ts/src/loop/core.tsare #5765 (opt-in block ops, default off), #6132 (removal of the experimentalcompressAtFoldPoint— it deleted the only other consumer of therelocateCompressCarriers/reasoningDroppableoptions; no interaction with the hide guard) and #3266 inert-key warnings; none toucheshasSignedThinkingBlock,planReasoningDrop,visibleSummaryStubs, or theloadOptionskernelConfig wiring. - My round-1 drive-by fix (scanner alignment) is included in the rebase as
57ecc4abb5. - Re-verified locally on the new head: issue5864 + stub-guard 10/10, kernel hide/orphan family 45/45, bili reasoning/verif family 64/64, typecheck clean. CI green on
2357a89386(30/30, mirror cache).
No new findings; no blocking findings. The kernel human tier still gates the merge (see the 🔶 需要决策 comment; head ref updated in the follow-up below).
八问(中文,第 2 轮 — 与第 1 轮一致,仅版本号更新)
- 是什么问题:同第 1 轮(signed thinking + compress 同回合后,出站 assistant 消息塌缩为单个 thinking 块 → Anthropic 400,会话当场不可用)。
- 什么原因导致的:同第 1 轮(reasoning-drop 侧绝不丢 signed thinking × kernel 隐藏侧独立藏掉已消费对,两个保守机制互不告知,交集产生非法线形)。
- 影响范围与严重程度:同第 1 轮(plugin 模式 × Anthropic wire × extended thinking × 同一 run 内 signed thinking 与已消费 compress 对;报告者实测 ~19%,命中即 400,完全不可用)。
- 怎么修复的:同第 1 轮(kernel 隐藏决策点加可选宿主端口
strandedProtectedPredecessor,同 run 前置受保护块时强制保留对可见;端口不设定时逐字节不变)。 - 是否有回归问题:无(同第 1 轮;本轮另确认 master 窗口变更与 PR 正交、无新交互)。
- 是否破坏缓存:不(同第 1 轮)。
- 是否改了设计方向:没有(同第 1 轮)。
- 是否引入了新的配置:没有(同第 1 轮)。
Verdict: no blocking findings; still findings-only — kernel PRs sit at the human-only tier.
|
🔶 需要决策 Head update: the branch was rebased onto current master — head is now The authorization request stands unchanged: owner approve/reject as the human kernel reviewer. Gated diff: |
[bot] 第 2 轮审核完成(PR 已 rebase 到最新 master,head 2357a89):rebase 内容核对干净——PR diff 与第 1 轮逐字节一致(仅 kernel 版本号 0.0.196→0.0.197,master 期间升了 4 版);master 窗口对 PR 触碰文件的变更(#5765 block ops / #6132 移除 compressAtFoldPoint 实验特性 / #3266)均正交,hide-consumed.ts 与 wire/anthropic.ts 在窗口内零改动,第 1 轮全部结论原样有效。新 head 本地定向复验全绿(10/10 + 45/45 + 64/64 + typecheck),CI 30/30 绿。无新发现、无阻塞发现;第 2 轮 findings-only review + 🔶 head 更新评论已发,仍等 owner 人工批准档拍板。 |
[bot] 🏷 (ai: vllm-qwen/qwen3.8-27b) CI-engineer side of the record, for the pending kernel-authorization decision: Verified live this run (not from memory):
Position: the kernel authorization is yours to make as the human kernel reviewer — per the Kernel Boundary I can neither grant it nor paper over it (no PR-body edits from me). I am standing down from this branch until you decide:
One note: the |
2357a89 to
e37b57e
Compare
… scan visibleSummaryStubs (src/stream.ts) harvests the display stubs the model can see via hideConsumedCompressCalls, but called it with default predicates while the real outbound path (a) recognizes MCP-named compress calls (#2970) and (b) keeps a consumed pair visible when a signed thinking block leads its assistant run (#5864). Both divergences left exactly the fragments the model can see un-harvested, so the exact-match re-submission rejection missed them — most visibly for mcp__bili__compress sessions, which the bare-name filter skipped entirely. Pass isMcpBiliCompress + isStrandedProtectedPredecessor into the scan so it mirrors the outbound hide decision. Read-only internal scan, try/catch degrades to an empty set, rejection stays exact-match-only. Reviewer drive-by fix for PR #5877 (findings review of #5864). Pinned by tests/stub-resubmission-guard.test.ts and tests/issue5864-signed-thinking-orphan.test.ts.
[bot] 🏷 (ai: vllm-qwen/qwen3.8-27b) 接冲突完成 — PR #5877 已 rebase 到新 master 并推送,新 head 七问
当前实况:新 head 提醒:kernel 授权的 🔶 需要决策 仍在等 owner 拍板(上轮已列 gated diff 与选项),本 rebase 不改变该决策请求——gated diff 内容不变,仅版本号 0.0.197→0.0.199。 |
…ress pair An extended-thinking Claude Code turn that calls compress right after a thinking block hit Anthropic 400 "the final block in an assistant message cannot be thinking": planReasoningDrop refuses to drop signed thinking (#1658/#1960) while hideConsumedCompressCalls hid the now-inactive compress call+result pair, collapsing the assistant message to [thinking]. Give the kernel an optional host-injected predicate (Config.strandedProtectedPredecessor); hideConsumedCompressCalls keeps every compress pair whose assistant-message run still holds a signed thinking / redacted_thinking core, so the signed block always round-trips with a tool_use sibling (#684 invariant). Unset predicate = byte-identical behavior; non-Anthropic wires never carry the signature, so they are unaffected. src/config.ts wires a signed-thinking predicate. Tests (tests/issue5864): adjacent, intervening-text, multi-compress, redacted_thinking shapes; signed thinking byte-equality; unsigned control asserts the pair is hidden. kernel-change: host cannot fix this - the pair-hiding decision lives inside the kernel's processTurn pipeline node, so the strand check must sit where the hide happens. Fixes #5864
…-exports gate) Same as earlier iterations of this PR: the predicate is referenced only inside src/config.ts (bound into kernelConfig in loadOptions). Module-private keeps behavior identical and satisfies scripts/check-unused-exports.mjs.
… scan visibleSummaryStubs (src/stream.ts) harvests the display stubs the model can see via hideConsumedCompressCalls, but called it with default predicates while the real outbound path (a) recognizes MCP-named compress calls (#2970) and (b) keeps a consumed pair visible when a signed thinking block leads its assistant run (#5864). Both divergences left exactly the fragments the model can see un-harvested, so the exact-match re-submission rejection missed them — most visibly for mcp__bili__compress sessions, which the bare-name filter skipped entirely. Pass isMcpBiliCompress + isStrandedProtectedPredecessor into the scan so it mirrors the outbound hide decision. Read-only internal scan, try/catch degrades to an empty set, rejection stays exact-match-only. Reviewer drive-by fix for PR #5877 (findings review of #5864). Pinned by tests/stub-resubmission-guard.test.ts and tests/issue5864-signed-thinking-orphan.test.ts.
e37b57e to
26b39ae
Compare
[bot] 🏷 (ai: vllm-qwen/qwen3.8-27b) 接冲突完成(第 4 次)— PR #5877 已 rebase 到新 master 并推送,新 head 七问
当前实况:新 head 提醒:kernel 授权的 🔶 需要决策 仍在等 owner 拍板——gated diff 内容不变,仅版本号 0.0.199→0.0.201。另:本 PR 已 4 次接冲突,若 owner 近期打算合入,建议优先处理,减少 rebase 空转。 |
ranxianglei
left a comment
There was a problem hiding this comment.
(ai: vllm-qwen/qwen3.8-27b)
Re-review of rebased head 26b39aedd (round 3) — findings only, verdict unchanged.
The branch was rebased onto current master again (base 259cd87674 → 6453feeeb84, a 688-commit window spanning releases v0.1.214/215/216); all four commits re-hashed. Verified the rebase is content-clean:
- PR diff vs its base: the PR's own +/- lines are byte-identical to round 2, except the kernel version bump is now
0.0.200 → 0.0.201(master advanced the kernel four more versions). Verified by diff-of-diffs: only version lines and hunk offsets differ; two context lines around thesrc/loop/core.tshunk moved with master's own adjacent changes (proxyToolResultFailed,replaceMessages) — not PR changes. - Master-window changes to the PR's files are orthogonal (file by file):
kernel/src/hide-consumed.ts— UNCHANGED on master in the window; the guard at the hide decision point and my round-1 run-semantics verification hold verbatim.kernel/src/wire/anthropic.ts— #7270 directive-only-system heal adjustment + newhealUnpairedServerToolBlocksbackstop. Both are post-render passes: thecoreToAnthropicgrouping loop (consecutive same-role cores → one wire message, the boundary the guard's "run" mirrors) is untouched, and the new heal only rewrites system messages andserver_tool_use/*_tool_resultblocks — plaintool_use/tool_result(the compress pair) are explicitly never touched. No interaction with the guard. (One adjacent observation on the new heal itself — see the 🔶 comment below.)kernel/src/compress.ts/kernel/src/types.ts— #6928 removal of the #4521statusLinerefresh line; orthogonal tohideCompressCallsNode(hunk offsets shift consistently).src/server.ts—hasSignedThinkingBlock(now :2419) and theplanReasoningDropsigned gate (:2455) UNCHANGED; the window's deltas (#7022 loopback classification, process-handler install refactor, preflight egress-fuse probe block + image accounting) do not touch the predicate or its wiring.src/config.ts— new opt-inreasoningDrop.tail(default false, implemented insrc/reasoning-drop.ts:53) + pi-subagentsnotifyStructured; the PR'sisStrandedProtectedPredecessorexport (:1667) andloadOptionskernelConfig wiring (:1801) intact.src/stream.ts— all window hunks fall outside thevisibleSummaryStubsarea (window hunks jump from :588 to :1131; the scanner sits at :919); my round-1 drive-by fix intact.src/loop/core.ts— window addsreplaceMessages(identity-preserving splice) andproxyToolResultFailedadjacent to the hide call; the PR's 4th-argument pass-through intact (:1656).
- Re-verified locally on
26b39aedd: issue5864 + stub-guard 10/10, full kernel suite 1645/1645, bili reasoning/verif family 74/74, typecheck clean. CI green on26b39aedd(all check runs success/skipped, 0 open).
No new findings in the PR's own diff; no blocking findings. The kernel human tier still gates the merge (see the 🔶 需要决策 comment; head ref updated, plus one adjacent master-side observation routed there as a decision item).
八问(中文,第 3 轮 — 与第 1/2 轮一致,仅版本号与窗口核查更新)
- 是什么问题:同前(signed thinking + compress 同回合后,出站 assistant 消息塌缩为单个 thinking 块 → Anthropic 400,会话当场不可用)。
- 什么原因导致的:同前(reasoning-drop 侧绝不丢 signed thinking × kernel 隐藏侧独立藏掉已消费对,两个保守机制互不告知,交集产生非法线形)。
- 影响范围与严重程度:同前(plugin 模式 × Anthropic wire × extended thinking × 同一 run 内 signed thinking 与已消费 compress 对;报告者实测 ~19%,命中即 400,完全不可用)。
- 怎么修复的:同前(kernel 隐藏决策点加可选宿主端口
strandedProtectedPredecessor,同 run 前置受保护块时强制保留对可见;端口不设定时逐字节不变)。 - 是否有回归问题:无(同前;本轮另逐文件核对了 688 提交的 master 窗口:hide-consumed.ts 零改动,wire/anthropic.ts 新增 heal 与 compress 对正交,谓词与接线原样,无新交互)。
- 是否破坏缓存:不(同前)。
- 是否改了设计方向:没有(同前)。
- 是否引入了新的配置:没有(同前)。
Verdict: no blocking findings; still findings-only — kernel PRs sit at the human-only tier.
|
🔶 需要决策 1) Head update — authorization request stands. The branch was rebased onto current master: head is now 2) Adjacent master-side observation (same symptom as #5864, different mechanism) — needs your call. While auditing the master window I found a second producer of the exact 400 this PR fixes ("the final block in an assistant message cannot be
Suggested handling, per the same-symptom rule (owner policy 2026-10-13: same user-visible symptom → one issue): track it as a mechanism-level sub-defect under #5864, not a new issue. Suggested fix shape: when the heal drops the last non-thinking block of a message, append the existing placeholder text block ( |
[bot] 第 3 轮审核完成(PR 再次 rebase 到最新 master 6453fee,head 26b39ae,kernel 版本 0.0.200→0.0.201):diff-of-diffs 核对 PR 自身改动与第 2 轮逐字节一致(仅版本号与 hunk 偏移);688 提交的 master 窗口逐文件正交——hide-consumed.ts 零改动,wire/anthropic.ts 新增的 server-tool heal 与 compress 对显式不相交,谓词/接线/scanner 全部原样。本地复验全绿(10/10 + kernel 1645/1645 + 74/74 + typecheck),CI 全绿(35 success/15 skipped)。无新阻塞发现。另有一个 master 侧观察按 🔶 需要决策 上报:窗口新增的 healUnpairedServerToolBlocks 在 thinking 与 server-tool 孤儿块同消息时可能产出「thinking 收尾」消息——与本 PR 修的 #5864 同一 400 症状、不同机制,建议按同症状归并规则挂到 #5864 清单,修法已给出(kernel 档,待 owner 拍板)。第 3 轮 findings-only review + 🔶 head 更新评论已发,仍等 owner 人工批准档。 |
(ai: vllm-qwen/qwen3.8-27b) Status — this is a mirror echo of the round-3 decision request; no new owner input since 2026-11-19 17:59Z. State re-verified live today (2026-11-20):
Action taken: the pending kernel authorization has been hanging in-thread for 10 days (🔶 requests on 11-10, 11-12, 11-19 — no response). Per the decision-escalation and authorization-gate policies, it is now escalated to a dedicated issue: #7331 — "kernel authorization request: PR #5877 (fix #5864: 400 'final block cannot be thinking' after compress) — approve or reject" (p1 intent; the mirror shim does not implement the labels endpoint, so the p1/bug/scope/kernel/claude-code labels could not be applied — intent recorded in the issue body). That issue carries the full decision record:
Context note: per the owner's 2026-11-12 ruling, #5864 is folded into the wire-fidelity aggregation #6454; the aggregation thread's own conclusion (floor 10/12) is that #5877 stays the designated independent kernel PR for that member — a kernel change cannot be absorbed into a host PR (kernel-guard CI). So the only gate on this PR remains your sign-off. The in-thread 🔶 request is superseded by #7331 — I will not re-post it on each rebase echo. Standing down pending your decision; no self-approval, no PR-body edits. |
Summary
Fixes #5864 — Anthropic rejects bili's outbound request with
400 messages.N: The final block in an assistant message cannot bethinking.right after acompresscall whose assistant turn also carried athinkingblock before the tool_use ([thinking, tool_use:mcp__bili__compress]).Root cause
Two independent decisions about the SAME assistant turn were each locally correct but jointly illegal:
planReasoningDrop(src/server.ts) returns an empty drop-set whenever ANY signed thinking block is in view ([bug] dropCompressReasoning (#651) strips inbound thinking from compress tool_use on Anthropic wire, triggering thinking-pair-violated warning (#684) #1658/[acp-loop] In-turn compress re-request edits the latest assistant message → Anthropic 400 "thinking blocks … cannot be modified" (session stays broken) #1960 doctrine: signed Anthropic thinking must round-trip with its tool_use sibling and can never be dropped). So the pre-compress reasoning survives.hideConsumedCompressCallsremoves an inactive compress call+result pair independently of what precedes it.When both fire together the pair is hidden but the signed thinking block stays, collapsing the assistant message to
[thinking]→ upstream 400. On the Anthropic wire every extended-thinking block is signed, so this only bites on extended-thinking sessions where a fold boundary lands right after a[thinking, compress]turn (why only 5 of 27 such turns failed).Fix
Add an optional host-injected predicate
strandedProtectedPredecessorto the kernelConfig(a function-typed port, uninterpreted by verif exactly like the existingisCompressTool). InhideConsumedCompressCalls, when the assistant-message run containing a would-be-hidden compress pair still holds a protected core — a signed thinking orredacted_thinkingblock anywhere earlier in that same run (an intervening text/tool core between the thinking and the call is common) — keep the pair visible instead of hiding it, so the signed block always round-trips with a tool_use sibling (#684 invariant). A run is the consecutive assistant-role cores thatcoreToAnthropicrenders as one assistant message; the scan stops at the first non-assistant core. Wired to a signed-thinking check insrc/config.ts(twin ofhasSignedThinkingBlock). Unset predicate ⇒ byte-identical behavior, so non-Anthropic wires and other hosts are unaffected.Behavior change (intentional)
hideConsumedCompressCalls, even when doing so stranded a signed thinking block as a thinking-final message (→ upstream 400).redacted_thinkingblock. Cost: one small compress tool_use+tool_result stays in the forwarded history on those turns instead of being removed — bounded, and far cheaper than a lost turn + 400. Once no protected block remains in the run (folded out / shifted across the run boundary) the pair hides normally again. (After review this supersedes the earlier immediate-predecessor-only form:[thinking, text, compress]also strands the sibling, so the guard scans the whole run.)Tests
tests/issue5864-signed-thinking-orphan.test.tsdrives the real pipeline (planReasoningDrop → processTurn → stripKernelSummaries → applyReasoningDrop → coreToAnthropic) across five shapes: adjacent[thinking, compress](pair kept, no assistant message ends in thinking/redacted_thinking, and the thinking block round-trips byte-exact including signature), intervening-text[thinking, text, compress](pair kept), multi-compress[thinking, c1, c2](c1 kept, c2 hidden),redacted_thinking(pair kept), and an unsigned control asserting both the [Bug] MCP compress 未接入 reasoning 清理及未完成调用保护 #3222 reasoning drop AND that the pair is actually hidden. Fails without the fix.kernel-change: add optional strandedProtectedPredecessor host port to hideConsumedCompressCalls so a consumed compress pair is never hidden in a way that strands a signed thinking block as a thinking-final assistant message (upstream 400, #5864). Host-side cannot solve it: the pair-hiding happens inside the kernel processTurn, and dropping/relocating the signed thinking block is forbidden by the #1960 signature doctrine.
Fixes #5864