Repository navigation
[PR] fix: count real prose around a pure refs-only echo as the answer (#6034) - #7632
Conversation
📦 Built Package ArtifactBranch: Latest build — install this exact versionnpm install -g billion-context@0.0.11773-pr.7632.7b703aaThis exact version is immutable and reproducible. The rolling Recent builds (commit → version)
Download artifact
tar xzf billion-context-pr7632.tgz
npm install -g packageInstall instructions are refreshed on each push. |
[bot] 🏷 查重:不重复。 本 PR(#6034 选项 E:锁存器误计修复)与在途的 #6993(#4913:degenerate-retry 终局可达性 + 八问
代码与测试审核
流程事项
合并判定:可合,两个前置——① owner 确认对选项 E 的授权;② CI 转绿。Case C 不阻塞(罕见 + 等同既有 #2756 限制),建议登记为已知限制。另注:PR 正文用 |
The plugin-mode degenerate-turn latch armed on ANY stripped render tag (one-shot per stream) and never checked what the drop LEFT BEHIND. The latch design premise — "a stripped tag leaves its interior pending" — only holds for the prose-wrapping close, which releases its body into the SAME call. A pure refs-only echo (the kernel emit shape: open + ref + close, no prose body) is dropped as a whole unit and leaves nothing behind, yet the latch armed anyway: the model real answer arriving in the same or a later delta then counted as markup, answerChars went to zero, the turn regenerated once (paid full re-read), the retry re-matched, and the session died with the #870 in-band error. The tag-echo filter gains a per-drop verdict callback (onDropVerdict: (leavesInterior: boolean) => void) — delivered on EVERY drop, unlike the one-shot onDrop log: - TRUE (pending interior, frame suspect) only when the dropped unit can still release real prose: the session-start open, the truncated open-body span, the prose-wrapping close — and a single-ref body terminated by a MANGLED close name (degenCloseAfterRef matches ANY short close, #2190, so that path carries both the clean echo and the unclosed-echo shape; verdict by close name: </acp> = clean echo = false, anything else = the model opened a render tag and botched the close = true, the shape plugin-empty-turn-retry pins). - FALSE for whole-unit atomic drops that release nothing: paired / self-close / lone-close units, the mangled attrs unit, the bare-open split, the refs-only close (#6034 shape), the oversized pending-ref span and the attested-content overflow drops. The degenerate gate droppedTagInFrame becomes last-write-wins over the verdicts delivered as the frame is RELEASED (push() returns, then the accounting loop reads the flag), which fixes the old one-shot ordering (a pending arm that outlived its interior, and multi-artifact frames where only the FIRST drop had a voice) while keeping every shape the retry tests pin. Model-visible text changes: none. No wire-byte change (internal accounting only). No config surface. Tests (tests/issue6034-pure-echo-latch.test.ts, both directions per #3617): - repro, red on master: single-frame real prose + complete refs-only echo in one delta → no retry, prose delivered (was: retry + #870). - repro, red on master: refs-only echo split across frames, answer in the close frame → no retry, prose delivered (was: retry + #870). - filter-level verdict sequences: clean refs-only echo [true, false] vs prose-wrapping echo [true, true] vs single-frame complete unit [false] vs mangled-close unit [true, true]. - controls, green on both sides: pure-echo turn still retries once + recovers; prose-wrapped echo still retries (#2756); the three unclosed-echo tests in plugin-empty-turn-retry stay green. - all 24 tag-echo / degenerate-turn suites (367 tests) green.
8b8f7a2 to
ed367d4
Compare
📦 Merged Build PublishedThis merge to master was published as npm install -g billion-context@0.0.1317-master.9114fb1 # this exact build
npm install -g billion-context@master # always the newest merged build
|
本地 7 天实测数据 + 空停根因研究(qwen3.8-27b @ 本地 sglang,v0.1.216)先说结论:这个空停家族在本地可复现、根因已定位。模型不是「无缘无故」停的——请求上下文里模型自己的每一条历史回复都带着 1. 本地 7 天数据(bili.log.archive,11-19 → 11-24)
2. 根因证据(RAW dump 重放实验)从空停回合的 RAW dump 里取出原始请求体,对本地 sglang 重放(base 12 次 / 去标记 12 次 / 截断历史 8 次 / 6 个不同上下文各 5 次,共 62 次):
3. 对本 PR(E 修复)的含义
复现脚本、62 次重放产物在 owner 本机目录(私有,不入库)。 |
…ranxianglei#7678 wal-reclaim-passive (walJournalSizeLimitBytes default 0, ranxianglei#7674) + ranxianglei#7617 identity-tables-consolidate + ranxianglei#7581 egress block-flow checkpoint retire + ranxianglei#7659 eg-GA docs wrapup + ranxianglei#7671 degenerate-retry + ranxianglei#7676 megaturn-bridge + ranxianglei#7677 doom-prompt-mass + ranxianglei#7632 pure-echo latch + dsh batch (ranxianglei#7161/ranxianglei#7159/ranxianglei#7158/ranxianglei#7129/ranxianglei#7127) Only manual conflict: docs/configuration{,.zh-CN}.md env table — union of intent, original line order: master's walJournalSizeLimitBytes row (default 0, ranxianglei#7674) + PR's archiveAfterDays row (with the bili storage migrate ranxianglei#5599 clause). All code (src/persist.ts, src/storage/shadow.ts, src/storage/store.ts, tests/storage-unified.test.ts) auto-merged; local typecheck clean and the targeted storage suites (storage-unified/-ccr/-state-fields/ -batched-verification) pass 38/38 on the merged tree. (ranxianglei#6773)
TL;DR (human language)
bili 会把「模型这一轮唯一可见输出被剥掉」记成一个内部标记,然后把这个标记里的下一段文字也当成标记——哪怕那段是模型真实答案。触发形状:模型完整复述了一个 refs-only 标签(它自己的账本 tag,open + 编号 + close,没有正文),真实答案紧跟在同一帧或下一帧。标记置位后答案被计入 markup,
answerChars = 0→ 判「退化回合」→ 整轮回读重试(全价重读一次)→ 重试再中 → #870 带内错误、会话死。issue #6034 的样本 2(0.1.215 真实事故)即此形状。修法:标签剥除过滤器在每次剥除时上报一个判决——「这次剥除有没有留下尚未释放的内部」。只有可能还会放出真正文的剥除(帧首开标签、截断开标签 body、包裹正文的闭合、以及单 ref body 撞上写错名字的 close——unclosed-echo 形状)置位;整单元原子丢弃、什么都没留的剥除(refs-only 干净 echo、paired/self/lone 单元、mangled attrs、裸开 split、超额丢弃)不置位。gate 的标志改为 last-write-wins,在文本被释放时读最终值。旧的 one-shot(每流只报一次、且 pending 置位能活过它的内部)的时序缺陷一并消除。
item.content[]带 reasoning 的退化轮永不重试(客户端拿到空轮) #2756/plugin pipe: degenerate-turn one-shot retry is dead on the Gemini wire — gate eligibility + per-lane answer-accounting asymmetries (checklist) #2769 控制测试恒绿。What changed
src/loop/tag-echo-filter.ts:createTagEchoFilter新增第 5 参onDropVerdict?: (leavesInterior: boolean) => void;recordDrop/drop/dropSwallowSpan每次剥除都投递判决(默认 false)。置 true 的站点:session-start open、TRUNC_OPEN body、正文包裹闭合,以及degenCloseAfterRef终结处按 close 名字判别(</acp>干净 echo = false,写错名字 = true,【bug】最终版issue: 模型生成的<acp …>标签会漏到用户可见输出(附根因、量化与修法建议) #2190 允许任意短 close 所以两形状同路)。src/plugin.ts:onTagDrop不再无条件置droppedTagInFrame;新增 per-drop verdict 回调 last-write-wins 置位。sawStrippedEcho/ warn 行为不变。tests/issue6034-pure-echo-latch.test.ts(新,10 测试):过滤器级 verdict 序列(干净 echo / 包裹正文 / 单帧完整单元 / mangled close)+ 插件级双向门(2 个修复复现 + 2 个恒绿控制)。Tests (pre-flight, local targeted)
npm run typecheck干净;npm run build干净(dist-import-annotations / dist-external OK)。test车道为准。Non-goals(留 owner 决定,#6034 选项 A–D)
Refs #6034