Repository navigation
[PR] fix(loop): re-adjudicate nested openings arriving across a chunk boundary in the tag-echo bare-open swallow - #4170
ranxianglei wants to merge 2 commits into
Conversation
📦 Built Package ArtifactBranch: Option A — Install this exact build (recommended)npm install -g billion-context@0.0.4973-pr.4170.c9abc0aThis exact version is immutable and reproducible. The rolling Option B — Download artifact
tar xzf billion-context-pr4170.tgz
npm install -g packageInstall instructions are refreshed on each push. |
(ai: vllm-qwen/qwen3.8-27b) 查重: 不重复。 检索 open+closed issue/PR(按失败签名:tag-echo 裸开标签 × chunk 边界 × LONE_OPEN swallow 释放路径):本 PR 是该失败域的唯在途修复。相关但不同:#4163 = 本 PR 修的 bug 本体(#Closes);#4169 = PR 正文自述的另一个机制(整段推入时 release 分支不重剥的内部 parity gap,与分块无关),已单独跟踪,不属本 PR 范围;#4162 = 同文件另一边界族(PARTIAL_TAIL 头部后行断言盲区),不同机制。无并列重复 PR。 标签: 正在做完整 PR 审核(读 diff/既有行为回归清点/测试有效性/CI),结论按结构化八问随后给出。 |
…ing arriving across a chunk boundary — #4163 The #1720 nesting evidence for a lone open render tag ('more tag structure follows in this same chunk -> drop alone, let the inner markup decide') was judged on the CURRENT buffer only. When an SSE boundary fell after the first bare open, the later opening accumulated into the live swallow span and the #1881 EOF bare-release / close-resolution release branch handed it to the client verbatim: whole-buffer push stripped both opens, the split push leaked the second one — same logical output, different persisted bytes per chunking (#3198 determinism contract violated). While a bare-open RELEASE session is live, a new LONE_OPEN inside the accumulated span is exactly that nesting evidence arriving late: release the prefix as prose, count the outer opening as dropped alone, and re-adjudicate from the inner opening through the normal loop — the code path the whole-buffer run takes. Gated to bare-open release sessions (attrs-bearing tails are tag content end-to-end per the #644 EOF rule, wrapped turns discard their payload wholesale) and to openings that precede any close terminator (close-first still resolves on the existing path). Establishes the invariant that swallowed never holds a LONE_OPEN, so no flush-side change is needed.
bf1513d to
3454d84
Compare
…nt leak (#4107 shape 2) The bare-open re-adjudication changes the streaming output for the pinned C#4107-2 shape (close fragment at chunk boundary + nested bare open behind it): the split path now matches whole-text byte-for-byte instead of releasing the nested open verbatim. The pin asserted the bug was still present and instructed itself to be flipped when fixed — done. It becomes a permanent parity pin (streaming === whole-text, no leaked nested open). Shape 1 (C#4107 dead-ref residue) is still broken and stays pinned; the P1 domain exclusion stays in place for it. verif/README.md ledger updated accordingly.
(ai: vllm-qwen/qwen3.8-27b) Review 完成(独立审过代码、测试与 CI,不只是读描述)。先说我在 review 过程中做的两件事,再按八问给结论。 Review 中执行的动作(均已落到 PR 分支)
结构化八问
测试有效性:新测试是真测试——10 个固定形状 × 每个单切点 × 20 组种子随机拆分,全部钉住期望字节;另有 dropCount 跨块不变性与两组负控制(单开 #1881 语义不被新门控波及、attrs/wrapped 会话不受影响)。我把新测试文件拷到未打补丁的 master 上跑过,确认它会失败(回归钉属性成立)。8 个定向套件本地绿;全量以 CI 为准。 判定:根因修复、回归面已清点、diff 干净(现共 2 个 commit:原修复 + 翻钉)。按 §7.4,本 PR 触碰响应流字节(wire/message shape)→ 人审合并档,不走 auto-merge。新 head |
(ai: vllm-qwen/qwen3.8-27b) CI 确认(新 head
结论不变且现在证据齐了:本 PR 无确定性失败残留,windows 那次红是环境性 flake(如需留痕可自行决定是否单独记一笔,我没有为此开 issue——它不构成本 PR 的合并阻塞,也查不到具体挂在哪条测试)。 收工判定:代码与回归面审毕、行为变化已披露(#4107 形状 2 顺带修复 + 翻钉)、CI 干净。按 §7.4 属人审合并档(触碰响应流字节),可以合并:#4170 |
…lose-fragment leak (ranxianglei#4107 shape 2) The bare-open re-adjudication changes the streaming output for the pinned C#4107-2 shape (close fragment at chunk boundary + nested bare open behind it): the split path now matches whole-text byte-for-byte instead of releasing the nested open verbatim. The pin asserted the bug was still present and instructed itself to be flipped when fixed — done. It becomes a permanent parity pin (streaming === whole-text, no leaked nested open). Shape 1 (C#4107 dead-ref residue) is still broken and stays pinned; the P1 domain exclusion stays in place for it. verif/README.md ledger updated accordingly. (cherry picked from commit 8b6c098)
Closes #4163
Root cause
The #1720 nesting evidence for a lone open render tag ("more tag structure follows in this same chunk -> drop alone, let the inner markup decide") was judged on the CURRENT buffer only. When an SSE boundary fell after the first bare open, the later opening accumulated into the live swallow span and the #1881 EOF bare-release / close-resolution release branch handed it to the client verbatim: whole-buffer push stripped both opens, the split push leaked the second one — same logical output, different persisted bytes per chunking (#3198 determinism contract violated).
Fix
While a bare-open RELEASE session is live, a new LONE_OPEN inside the accumulated span is exactly that nesting evidence arriving late: release the prefix as prose, count the outer opening as dropped alone, and re-adjudicate from the inner opening through the normal loop — the code path the whole-buffer run takes. Gated to bare-open release sessions (attrs-bearing tails are tag content end-to-end per the #644 EOF rule; wrapped turns discard their payload wholesale) and to openings that precede any close terminator (close-first still resolves on the existing path). Establishes the invariant that
swallowednever holds a LONE_OPEN, so no flush-side change is needed.Behavior change (old -> new)
Only the reported shape changes: with two or more bare opens, a chunk boundary falling after one of them previously leaked the later open(s) into body text; every chunking now produces exactly the whole-buffer bytes (e.g.
<acp><acp>text->textfor all splits; was<acp>textfor between-tags splits). No other input class is touched — single bare opens keep the #1881 prose-wearing semantics, attrs/wrapped sessions are gated out (asserted by negative-control tests).Residual corner (documented, not fixed)
A pending ref run longer than IMITATION_SWALLOW_CAP (4096 chars) flips the session to non-releasing BEFORE a later-arriving opening can trigger the split, so a >4KB pure-ref run followed by markup can still diverge whole-push vs boundary-push. Flipping releases back on arrival would resurrect discarded payloads; left as-is (bounded extreme).
Adjacent finding
Verified while working this: an attrs-bearing payload with a nested bare open (
<acp tokens="1">junk<acp>text</acp>) streams tojunk<acp>textwhile whole-text stripAcpTags yieldsjunktext— a deterministic streaming-vs-whole-text parity gap (whole-buffer push already diverges; unrelated to chunking, distinct mechanism: release branches hand back interior without re-stripping). Out of scope here (semantic decision on re-adjudicating attrs-payload interiors); tracked in #4169.Tests