Repository navigation
Conversation
(ai: vllm-qwen/qwen3.8-27b) 查重: 不重复 — no other issue/PR (open or closed) covers the server-tool pairing 400 after folds. Nearest neighbors: #5432/#5522 (mid-conversation system positions — same kernel-heal pattern, different constraint) and #3410 (raw-block passthrough — the mechanism that makes the orphan possible). Review verdict: direction correct, design sound, verified locally + CI green; one discipline gap to close before merge. Direction — the bug is real. Mechanism confirmed in code: MCP concern — raised and resolved. I initially suspected the Regression audit (existing behavior walked):
Verified locally (pr6428 head
Findings:
八问 (structured conclusion):
标签(仅建议,源 PR 按 no-mutate 规则不动): 判定:方向、设计、测试、CI 均已验证通过;补齐 WC-025 台账条目(finding 1)后即可合并。kernel 变更属于 human-only 档,由 owner 合并。 |
|
Landed via batch PR #6482 (merged) — closing as superseded. |
ca177b9 to
2153152
Compare
…lict at 0.0.198 Master advanced past the PR base (batch4 kernel fixes #6428/#6345/#5166 -> kernel 0.0.197, storage-render chat golden digest refresh, pi-subagents 0.2.4, 305 files). Content hunks auto-merged (kernel/src/compress.ts, tests/golden/storage-render/chat.json); the only conflicts were the three kernel version lines, resolved at 0.0.198 = master's 0.0.197 + this PR's kernel/src change, per the CI-enforced kernel version discipline. Targeted local verification: tests/golden-storage-render.test.ts 5/5, kernel issue6116/issue3769/hide-consumed suites 27/27.
kernel-change: mechanical wire-legality bug in
coreToAnthropic— a fold can split a server-tool exchange (server_tool_use+<name>_tool_result) and the encoder forwards the orphan half, which Anthropic rejects with a hard 400. Fixed under the mechanical-bug exemption (owner policy 2026-11-06): reproducing regression test included; human-only review tier still applies.What this fixes
Server-side tools (advisor, web_search, code_execution, …) put both halves of an exchange inside one assistant message:
server_tool_use(idsrvtoolu_…) and its<name>_tool_result(paired bytool_use_id).anthropicToCoresplits every content block into its ownBiliMessage(unknown types ride therawAnthropicBlocksidecar, #3410), so a fold can cover one half and leave the other. The encoder then forwards the orphan and Anthropic rejects the whole request:Field repro: Claude Code with the advisor tool through the proxy, bili v0.1.213 / acp-kernel 0.0.195. A subagent got 12 consecutive 400s right after folds. Overflow self-heal doesn't recognize this 400 (log:
upstream 400 carries no parseable overflow marker), so it isn't retried with a different shape.Change
healUnpairedServerToolBlocks(out)runs incoreToAnthropicright beforehealIllegalSystemPositions. For each assistant message it:*_tool_resultblock (excluding plaintool_result) whosetool_use_idhas noserver_tool_usein the same message;server_tool_usewithout its result, except in the last message, where an open server call is legal client state;Plain
tool_use/tool_resultblocks are never touched. Legal messages keep the same object, so the prefix cache sees no churn. Only messages that would already 400 get rewritten, so KDD #10 (thinking signatures) can't turn a request that would have succeeded into a failure.The suffix rule
endsWith("_tool_result")matches the conventionlegitimatesFollowSide(#5438) already uses for the server-tool result family.Version: acp-kernel 0.0.195 → 0.0.196 (
kernel/package.jsonplus both lockfiles).Tests
kernel/tests/server-tool-pair-heal.test.ts, 5 tests, covering both directions (Test Blind Spot Retrospective: Reinforcing Negative Assertion Discipline, Tightening Fake Upstream Strictness, Thin Inst | 测试盲区复盘:补反向断言纪律、假上游严格化、薄安装冒烟、形态矩阵与生命周期覆盖 #3617):tool_use/tool_resultis untouched;npm --prefix kernel test: 1636 pass / 0 fail. Kerneltsc --noEmitis clean.Config surface
None.
🤖 Generated with Claude Code