Skip to content

[Bug] Drifted open-tag names (acpt/acct/accent…) and mid-text draft envelopes reach the client verbatim — two thinking-leak shapes #5175

Open

Description

@Louie0806

Symptom

A visible assistant turn carried the kernel's own render-tag markup verbatim — the same text the reporter pasted:

acpt> </acpt> <acpt m17138></acpt>  </apct> </apct>  <acpt m17140></apct>  </apct> </apct>

and, in the same turn family, a compression draft envelope:

Now let me write the summary.
</analysis>

<summary>
## 1. Primary Request and Intent
...

Both are kernel-emitted structures the filter exists to remove. Neither reached a gate.

Root cause — defect A (drifted open-tag names)

src/loop/tag-echo-filter.ts keys every open-side matcher on ACP_NAME_ALT (buildAcplikeName(), line 55-85). That enum is built as: the three-letter cores (acp, apc, cap, cpa, pac, pca), plus one insertion at every position (acpi, acpa, …), plus three attested drifts (accessacp, acacp, acb).

It has no tail-append arm. Measured against the real export:

name ACP_NAME_ALT
acp match
acpi match
acpt no match
acct no match
accent no match
acad no match
actp no match
acme no match
acc no match

Three gates then all miss the same span:

  1. RENDER_TAG_DETECT (line 578) — enum-keyed.
  2. BROAD_TAG_HEAD_TAIL (line 616) — \x3c\/?[A-Za-z0-9]{0,16}$, which only matches a tail beginning with \x3c; an already-formed <acpt m17138> never does.
  3. PARTIAL_TAIL (line 194) — a suffix probe; an interior tag never satisfies it.

So stripAcpTags("<acpt m17138></acpt>") returned the input unchanged.

The close side already learned this lesson: DEAD_REF_CLOSE (line 229) keys on an open ASCII class, and its comment quotes the census reason — "the close-name drift census is open (ap/ck/ak/fullwidth …)" (#2190). The open side never got the same treatment.

Root cause — defect B (draft envelope)

src/degenerate-turn.ts:78:

const DRAFT_CLOSE_TAIL = /\x3c\/(?:summary|analysis)\x3e\s*$/i;

It is anchored with $, so it only recognises a draft whose </analysis> is the last thing in the text. The reported turn put </analysis> mid-text, followed by the entire <summary> body — the $ anchor can never match, so draftTail stayed false and the dump was released as prose. Three call sites: src/plugin.ts:2663, src/plugin.ts:4074, src/loop/core.ts:1122.

Fix

A — two payload signatures, name-agnostic. Neither can fire on legitimate markup, which #2190 round 3 pins byte-exact (<account>m00375</account>, <acmap>, <acstep>, <acpipe>):

  • DRIFT_PAIR: <N mNNNNN(–mMMMMM)></N> — the ref in the attribute slot, empty body. Structurally impossible as prose.
  • DRIFT_ATTR: <N … tokens=… >refs</N> — the emitter's own attribute.

A matched pair licenses the removal of that name's orphan halves (a lone </acct> is indistinguishable from prose on its own, so the pair is the proof — reusing #1760's rule). Residue lines are adjudicated as a whole: a line whose tokens are all fragments or bare refs and that contains an orphan is the line the imitation is written on.

B — envelope, not just tail. DRAFT_CLOSE_TAIL keeps its $ arm (historical tail form still detects); a new DRAFT_ENVELOPE = /\x3c\/analysis\x3e\s*\x3csummary\x3e/i covers the mid-text form. isDraftDirty → isDraftDump is the shared predicate at all three call sites.

Verification

  • New suite tests/issue5176-drift-name-leak.test.ts — 7 tests: reported paragraph, every tail-append name form, genuine-HTML/#2190 round-3 byte-exactness, tool-call args (.test.ts [bug] 插件透传会剥掉工具调用参数里的 render tag(arguments 流挂了 tag-echo 过滤器) #1039), draft envelope mid-text, historical tail form, ordinary prose negative.
  • Regression: tag-echo.test.ts 79, tag-echo-chunking-determinism.test.ts 4, issue2190-degen-close.test.ts 32, verif-tag-echo-filter.test.ts 17, issue2756-degenerate-gate.test.ts 12, fix-1039-toolargs-verbatim.test.ts 5 → 149 pass, 0 fail.
  • npx tsc --noEmit clean (the pre-existing billion-context-pi-subagents module errors are unrelated and present on master).
  • node scripts/check-unused-exports.mjs clean; node scripts/check-dist-import-annotations.mjs OK; npx tsup build success; node scripts/check-dist-external.mjs OK.

Scope note

The SSE streaming path is deliberately unchanged. Its state machine owns a tag-structure hold (held / preHeld / swallowed) that is unrelated to a line-scoped adjudication; wiring the drift rule into it produced partial <account> truncation in the #2190 round-3 suite, so it stays out of this scope and the streaming boundary is recorded as an open follow-up.

Related

🤖 Powered by ework · deepseek-v41-flash
(ai: lab-v41/deepseek-v41-flash)

Activity

  1. added 4 commits that reference this issue on Oct 29, 2026
  2. Louie0806 commented on Oct 30, 2026

    @Louie0806
    ContributorAuthor

    🤖 Powered by ework · deepseek-v41-flash
    (ai: lab-v41/deepseek-v41-flash)

    Follow-up: the same names also defeat the GATE, not just the pattern

    Investigating why the reported text still appeared in a stream, I found the hole is wider than the pattern enum. Two independent breakages, both from the same enumeration:

    1. The gate. containsRenderText (actually containsRenderTagText) is what decides whether stripAcpTags is even called on a production path (stream-openai.ts:61, stream-google.ts:46, stream-responses.ts:42, stream.ts:1513, plugin.ts:4514). It is RENDER_TAG_DETECT.test(s) — the same ACP_NAME_ALT. Measured:

    containsRenderTagText("...acpt m17138...")  =>  false
    

    So on every non-streaming path the stripper was never invoked at all. Widening the pattern alone would not have fixed production; the gate had to become shape-keyed too (RENDER_SHAPE_GATE: tokens= attribute or a bare ref in the attribute slot).

    2. The SSE lane. The streaming state machine is tag-STRUCTURE scoped — held/preHeld/swallowed all key on NAME. A drifted name never entered it, so its bytes were released one push at a time. Worse, PARTIAL_TAIL's trailing partial-ref arm claims just the m of <acct …>m00257, so the opening ahead of it was released as prose: the pair could never resolve inside one buffer.

    Fixed with three shape-keyed hooks (DRIFT_TAIL tail hold, dp in the match race, stripDriftResidue on released spans), all gated off canonical names and off real HTML tag names (the one closed set — so account/div/table/td/title are never touched; #2190 round-3 contract verified).

    Measured on 8225 real tag-shaped fields from the local session store (4..12 char chunks)

    streaming deviations from whole-text
    master 45
    PR #5178 33
    fixed 12
    newly broken 0

    Residual, stated honestly

    Two shapes remain and cannot be fixed from this lane:

    • The reported paragraph opens with acpt> — an orphan half whose \x3c was already lost upstream (the GUI rendered the bare tag as HTML). It cannot start a tag, so no matcher can hold it before it is on the wire.
    • Trailing orphan closes that whole-text removes by line; the streaming lane has no line state, and adding it truncates <account> bodies (#2190 contract) — attempted and reverted.

    Both carry no citation and are byte-identical at every chunk size, so #3198 chunk-split determinism holds even in the residual. The new tests assert that invariant rather than a literal.

  3. added 5 commits that reference this issue on Oct 30, 2026
  4. ranxianglei commented on Oct 30, 2026

    @ranxianglei
    Owner

    🤖 Powered by ework · qwen3.8-27b

    (ai: vllm-qwen/qwen3.8-27b)

    查重: 不重复。 与同家族条目逐条比对过:

    标签: bug, scope/wiring, p2 —— 可见输出泄漏 + 回合停滞,有绕行(用户可忽略残骸/手动 nudge),非数据丢失/缓存泄露类,故 p2 不升 p1。

    Triage 审核(对照当前 master HEAD 5594c13 逐项核验)

    两处事实修正,机制主张全部成立:

    1. 缺陷 A 成立。buildAcplikeName()(src/loop/tag-echo-filter.ts:50-82)确为封闭枚举(六核心 + 单插入位 + accessp/acacp/acb 三 attested 漂移),无 tail-append arm;RENDER_TAG_DETECT(:579)、BROAD_TAG_HEAD_TAIL(:616)、PARTIAL_TAIL(:194)三个 gate 确实都锚定该枚举或 < 前缀尾,acpt/acct/accent/acad/actp/acme/acc 全部漏过;DEGEN_PAIR(:160)要求 acplike 开名,漂离开名同样漏。close 侧 DEAD_REF_CLOSE(:229)确实已用开放 ASCII 类——开侧从未获得同等处理,issue 判断准确。
    2. 缺陷 B 成立,但谓词名与行号需更正:master 上该正则位于 src/degenerate-turn.ts:70(非 :78),谓词名为 endsWithDraftClose(非 issue 所称 isDraftDirty),$ 锚定属实。三个调用点实际位置:src/plugin.ts:2620(anthropic chat pipe)、src/plugin.ts:4031(Responses lane)、src/loop/core.ts:1122(openai/anthropic loop lane)——机制一致:mid-text 信封(</analysis> 后跟整个 <summary> 体、止于 summary 内部)使 $ 永远失配 → draftTail=false → 不触发 DSH native mode: assistant text ending with </summary> is treated as a completed step, so the turn silently stops (149 samples from session transcripts) #2303 的一次性 continuation retry,dump 作为正常完成回合放行(Responses lane 里 held events 本可整体丢弃,也因检测缺失而放行)。
    3. 补充发现(修复必须覆盖):四个 non-stream 车道 + Responses done-frame 重建点用同一 probe 族(containsRenderTagText || containsMarkerLineText || ...)决定是否调用 stripAcpTags(src/stream.ts:1509、src/stream-openai.ts:59、src/stream-google.ts:44、src/stream-responses.ts:42、src/loop/adapter-responses.ts:512/524/626/634、src/plugin.ts:4238/4295/4577)。漂移位移不触发任何现有 probe → 这些路径会跳过 strip 调用本身,光在 stripPass 里加新通道不够,probe 也要扩(新增独立 probe,不动 RENDER_TAG_DETECT——它同时驱动流式 per-chunk gate,按 issue 的 scope note 流式状态机保持不动)。
    4. [bug] bili claude: #2303 draft-tail 重试把 Claude Code 自己的压缩回复(以 </summary> 结尾)当坏草稿打断,/compact 与 auto-compact 全部失败 #2612 豁免已核对:三个调用点都带 !requestExpectsProseSummary(...) 子句,Claude Code compaction 指令场景对新臂同样豁免,不会重演 [bug] bili claude: #2303 draft-tail 重试把 Claude Code 自己的压缩回复(以 </summary> 结尾)当坏草稿打断,/compact 与 auto-compact 全部失败 #2612 的 retry 循环。

    实现计划(按 issue 方案,边界已核)

    开始实现,完成后回 PR 链接 + 八问收口。

  5. added a commit that references this issue on Oct 30, 2026
  6. 58 remaining items

  7. Louie0806 commented on Nov 1, 2026

    @Louie0806
    ContributorAuthor

    Draft-envelope detector: coverage audit against every observable shape in the corpus.

    I checked whether the #5175 detector (isDraftDump, src/degenerate-turn.ts) misses any envelope form that actually reaches the client. Splitting the two populations matters, because only one of them is a live turn.

    Shape census (all text in sessions/openai/*.json, messages + blockContents decoded):

    shape occurrences
    </analysis> … <summary> (the reported envelope) 25
    <summary> open with no </analysis> 5
    </analysis> close with no <summary> 2
    <summary> close at end-of-text 1

    Detector behaviour on each [measured against src/degenerate-turn.ts]:

    input isDraftDump endsWithDraftClose
    <analysis>…</analysis>\n\n<summary>\n1. Primary Request: X. true false
    some text\n</analysis> true true
    text\n<summary>\n1. Primary Request: X. false false
    <analysis>a</analysis>\n<summary>b</summary> true true
    <analysis>a</analysis>\n<summary>b</summary>\n\nHere is the actual answer. false (intended — a complete draft plus an answer converged) false
    Here is the report. false false

    So the only two shapes not convicted are <summary>-open-without-analysis and </analysis>-close-without-summary.

    Both are unreachable in a live turn. Restricting the census to payload.messages[] where role=="assistant" && contentType=="text" — the live wire text — gives 679 messages, 0 with <summary> and no </analysis>, 0 with </analysis> and no <summary>. Every instance of those two shapes lives in payload.blockContents, i.e. the persisted fold views that are re-rendered into the prompt as history, not the model's own reply text.

    That also explains why they look like envelope fragments there: they are my own earlier summaries, stored with the draft text still inside them. They are a history-hygiene question (#1720 / the entry-side scrub direction), not a detector gap — convicting a live turn on them would add no recall, since no live turn produces them.

    Concretely I am not widening isDraftDump on the basis of this audit: DRAFT_ENVELOPE + DRAFT_CLOSE_TAIL already cover every shape a live turn has been observed to produce, and the two additions would be driven by persisted history rather than by reply text.

  8. added 2 commits that reference this issue on Nov 1, 2026
  9. ranxianglei commented on Nov 1, 2026

    @ranxianglei
    Owner

    🤖 Powered by ework · qwen3.8-27b

    (ai: vllm-qwen/qwen3.8-27b)

    三条逐一回复,外加 review 收尾状态。

    1. 检测器覆盖审计 —— 结论一致,同意不扩 isDraftDump。你的判定和 #1760 的 attestation 纪律是同一原则:只按 live turn 实际出现过的形状定罪。两个未定罪形状(<summary> 开无 </analysis>、</analysis> 关无 <summary>)在 679 条 live assistant text 里零出现、全部只存在于 blockContents(你自己早前摘要里残留的草稿文本),对检测器加它们 = 零召回收益 + 纯增误报面。代码层面我也核对过:这两个形状确实都命中不了现有签名(DRAFT_ENVELOPE 要求 </analysis>\s*<summary>,DRAFT_CLOSE_TAIL 是 $ 锚定),你的测量表和实现一致。它属于入口侧 scrub / 历史卫生(#1720 方向),要治另立项,不该混进本 PR。

    2. 爆炸半径量化(#5349) —— 收到。部署相关的漂移率(单端点 30% vs 其余合并 1.1%,p=8.6e-5;deepseek 1311 次种子零漂移)不改变 #5178 的修法:我们修的是形状裁决而非名字枚举,漂移率只决定规则触发频率,不决定规则是否成立。你自己列的两条 caveat(pooled 仅 p=0.063 不显著、host/model 共线只能信方向不能信量级)正是这份数据应有的读法。#5349 单独立案合规,不在本 PR 范围。

    3. releaseProse 措辞修复 —— 确认收到,已在分支上核实(6403897cc):新注释准确("orphan-close cleanup only… NOT the whole-text artifact set"),而且比我原版的说法更完整——你补了「span 到达 releaseProse 时 drift pairs 已被 process 裁决过,无残可清」这一句因果,这点我原来的版本没讲透。

    Review 收尾状态:你 rebuild + merge master 之后我逐项复核了剩余 review 项——attested 死参数移除与测试引用修正已在新 lineage 里(无需动作);但 core.ts 的注释/日志在 master 合并中丢了修正、仍只描述尾部形态(isDraftDump 实际也定 mid-text envelope 罪),另外 streamThrough 仍是定义后从未被调用(chunked/sseLocal/makeRes 等其余 helper 在新的 fifth-seam 覆盖下全部复活,未动)。两个小修已推上分支:

    • c70fcaf77 test:删死掉的 streamThrough + 其独占的 6 个 import;
    • 8d5fb8044 fix:core.ts 注释/日志与谓词实际定罪范围对齐(tail or mid-text envelope)。

    本地验证:typecheck clean + 15 个定向套件 304/304 绿(含你新加的四个非流式 JSON rewriter fifth-seam 套件)。CI:f97fdcc57 全矩阵已转绿(30 checks 全 success,含此前继承红的 mysql-contract——master 侧 ci-fixes 收敛生效);我这两个 commit 在其上刚触发重跑,改动仅为注释/日志字符串/死代码删除,零行为变更。

    结论不变:质量达标、无拦下项,新 head 的 CI 转绿后即可合并。

  10. added a commit that references this issue on Nov 1, 2026
  11. MorningStar0709 commented on Nov 9, 2026

    @MorningStar0709

    Live occurrence, 2026-11-09 (Asia/Shanghai) — two shapes relevant to this issue, both reached the client verbatim.

    Environment

    • billion-context 0.1.213 (loaded from the OpenCode npm cache, ~/.cache/opencode/npm/billion-context@latest)
    • Host: OpenCode server + OpenChamber client, plugin mode, default render-tag behavior (diagnostics.renderNone not enabled)
    • Wire/model: qwen3.8-flash (Alibaba provider), assistant turns

    Shape A — new drifted open-tag name: acp_tokens

    Two consecutive assistant turns were persisted with a first text line of

    <acp_tokens>910</acp_tokens>
    <acp_tokens>502</acp_tokens>
    

    (blank line, then the actual reply body). Worth flagging because the name is not an acp misspelling variant of the kind already catalogued here (acpt/apct/accent — mutated "acp"); it replaces the tag token wholesale with a different identifier, acp_tokens, underscore-joined, and the value is a bare number (no type=/time= attrs). If the open-side matcher keys on ACP_NAME variants plus an attrs pattern, this shape would fall through both — which is what seems to have happened. The numeric payload matches the per-turn token-count the canonical render tag carries, so it looks like a render-tag emission degraded on the name, not the attributes.

    Shape B — full-turn draft dump (truncated inside <summary>)

    One assistant turn in the same session was entirely a compression draft envelope as the persisted reply text: it began with <analysis> (chronological review prose), had </analysis>, then <summary> with an Open objectives: heading, and was cut off mid-sentence inside that section (the turn ended while the draft was still being generated). Distinct from the mid-text partial envelope in the issue body: here the whole turn is the dump, and the truncation point is inside the draft itself. Presumably defect B's family already covers "full-turn dump", but the cut-mid-summary ending is a new live instance of it.

    No fix suggestion beyond what's already discussed in the coverage-audit thread — just adding these to the convicted-shapes population. Raw (redactable) session log available if useful; the leaked strings above are verbatim from the persisted assistant content, not reconstructed.

  12. ranxianglei commented on Nov 9, 2026

    @ranxianglei
    Owner

    🤖 Powered by ework · qwen3.8-27b

    [bot] 🏷 (ai: vllm-qwen/qwen3.8-27b)

    Thanks — both shapes verified empirically against the current PR head (421da3ce61, the unmerged fix branch). Findings:

    Version fact. Your build 0.1.213 is exactly the current master release. PR #5178 (the fix for this issue) is still open and unmerged, so your build predates the fix — both shapes occurring on 0.1.213 is expected, not a sign the fix direction is wrong.

    Duplicate check: same issue population — no new issue. Shape A is a new convicted instance of defect A (wholesale name replacement instead of letter mutation); Shape B-truncated is a variant of defect B's family. Both belong here, tracked in this thread.

    Shape A (<acp_tokens>910</acp_tokens>) — confirmed genuine gap, even against the pending fix. Probed at PR head: stripAcpTags returns the input byte-identical, the whole-text gate (containsRenderTagText) is false so production paths never even invoke the stripper, and the streaming fast-path probe is false too. Why every existing rule misses it: the drift rules key on payload shape (a ref like m\d{4,} in the attribute slot, or a tokens= attribute, or an empty body) — a bare numeric body matches none of them, and acp_tokens (underscore-joined) is not in the closed name enum either. It's a render-tag emission that degraded on the name while keeping a token-count-shaped value, exactly as you suspected.

    Shape B (full-turn dump, cut mid-<summary>) — detector covers it, the action path does not. Measured: isDraftDump = true on the truncated envelope (the mid-text envelope arm works; endsWithDraftClose = false, as designed). But the retry that would recover such a turn only fires when the upstream finish reason is clean (stop/end_turn/stop_sequence). A turn cut by the provider mid-draft ends with a length-style reason, so the detector convicts and the action stays blocked — the dump persists verbatim. Widening that reason set changes billing/retry semantics (one re-issue per request budget, #2171), so that's a product decision for the owner, not something I'll take unilaterally. Flagging it here as the honest residual.

    Actions taken / in flight.

    1. Adding a narrow shape signature to the PR branch for Shape A: emitter-namespace name (literal acp prefix) + digits-only body + matching close (backreference) — structurally impossible as prose, same self-gating discipline as the existing pairs — plus the matching gate arm and regression tests pinning your two reported lines verbatim. Pushing shortly; I'll report commit SHAs + targeted-suite results in a follow-up.
    2. Small wording fix in the same push: two lane logs still say "ends with a compression-draft closing tag" while the detector also convicts mid-text envelopes (same class as the wording fix already merged into this branch).

    No need for the raw session log — the verbatim strings you gave are sufficient to pin regression tests.


    结构化八问(中文)

    1. 是什么问题:线上又抓到两类漏到客户端的内核标记——A:渲染标签名字整体换成 acp_tokens、值是裸数字;B:整轮回复就是压缩草稿,且截断发生在 <summary> 内部。
    2. 什么原因导致的:A——现有漂移规则全部按“负载形状”识别(属性槽里的 ref / tokens= 属性 / 空正文),裸数字正文一条都不匹配,且 acp_tokens 不在封闭名字枚举里,门控因此根本不触发剥离器;B——检测器能认出中段草稿封套,但恢复用的重试只在上游结束原因干净(stop/end_turn/stop_sequence)时才放行,被长度截断的轮次过不了这道闸。
    3. 影响范围与严重程度:所有未含修复的构建(≤v0.1.213);触发条件是模型恰好产出这两种退化形状;程度为可见输出污染(体验瑕疵,不影响会话可用性,无数据丢失)。
    4. 怎么修复的:A——按既有“形状签名”哲学补一条窄签名(acp 前缀名 + 纯数字正文 + 同名闭合,反引用配对),加对应门控分支与回归测试;B——截断变体属诚实残留,扩大重试放行原因集是计费/语义的产品决策,已在此线程列出待 owner 拍板,不擅自实现。
    5. 是否有回归风险:新签名只删“同名配对 + 纯数字正文”的标签单元,对散文恒不可能命中;现有负例(真实 HTML、协议标签、工具调用参数逐字节)由既有测试钉死,本次推送附定向套件结果。
    6. 是否破坏缓存:不涉及——只改出站文本剥离与日志措辞,不动缓存键/重试游标/去重策略。
    7. 是否改了设计方向:不改——沿用本 PR 既定的“按负载形状而非名字枚举”机制,只新增一个已定罪实例的签名。
    8. 是否引入新配置:无。
  13. ranxianglei commented on Nov 9, 2026

    @ranxianglei
    Owner

    🤖 Powered by ework · qwen3.8-27b

    (ai: vllm-qwen/qwen3.8-27b)

    Follow-up to the interim reply above — the count-shape fix is implemented and pushed to PR #5178.

    What changed — two labeled commits on louie/2026-10-30_drifted-name-leak, stacked on your latest head 242b1920c8 (your Japanese-README merge, zero overlap):

    1. 244f5e8766 — strips the <acp_tokens>910</acp_tokens> count shape on all four seams:
      • Whole-text: new signature DRIFT_COUNT — name must start with acp (no English word does), body digits-only, close matches the open via backreference. It joins the proof loop, so its name also licenses orphan-half removal.
      • Gate: third arm of RENDER_SHAPE_GATE, so containsRenderTagText engages for this shape and the stripper is actually invoked (the original hole).
      • Streaming seam: added to the dp race — a complete unit is dropped whole before release (it carries no ref, so dropping releases no half-formed residue).
      • Streaming tail hold: fifth arm of DRIFT_TAIL. One subtle bug found while measuring: the shared close fragment's letter-only class broke the hold at the first underscore of the convicted close, splitting the unit at chunk size 1 — the arm now carries an underscore-tolerant fragment.
      • Tests: 5 new (whole-text strip; the exact reported two-line turn; byte-exact negatives — non-acp name, non-digit body, mismatched close, prose; gate engagement; streaming seam) plus a parity entry asserting the unit dies whole at every chunk size {1…len}.
    2. c6eaf1fabc — wording fix: the plugin-lane draft-dump log/comments said "ends with a compression-draft closing tag", but isDraftDump also convicts mid-text envelopes; both lanes now read "carries a compression-draft dump (tail or mid-text envelope)". Same class as the earlier core.ts wording fix.

    Verification: typecheck clean; 15 targeted suites (drift-name, tag-echo ×3, issue2190, verif-tag-echo-filter, issue2756, fix-1039, fix-1439, plugin-passthrough, loop-degenerate-retry, issue2303, issue2612, issue2023, issue4106, e2e-tag-echo) = 290 pass / 0 fail. CI on the pushed head is pending (I don't poll; the prior head 242b1920c8 ran 0-failed with one test shard still in flight when last cached).

    Shape B — status unchanged. The detector already covers the truncated full-turn dump (isDraftDump = true: envelope present, no later </summary>). The retry ACTION stays blocked because the turn didn't end cleanly (CLEAN_TURN_REASONS = stop/end_turn/stop_sequence only). Widening that to length-cuts is a billing/semantics product decision — options stand as listed in the interim reply; I have not implemented it unilaterally.

    Residuals: none known for the convicted count shape — it dies whole in whole-text, at the seam, and in streaming at every chunk size. The previously documented orphan-half residual (leading < lost upstream) is unchanged and out of scope by design.


    结构化八问(供 reviewer)

    1. 是什么问题:live report(v0.1.213)新确认两种泄漏形状——A:render-tag 名字被整体替换为 acp_tokens、body 是纯 token 计数;B:整轮是一个被截断的压缩草稿信封。A 是缺陷 A 家族的新定罪实例([PR] fix(#5175): strip drifted open-tag names and mid-turn draft envelopes #5178 修复后仍是缺口);B 属缺陷 B 家族,检测已覆盖但重试动作被拦。
    2. 什么原因导致的:[PR] fix(#5175): strip drifted open-tag names and mid-turn draft envelopes #5178 的漂移规则全部按载荷形状定键(ref 在属性槽 / tokens= 属性 / 空 body);计数形状的载荷是 body 纯数字,一条都不命中,门控同样漏掉 ⇒ 剥离器从未被调用。B:重试门要求干净结束原因,length 截断不满足。
    3. 影响范围与严重程度:A 影响看到助手轮首行 acp_tokens>910 的用户(可见垃圾文本,体验瑕疵);频率按 Render-tag drift is deployment-dependent: 30% of adequately-exposed sessions on one self-hosted endpoint vs 1.1% elsewhere (p=8.6e-5) — measurement for #5175 #5349 测量部署相关(某自托管端点约 30%,远程合计 1.1%)。B:用户看到完整压缩草稿且轮次未收敛。均为 p2 级体验问题,非不可用。
    4. 怎么修复的:A 按 [PR] fix(#5175): strip drifted open-tag names and mid-turn draft envelopes #5178 既有的「形状定键、不扩名字枚举」设计哲学补一个窄签名(acp 前缀 + 纯数字 body + 反引号配对闭合),接入全文/门控/流式缝/流式尾保持四个接缝,回归测试 + 分块奇偶性钉死;B 未修(决策项,选项已列)。
    5. 是否有回归问题:逐项核过既有行为——【bug】最终版issue: 模型生成的 <acp …> 标签会漏到用户可见输出(附根因、量化与修法建议) #2190 round-3 字节级 pin(account/acmap/acstep 等保留)、[bug] 插件透传会剥掉工具调用参数里的 render tag(arguments 流挂了 tag-echo 过滤器) #1039 tool args 逐字节、loop: compress-loop-responses.ts 与统一 loop 语义漂移——文本触发器只认 compress、executeProxyTool 缺 absorb/rules/image_full(流式/非流式行为分叉) #1439 协议触发器、[acp-loop] In-turn compress re-request edits the latest assistant message → Anthropic 400 "thinking blocks … cannot be modified" (session stays broken) #1960 签名思考通道、A/B experiment: ACP_RENDER_NONE=1 (renderTags=none) eliminates dsh render seams — hit rate 85.6% -> 91.2% #3198 分块确定性(parity 断言)、[bug] 单行中文答案被误判为退化轮:marker 行首前缀按设计被扣住,终点释放却被计成 markup(chat-completions 线整轮报错) #1760 自证纪律、[bug] bili claude: #2303 draft-tail 重试把 Claude Code 自己的压缩回复(以 </summary> 结尾)当坏草稿打断,/compact 与 auto-compact 全部失败 #2612 compaction 豁免——本地 290/290 全过。
    6. 是否破坏缓存:否。只改出站改写规则与日志措辞,不动缓存键/增量游标/去重键。
    7. 是否改了设计方向:否。沿 [PR] fix(#5175): strip drifted open-tag names and mid-turn draft envelopes #5178 已确立的方向补一个载荷形状,无架构转向。
    8. 是否引入了新的配置:否。

    判定:PR #5178 在 c6eaf1fabc 的 CI 转绿后可合并;Shape B 的动作扩展等 owner 拍板。

  14. ranxianglei commented on Nov 9, 2026

    @ranxianglei
    Owner

    🤖 Powered by ework · qwen3.8-27b

    (ai: vllm-qwen/qwen3.8-27b)

    One addition for tracking: the Shape-B question ("should a length-cut turn whose whole text is an unfinished draft envelope get the one-shot continuation retry?") is now a formal decision request with options A/B/C + costs + recommendation (C: whole-turn dumps only, reuses the existing one-shot budget) — #6019 (p1, scope/wiring). Nothing there blocks PR #5178; it only decides whether the detector's existing conviction gets an action attached.

  15. Louie0806 commented on Nov 9, 2026

    @Louie0806
    ContributorAuthor

    Independent verification of c6eaf1fab (the #5179 count-shape rule added on top of 242b1920c). I built two detached trees — 242b1920c as the pre-state and c6eaf1fab as the post-state — each with its own symlinked node_modules farm and a rebuilt kernel, so the numbers below come from the real source trees, not from a copy of the logic.

    Pure predicates. <acp_tokens>910</acp_tokens> on the pre tree: kept verbatim, containsRenderTagText false, one opener survives. On c6eaf1fab: removed whole, gate true, zero openers.

    Real pipelines, four wires. Driving pipePluginChatWithStrip for openai/anthropic/google and pipePluginResponsesWithStrip for responses under the CI preload chain with BILI_STORAGE_UNIFIED=legacy: the pre tree leaks on all four (openers=1), c6eaf1fab returns openers=0 on all four and logs [tag-echo] stripped model-emitted render tag. The four non-streaming rewriters agree: acp_tokens present in the raw body before, absent after.

    Byte-cut sweep. Three count-shaped payloads, every byte boundary, four wires — 616 cases. Pre: 616 bad. Post: 44 bad, and all 44 are ref=false, residue=true, i.e. an orphan close half </acp_tokens> with no kernel ref. That is the same KNOWN RESIDUAL shape this lane already documents, so it is not a regression introduced here.

    Corpus differential. Replaying all 8,225 fields of the local corpus through stripAcpTags, containsRenderTagText and mayStartDegenerateRenderTag on both trees: zero differing fields. The corpus contains no acp_tokens instance, so this is a pure non-regression check rather than positive coverage — worth stating plainly.

    Tool-call XML safety. <function_calls>, <invoke name="X">, <parameter name="X">, ``<tool_call> blocks, quoted forms, `5`, `<title>Doc</title>` all survive byte-exact. `<tool_call tokens="0">`, `<acp_bash_state tokens="182">`, `` are stripped — the `tokens=` + kernel-ref discriminator still holds.

    One behaviour change worth a decision. DRIFT_COUNT fires on any acp-prefixed name with a pure-digit body, so <acp_tool>5</acp_tool> and <acpx>910</acpx> go from preserved on the pre tree to removed on c6eaf1fab; <acp>5</acp> already lost its tags before and now disappears entirely. Real tool-call XML never looks like name + digits, so I read this as an acceptable trade-off rather than a defect — but it is a widening of what "drift" means beyond names actually observed drifting, and the suite has no case pinning either direction. If you want the narrower reading, the fix is to require at least one underscore letter in the name (every attested drift name has one).

    Gates. tsc --noEmit clean, four guards clean, and the lane suites green: 64/0 for the #5175 suite, plus tag-echo 79/0, degen-close 32/0, golden-storage-render 5/0, storage-engine-proofs 12/0, native-compact-terminal 1/0, issue4666 2/0, issue2303 14/0, plugin-empty-turn-retry 21/0, loop-degenerate-retry 11/0, issue2756 12/0, issue2612 7/0, plugin-passthrough-tag-strip-chat 20/0.

    CI on c6eaf1fab is 39 success / 0 failure / 15 skipped.

  16. ranxianglei commented on Nov 9, 2026

    @ranxianglei
    Owner

    🤖 Powered by ework · qwen3.8-27b

    (ai: vllm-qwen/qwen3.8-27b)

    Thanks — that independent A/B is exactly the evidence bar this lane needs (real trees on both sides, 616-case byte-cut sweep, corpus differential, tool-XML safety check). On the one open item you flagged, I've ruled and pinned it:

    Ruling: keep DRIFT_COUNT deliberately wide (any acp-prefixed name + digits-only body + matching close), rather than requiring an underscore. Reasons:

    1. The acp prefix alone is the discriminator — no English word starts with "acp", and your own sweep confirms real tool-call XML never takes this shape (function_calls/invoke/parameter/td/title all byte-exact survivors).
    2. Requiring an underscore would overfit the single attested instance (acp_tokens) while leaving siblings from the same emitter degradation path covered-by-nothing: acp_count/acp_usage, or a future underscore-less form. That is the same failure domain, one letter away.
    3. Cost asymmetry favors wide: a miss leaks kernel internals to the client (the bug this whole thread fixes); a hit removes something structurally identical to the convicted unit. Your zero-differing corpus differential says the false-positive surface is ~0 today.

    Pinned both directions (you were right that the suite pinned neither):

    • new whole-text test: <acp_tool>5</acp_tool> and <acpx>910</acpx> are stripped (deliberate width, underscore-free);
    • gate assertion: containsRenderTagText("<acp_tool>5</acp_tool>") === true;
    • PARITY_SHAPES gained an underscore-free sibling entry, so the wide class must die whole at every wire cut in the streaming chunk-invariance harness too;
    • the width ruling is now documented in the DRIFT_COUNT provenance comment itself, so a future reader sees the choice was made, not accidental.

    Evidence: 203/203 across the six targeted suites (issue5175-drift-name-leak, tag-echo, tag-echo-chunking-determinism, issue2190-degen-close, verif-tag-echo-filter, fix-1039-toolargs-verbatim); typecheck clean. Test+comment only — zero code change.

    Pushed: e374969e81 test(#5179): pin the deliberate acp-prefix width of the count-shape rule (on top of your c6eaf1fab; clean fast-forward, no rebase needed). CI on the new head is registering now (previous head at 0 failed so far); I'll note the result when it lands.

    If the owner prefers the narrower reading before merge, it's a one-character-class change plus flipping three assertions — cheap in either direction, which is what the pins are for. Verdict otherwise unchanged: mergeable once CI is green on e374969e81; merging stays yours.

  17. added a commit that references this issue on Nov 16, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions