Repository navigation
[PR] fix: fail open when a marker strip would blank the latest user turn (#5812) - #5816
Conversation
📦 Built Package ArtifactBranch: Latest build — install this exact versionnpm install -g billion-context@0.0.8926-pr.5816.d4c5665This exact version is immutable and reproducible. The rolling Recent builds (commit → version)
Download artifact
tar xzf billion-context-pr5816.tgz
npm install -g packageInstall instructions are refreshed on each push. |
(ai: vllm-qwen/qwen3.8-27b) 查重: 不重复 —— 本条即 GitHub issue #5812 的修复 PR(GitHub PR #5816)的镜像;open [PR] 列表里没有第二个针对同一主题(marker strip 把最新用户轮打成空格)的条目。 标签: 这是 [PR] 镜像(agent 已完成的工作),按规矩不重做,改为核对代码 + CI。目前进展:
完整八问结论稍后补在本线程。 |
(ai: vllm-qwen/qwen3.8-27b) 核对 + 验证全部完成。结论:可合并(合并留给你:#5816) 八问结论
验证证据
判定:可合并。 |
…5812) stripTextSlot replaced a text slot with a single space whenever the marker-line strip left it blank, without checking whether that marker line was the user's only content. A pasted marker-shaped error line (a bug report whose first line starts with a symbol + [ACP]) was delivered to the model as one space. The raw-stage strip already skipped the status-body path for the latest user turn (the current turn is live input, not echoed history), but the marker-line path ran on every slot. Extend the same predicate to marker-line blanking: if stripping the latest user turn collapses it to whitespace, return the original bytes instead of a space, counting nothing as stripped. Older user slots and assistant slots are unchanged - bili injects its own visibility markers into older user-role slots, so only the latest turn is safe to fail open. Rename the option noStatusBody -> latestUserTurn to reflect that it now governs both guards. Fixes #5812
9d2bfad to
2c9de23
Compare
(ai: vllm-qwen/qwen3.8-27b) Conflict resolved, branch rebased onto current master, full CI green on the new head. Nothing else was red this run — the only blocker was the merge conflict. What happened this run
No design decision was needed, no authorization gate was hit (diff stays in 七问(本轮 CI 处置)
判定:冲突已解、CI 全绿,可合并(合并操作留给你)。 |
[ework] CI fix verified green ✓ |
ranxianglei
left a comment
There was a problem hiding this comment.
(ai: vllm-qwen/qwen3.8-27b)
⚠️ Posted as a comment review: GitHub rejects APPROVE on the author's own PR (HTTP 422 self-approval ban). The verdict below stands.
APPROVE — independent end-to-end review of head e322097c09 (fix commit 2c9de23124 + my one-line comment repair).
Direction (original issue). Issue #5812 is real and correctly diagnosed at the root: stripTextSlot() degraded any marker-line strip that blanked a slot to " " unconditionally, while the existing #2815 paste guard exempted only the status-body path for the latest user turn. The fix extends that same predicate to the marker-line path at the decision point — the producer of the empty slot — not a mask downstream. All four wire walks share this one function, so the same root cause cannot resurface per-wire.
Rebase interaction (#6018). The fail-open branch sits inside master's new t.includes("[ACP]") literal gate (src/marker/engine.ts:80-90). The gate cannot swallow the fix: MARKER_LINE requires the literal [ACP], so where it is absent nothing matches and no slot can be blanked there anyway. Verified hunk by hunk.
Regression audit — existing behaviors on every touched path:
- older user slots & assistant slots still degrade to
" "(flag false → old code path; pinned by the new boundary test incl. tool_calls survival); - partial strips (marker line + prose) keep byte-equivalent semantics (the
stripped = out.trim()refactor preserves the old ternary); - status-body consumption unchanged (rename only; #2815 skip preserved);
- KDD#10 signed slots (thinking/redacted/reasoning/thought/thoughtSignature) are still skipped before the strip walk; the flipped control assertion is correct — I checked the fixture:
messages[1]is the sole/latest user turn, not a tautology; - nudge-echo splice runs after
stripTextSlot; a fail-open'd pasted line cannot match nudge text (different shape) — no interaction; - fold-reconcile's
markerStrippedinput now excludes fail-open'd lines from the artifact count — more accurate (they are user input, not bili artifacts) and stable per pass, so no churn/misdiagnosis introduced; - fastpath watermark lane + fork-adoption lanes run the same engine with
lastUserIdxcomputed inside their fragment — consistent, no double handling; - both compression modes covered: the raw stage runs unconditionally in every prepare-* lane before mode-dependent projection (verified all four call sites).
Tests. Real assertions with teeth: exact-byte preservation + markerLines === 0 count assertions on all four wires; boundary rows prove the gate does NOT over-fire (older/assistant slots still blank); non-degenerate row proves marker+prose still strips the marker and keeps the prose. Gate discipline (#3617) satisfied in both directions.
CI. Mirror cache at 2c9de23124: 30 checks, 0 failed / 0 pending. Local targeted re-run after my comment commit: marker-lane-coverage + fastpath 33/33 green. The comment-only commit re-triggers CI; no behavior delta possible.
Conventions. Rename complete (zero residual noStatusBody repo-wide); diff clean (2 files, every line relevant); behavior change disclosed old→new in the body; config-surface N/A correctly declared; no kernel/ touch → no authorization gate; Fixes #5812 present.
One adjacent finding is routed separately as 🔶 需要决策 (panel/report whole-message splice can still remove a pasted latest turn wholesale — pre-existing, different class, a semantic scope call): see the follow-up comment.
八问(中文,供人工复核)
- 是什么问题:用户最新消息整条恰好是一行「符号 + [ACP]」形态的文本(典型场景:把 bili 自己的报错行原样贴进输入框求助)时,出站 raw 层的 marker 行剥离把整个槽位剥空后无条件填一个空格——模型收到空轮,客户端 UI 却显示原文。
- 什么原因导致的:
stripTextSlot()(src/marker/engine.ts)的 marker-line 路径对「剥完变空」一律降级" ",不判断这一行是不是消息的全部内容;#2815 已有的「最新用户轮 = live input」谓词此前只豁免 status-body 路径,marker-line 这条兄弟分支漏在守卫外。 - 影响范围与严重程度:p2、触发面窄——最新一条 user 消息的全部内容必须恰好是一整行 marker 形态;四条 wire × 两种压缩模式均受影响;该条件下当轮输入对模型为空(答非所问/反问),无数据丢失、会话可继续、有绕行。
- 怎么修复的:把既有「最新用户轮」谓词延伸到 marker-line 空白化这一步——剥空且是最新用户轮时返回原始字节(fail open)、不计剥离数;旧 user 槽与 assistant 槽保持降级为空格(保住 bili 自注入 marker 不外泄的既有不变量)。选项改名
noStatusBody→latestUserTurn反映其现管两个守卫。修在决策点(根因),不是输出侧打掩码。 - 是否有回归问题:无。逐项审过触碰路径的既有行为:旧槽降级不变(边界测试钉住);部分剥离语义逐字等价;status-body 消费仅改名;KDD#10 签名槽仍在 walk 前显式跳过(控制断言翻转经 fixture 核对正确);nudge 整条移除与 fail-open 内容形状不冲突;fold-reconcile artifact 计数排除 fail-open 行更准确且逐轮稳定;fastpath/fork-adoption 走同一引擎行为一致;rebase 与 #6018 字面量门的交互逐 hunk 核过(门内无
[ACP]字面量时正则必不命中,不可能吞掉修复)。唯一行为变更即 PR 已披露的 old→new。 - 是否破坏缓存:否。变化只发生在最新用户轮位置——该位置每轮本来就在变、位于一切前缀缓存 seam 之外;旧槽前缀字节逐位不变;重试/增量游标/去重键不受影响。
- 是否改了设计方向:否。是 #2815 paste-guard 哲学在同一 stage 的延伸(最新轮 = live input,不是回显历史),不改架构/边界/数据流。已知取舍:raw 层无法凭内容区分「用户粘贴」与「伪造 marker」——伪造进最新轮的暴露面在本 PR 之前经 status-body 路径就已存在,本 PR 是让两条路径对齐,不扩大信任面。
- 是否引入新配置:无。无 config 字段/env/CLI flag/持久化/wire 形状变化。
判定:可合并(合并留给人工)。相邻缺口(panel 整条 splice 仍可能删掉粘贴的最新轮)已按 🔶 需要决策 流程单独留言,不阻塞本 PR。
|
(ai: vllm-qwen/qwen3.8-27b) 已顺手修:PR 编辑把 |
|
🔶 需要决策 (ai: vllm-qwen/qwen3.8-27b) Review 中发现一个同失败域的相邻缺口——非本 PR 引入、超出 #5812 范围;是否/如何扩展粘贴守卫是语义范围判断,需要你拍板,故单独列出、不动代码。 缺口:入站 raw 层的两类整条移除仍可能把「最新用户轮」整体删掉(比 #5812 的空格更重——模型直接看不到这一轮),而 #2815/#5812 的粘贴守卫未覆盖它们:
为何不在本 PR 顺手修:把守卫扩到这两类是语义范围决策且有真实反风险——若某宿主把报告形态的上下文块追加成尾部 user 消息,fail-open 会让它每轮泄漏到上游。#2815 的先例是按类逐次扩展、以现场证据驱动;panel 类目前无现场报告。本 PR 的范围(marker-line 类)本身正确,不应由 reviewer 越权扩大。 选项:
代价对比:B/C 在未证实前给怪宿主多开一条泄漏面;A 留一个低概率 p2 形空洞。 |
(ai: vllm-qwen/qwen3.8-27b) Review of PR #5816 done: full independent review posted on the PR with verdict APPROVE / 可合并 (posted as a COMMENT review — GitHub 422-bans self-approval on the author's own PR; human approval click still required), incl. 八问 and per-path regression audit; 已顺手修: restored the render-tag example stripped from the |
[bot] 🏷 (ai: vllm-qwen/qwen3.8-27b) Task wrap-up for PR #5816 review lane: Done & verified:
Pending owner decision (non-blocking): one adjacent pre-existing gap found during review — panel/report whole-message splices (src/acp-panel.ts:102-116 / :267-283, src/marker/engine.ts:174-186) can still delete a latest user turn wholesale when the user pastes an (The immediately preceding thread comment was the syncer echoing my own decision comment back — no new input there.) |
📦 Merged Build PublishedThis merge to master was published as npm install -g billion-context@0.0.1164-master.1fbcdcf # this exact build
npm install -g billion-context@master # always the newest merged build
|
What & why
stripTextSlot()(src/marker/engine.ts) replaced a text slot with a single space whenever the marker-line strip left it blank — without checking whether that marker line was the message's only content. A user message whose entire text is one line starting with a symbol +[ACP](e.g. pasting a bug report like❌ [ACP] stream error: ... 这是什么报错?) was delivered to the model as a single space, so the model saw an empty turn while the client UI still showed the original text.Root cause
The raw-stage strip already skipped the status-body path for the latest user turn (the current turn is live input, not echoed history — the #2815 paste guard). But the marker-LINE path ran on every user+assistant slot regardless; when it blanked a slot it unconditionally set
" ".Fix
Extend the same "latest user turn" predicate to the marker-line blanking: if stripping the latest user turn collapses it to whitespace, return the original bytes instead of a space (counting nothing as stripped). Older user slots and assistant slots are unchanged — bili injects its own visibility markers into older user-role slots (
src/compress-loop-responses.ts), so only the latest turn is safe to fail open. Renamed the optionnoStatusBody→latestUserTurnsince it now governs both guards.Behavior change (old → new)
" "; new → original bytes preserved (fail open); nothing counted as stripped." "(this is what keeps bili's own injected markers from leaking upstream).Config surface
N/A — no config field added, renamed, or re-semantics'd. No env var. No CLI flag. No persistence/wire-shape change.
Tests
Regression tests in
tests/marker-lane-coverage.test.ts:Also updated the existing KDD#10 control assertion (a latest-user status-marker slot now stays intact rather than becoming a space).
Local: typecheck clean;
tests/marker-lane-coverage.test.ts12/12,tests/fastpath.test.ts19/19, plus 7 other marker-subsystem files 78/78. Full-suite verdict = remote CI on this head.Fixes #5812