Repository navigation
[PR] fix: anthropic lane nudge names the <analysis>/<summary> envelope fai… - #3903
Conversation
…lure Anthropic Messages lanes (top-level `system`, `thinking` blocks, `tool_use` blocks) prime the model for the Claude-Code compaction envelope: when compression is due it writes `<analysis>...</analysis><summary>...</summary>` as its reply text instead of putting the summary in the `compress` tool's `content` argument. A reply with no tool call ends the turn, so the session stalls until the user types "continue". `renderNudgeText` did not take the protocol, so all eight call sites across the four lanes emitted the same wording — while tool definitions, message wrapping and SSE parsing were already protocol-dispatched. Add the missing dimension: an optional `protocol` parameter plus an Anthropic-only note that names the envelope the model must not emit and the delivery shape it must use. Every other lane and the protocol-neutral default are byte-identical to before; the note is appended, never substituted. kernel: 0.0.136 -> 0.0.137 (Kernel Boundary version discipline) kernel-change: renderNudgeText gains a protocol parameter so the Anthropic lane's growth nudge can name the <analysis>/<summary> envelope failure
The kernel bump 0.0.136 -> 0.0.137 landed in kernel/package.json + kernel/package-lock.json, but the root package-lock.json still records the file: dependency's version under its "kernel" entry. lock-sync (npm install --package-lock-only + git diff) regenerates it to 0.0.137 and fails on the drift.
…data-only, no file changes)
(ai: vllm-qwen/qwen3.8-27b) 查重:不重复。open+closed issue/PR 按「anthropic nudge 信封」「dsh 压缩卡死」「analysis/summary 泄漏」等多组失败签名检索均无命中;与 #3617(gate 双向断言)、#3401(dsh compress surface 过抑制)同域但机制不同——本条是 nudge 措辞缺协议维度,非 gate 决策问题。 审核结论(结构化八问)
我在 PR 分支上直接修的三处(均已 push,独立 commit/操作,可单独回退)
一个质量缺口 → 已立项 #3910
验证方式说明本地定向跑不了(工作区无 node_modules、registry 在沙箱网络边界外),全量裁决以远程 CI 为准:两个原红 job(lock-sync/kernel-guard)已在最新 head 判定:等新一轮 CI 全绿即可合入(建议现在就合,wiring 测试缺口由 #3910 跟进)。另注:分支落后 master 127 个提交但无分叉,CI 在合并视图上跑,不影响结论;我没有 rebase 作者分支,全部改动都是附加式的。 |
… and cancelled each other (no file changes)
…e nudge test tests/anthropic-lane-nudge.test.ts built its synthetic NudgeDecision from a breakdown/contextBreakdown shape that predates the kernel's growth of those types (several now-required numeric fields), leaving branch typecheck red. Supply the full required fields from a shared BASE_BREAKDOWN (flat-50K nudge growth constants = kernel defaults) without touching any assertion. In-passing fix surfaced while adding the ranxianglei#3910 lane-level wiring test; keeps this branch's CI green.
…i#3910) ranxianglei#3903 added the ANTHROPIC_LANE_NOTE by passing the 'anthropic' protocol literal at both prepare-anthropic renderNudgeText call sites, but every test only drove renderNudgeText directly - nothing asserted the note actually reaches the OUTBOUND wire. If the optional ', "anthropic"' argument were later dropped, TS would not complain and CI would stay green while the ranxianglei#3903 production failure (model writes <analysis>/<summary> as reply prose, ends the turn with no tool call, session stalls) silently regresses. Add tests/issue3910-lane-nudge-wiring.test.ts driving prepareAnthropic through the hermetic server harness (same OVER-LIMIT arming recipe as tests/compaction-trigger-finality.test.ts: local estimate under the band keeps turn 1 clean, upstream-reported usage arms turn 2): - positive: anthropic /v1/messages turn-2 body carries the note exactly once, in the trailing nudge user message; every other message is note-free. - negative (ranxianglei#3617 bidirectional discipline): the same scenario over the openai chat wire appends its nudge too (turn-delta proves non-vacuity) but carries the anthropic note nowhere. Mutation-verified: removing the ', "anthropic"' argument at both call sites turns the positive case red.
📦 Merged Build PublishedThis merge to master was published as npm install -g billion-context@0.0.651-master.724e590 # this exact build
npm install -g billion-context@master # always the newest merged build
|
这个 patch 存在的原因(生产事故驱动)
<analysis>…</analysis><summary>…</summary>当回复正文吐出来,而不是放进compress工具的content参数。裸</summary>泄漏进可见转录;且无 tool call 的回复直接结束轮次 → 会话卡死,直到用户手打 "continue"。renderNudgeText没有 protocol 维度——tool 定义、消息包装、SSE 解析都已按协议分发,唯独四个 lane、八处调用点共用同一份 nudge 措辞。而 Anthropic 形态请求(顶层system、thinking、tool_use块)会把模型 prime 进 Claude Code 的压缩信封习惯,通用措辞没有点名这个失败形态。git grep origin/master无命中 → MR 有效。如何改动(9 文件,+220/−15)
kernel/src/nudge-text.ts(+25):
export type NudgeProtocol = "anthropic" | "openai" | "responses" | "google";renderNudgeText(decision, prompts, sections, protocol?)增可选第 4 参(缺省=协议中立,旧行为);ANTHROPIC_LANE_NOTE:"Write the summary ONLY as thecompresstool'scontentargument. Never emit<analysis>or<summary>tags in your reply text — they are not parsed, and a reply without a tool call ends the turn."src/server/prepare-{anthropic,google,openai,responses}.ts(各 2 行):八处调用点补传各自协议字面量——anthropic 两处(含 fallback 路径),其余 lane 显式声明以便逐字节回归断言。kernel/tests/nudge-text.test.ts(+103):注记在三种分支下存在/不存在、非 anthropic 与缺省输出逐字节等于旧版。tests/anthropic-lane-nudge.test.ts(新增 85 行,3 tests):lane 级回归。kernel/package.json/package-lock.json:按 Kernel Boundary 纪律 0.0.136 → 0.0.137(注:本地原始提交是 0.0.130→0.0.131,摘到最新 master 上已顺势改为 0.0.136→0.0.137,commit message 同步)。兼容性:无配置面改动;非 Anthropic lane 与不传 protocol 的默认路径字节级不变。
kernel-change: adds an optional
protocolparameter torenderNudgeText(kernel/src/nudge-text.ts) plus an Anthropic-lane note naming the<analysis>/<summary>envelope failure mode (production incident, DSH desktop / Anthropic wire); non-anthropic and default-caller output is byte-identical; version 0.0.136 → 0.0.137 per Kernel Boundary rule 2.