Repository navigation
[PR] fix(plugin): don't drain held tags on inert mid-stream frames (#5848) - #5849
ranxianglei merged 2 commits into
Conversation
…nglei#5848) MTPLX interleaves a text-less progress frame ({"choices":[{"delta":{},"finish_reason":null}],"mtplx_progress":{...}}) roughly every ~15 decoded tokens. processOpenai's no-text path drained the tag-echo filter on it, so a render tag split across the frame lost its held head (`<acp tokens="3`) and the rest (`1" type="text" ...>m00039`) reached the host as prose -- the opener-less residue reported in ranxianglei#5192. Only drain on a text-less frame when it carries something a held tail must precede (finish_reason, tool_calls or another delta key); terminal and [DONE] drains (ranxianglei#1546) are unchanged. Co-authored-by: Cursor <cursoragent@cursor.com>
|
CI note: the 3 red |
(ai: vllm-qwen/qwen3.8-27b) 查重:不重复。 open+closed 全检索(含 PR):没有其他条目修同一机制(mid-stream 空 delta 帧 drain tag-echo filter);GitHub 按 5848/5192/MTPLX 搜 open PR 只命中本 PR。相关历史:#5192(现象总账)、#1546(terminal drain,本 PR 不动)、#2405(空 finish_reason 先例,代码注释已引)。 标签:bug / scope/wiring / p2 —— 特定上游帧形状(MTPLX 系 progress frame)下渲染标签残片漏进宿主可见文本;可用、无数据丢失、无缓存影响。注:本沙箱的镜像 label API 未实现(endpoint not implemented),意图标签在此报备。 审核结论:APPROVE(代码可合;CI 三红为继承性 master 红,待其修复落地后重跑)① 原 issue 方向#5848 给了日志证据:MTPLX 每 ~15 token 发一个 ② 回归审查(触碰路径上的既有行为逐项清点)
唯一行为变化:非终态、无文本、且每个 choice 的 delta 为空或仅 reasoning 系键、finish_reason 为 null/空/缺省的帧,不再提前 flush;held tail 由下一个文本 delta 或 terminal/[DONE] drain 释放——客户端净可见字节与「没有该帧」的流一致。带 role/tool_calls/其他 delta 键或非空 finish_reason 的帧照旧 drain(helper 返回 true)。无 fail-fast 变吞错、无阈值/时序/输出格式漂移;PR 正文已正确披露旧→新。 ③ 代码一行门 + 四行 why 注释(引案号)。helper 复用非复制;无死代码、无魔法值、风格与文件一致。干净。 ④ 测试有效性3 个新用例全部是客户端可见文本的字节级断言(不是 mock 套 mock)。牙口独立验证:把那一行 revert 回 master 行为 → 3/3 全挂;合上修复 → 3/3 全过(本地实测)。同 head 相邻 12 个套件(tag-echo 核心/chunking-determinism/verif-guard/finish-tail(#1546)/两个 tag-strip passthrough/passthrough-visibility/strip-idempotency/proxy-noinject/bili-artifact/e2e-tag hermetic)193/193 绿。负向方向由未改动的 finish-tail 套件兜住(terminal drain 仍触发),符合 §3617 正反双向门禁纪律。 ⑤ diff 整洁度2 文件 +112/−1,每一行都在主题上。一处纯外观小疵(不阻塞、不值得改写外部贡献者历史):commit message 里嵌了 agent 会话引用字面量 ⑤b 代码整洁(外部提交从严)命名达意;注释讲为什么(引案号)不复述代码;测试文件沿用仓库既有惯例(tests 里裸写标签字面量与 tests/tag-echo.test.ts 等存量文件一致,无 CI lint 反对);零新增依赖。过。 本地证据(仅定向,§7.2)新文件 3/3(revert 后 0/3);相邻套件 193/193; CI 状态(镜像缓存,run @48076d28b)三个红分片(win22-s4 / ubu24-s2 / ubu22-s2)= 继承性 master 红,非本 PR:与 #4599 最新一轮刚登记的继承签名同分片同机制——#5734 E5 self-checkpoint reanchor( 八问
判定:可合——代码审核通过(外部提交从严清单全过);CI 三红为 #4599 在档的继承性 issue5719 master 红,与 PR diff 零交集,master 侧修复落地重跑后转绿即可合并。合并动作归 owner。 |
(ai: vllm-qwen/qwen3.8-27b) 结论先行:三个红 shard 是继承性 master-level born-red,对本 PR diff 归因为零;修复已收敛为独立小 PR #5857(对 master,test-only),合入后本 PR 下次 CI 触发即转绿。本 PR 代码本身无需任何改动。 验证过程(不信转述,全部本地复现)
为什么不在本 PR 分支内修PR head 位于作者的外部 fork( 修复(#5857,已开)fixture 的 conv 声明改为 FOREIGN( 八问
收工判定:本 run 三个红项全部为继承性 born-red,归因零残留;修复闭环在 #5857(单一小 PR,非拆片)。#5857 合入 master 后,本 PR 的下一次 CI 触发(author re-push 或手动重跑)这三个 shard 即转绿——在此之前本 PR 无需再动。 |
[ework] auto-fix stalled: test (windows-latest, 22, 4), test (ubuntu-latest, 24, 2), test (ubuntu-latest, 22, 2) — stopping for human review |
1 similar comment
[ework] auto-fix stalled: test (windows-latest, 22, 4), test (ubuntu-latest, 24, 2), test (ubuntu-latest, 22, 2) — stopping for human review |
📦 Merged Build PublishedThis merge to master was published as npm install -g billion-context@0.0.1106-master.e7b3d28 # this exact build
npm install -g billion-context@master # always the newest merged build
|
…itespace gate, ranxianglei#5849 held-tag flush on inert frames Advances the base from 7d18b7a to 1f311dd (8 files). Two files overlap with this lane: src/plugin.ts and src/loop/core.ts. Upstream added a whitespace-only degenerate-retry gate (ranxianglei#732 follow-up) around the request-scoped budget warn in runChatLoop, and stopped draining held tags on inert mid-stream frames (ranxianglei#5848). Both hunks sit clear of the lane's strip gates, so the auto-merge needed no manual resolution. Notable upstream commits adopted: - c5fed0e loop: retry degenerate turns that end with whitespace-only text (ranxianglei#732 follow-up) - 65dd4b3 refactor(loop): drop redundant forwardedVisibleText from the degenerate-retry gate - 5182559 fix(loop): correct double-degenerate warn attribution to the request-scoped budget - 7a51346 test(loop): pin the double-degenerate warn both directions - 4c15903 fix(stream): extend the return-to-task instruction to all parse-failure receipts - 48076d2 fix(plugin): don't drain held tags on inert mid-stream frames (ranxianglei#5848) - 8c3a3f1 test(ci): align issue411 waitFor with the ranxianglei#4161 timing-window idiom - 016d933 test(launcher): cover the ranxianglei#5955 wedged same-lane takeover ladder
ranxianglei#5849 added hadTextOtherThanTextFields to the chat lane after a text-less frame drained a held render-tag head, letting the rest of the tag reach the host as prose. The google lane kept the unconditional drain, on the assumption that it never sees such frames -- an absence of observation, not a property of the lane. A Gemini progress frame whose only part is {text:""} reproduces the same split here, so gate that exit on googleFrameHasNonText, the predicate the rebuilt branch three lines above already uses.
Fixes #5848. Refs #5192.
Problem
processOpenaidrained the tag-echo filter on every text-less frame while a tail was held. MTPLX (and any OpenAI-compatible server that interleaves non-terminaldelta:{}frames) sends such a frame every ~15 tokens, so a render tag split across one lost its held head (<acp tokens="3) and the rest (1" type="text" …>m00039) reached the host as prose — the opener-less residue of #5192. Full mechanism and log evidence in #5848.Change
src/plugin.ts— the no-text drain now requires the frame to carry something a held tail must precede (hadTextOtherThanTextFields: a non-emptyfinish_reason,tool_calls, or any other delta key). An empty-delta frame passes through untouched and the held tail joins the next text delta, where the tag is recognized whole.Unchanged: the terminal drain (
isTerminal, #1546), the[DONE]drain, the no-choicespath, and the Anthropic / Google lanes (no mid-stream text-less frames observed there).Behavior change: on an empty-delta, non-terminal frame a held tail is no longer flushed early — it is released by the next text delta or the terminal drain, i.e. the same bytes the client would have seen without the frame.
Tests
New
tests/plugin-passthrough-progress-frame.test.ts(3 cases, all fail on master, pass here):前の文章。後の文章);Locally on this head (rebased on master c45ac21): all tests that touch
pipePluginChatWithStrip/ the tag-echo filter /stripAcpTags— 574/574 pass, includingplugin-passthrough-finish-tail.test.ts(#1546);npm run typecheckclean. Full regression is left to CI per §7.2.