Repository navigation
fix: retry terminal turns ending in a compression-draft closing tag (#2303) - #2304
Conversation
📦 Built Package ArtifactBranch: Option A — Install this exact build (recommended)npm install -g billion-context@0.0.2436-pr.2304.4bd0e5eThis exact version is immutable and reproducible. The rolling Option B — Download artifact
tar xzf billion-context-pr2304.tgz
npm install -g packageInstall instructions are refreshed on each push. |
…2303) A terminal turn whose last visible text ends with a fully-closed </summary> or </analysis> draft tag and carries no tool call is now treated as non-converged instead of completed: each of the three auto-retry lanes (plugin chat pipe, plugin responses pipe, proxy compress loop) spends its existing one-shot degenerate budget on a continuation-nudge re-issue, after which the turn passes through exactly as before (a second draft-tail still hits the #870 in-band error path in the plugin pipes). DEGENERATE_RETRY_NUDGE wording is generalized from 'no visible text and no tool call' to 'without a tool call' so it stays accurate for both shapes.
a4fa488 to
8b7e8f9
Compare
…ate) Labeled in-passing fix found while reviewing #2303: the new unused-exports gate (master-only, post-#1443) flags src/launcher.ts codexRewriteInsertionIndex as INTERNAL_ONLY on current master itself, which kept every rebased PR red. All references are file-local (call site + doc comment); dropping the export keyword is behavior-neutral.
[bot] 🏷 PR #2304 review 完成 —— 可合并(最终 head
结构化七问
测试有效性:新套件 402 行 / 12 例,断言有牙——正例钉住「恰好一次重发 + 单一终局帧 + id 一致性 + 草稿原文到达客户端且不被本 fix 剥离」;负例覆盖正常完成 / 截断形态 / 与工具调用共存 / length cut;另有 one-shot 上限与 #870 双重退化路径。本地定向验证:44/44 通过(新套件 + plugin-empty-turn-retry + loop-degenerate-retry + cache-proof),typecheck 干净,unused-export gate 干净。 两个残余边界(非拦阻项,如实记录):
结论:方向正确(修在判据层而非出口层剥离,与 issue 定位一致)、回归审查通过、最新 master 上全量 CI 26/26 绿(含 windows 22/24 与 dsh/opencode/pi/codex 各真实 lane)。满足合入条件——跨多模块且含 model-facing 措辞变更,不走 auto-merge 通道,请人工合并:#2304 |
📦 Merged Build PublishedThis merge to master was published as npm install -g billion-context@0.0.105-master.a2d2895 # this exact build
npm install -g billion-context@master # always the newest merged build
|
Closes #2303
What this fixes
A terminal turn whose last visible text block ends with a fully-closed compression-draft closing tag (
</summary>/</analysis>) and carries no tool call was judged "completed" by every host-side convergence check, so the conversation stopped silently (149 production samples / 70 sessions in #2303; DSH native plugin mode over an OpenAI-compatible upstream). Upstream truncation dropped the step's final tool call, leaving "visible text + no trailing tool call" — a shape the existing zero-tool-ending fallbacks structurally cannot catch (#2248 floor-11 analysis of the retryEmptyTurn predicate chain).Mechanism
One shared detector + one bypass per lane, reusing the EXISTING one-shot continuation budgets — no new state machine, no new config/env:
src/degenerate-turn.ts:endsWithDraftClose(text)— narrow matcher for exactly the two observed fully-closed forms, case-insensitive (tag-echo 过滤器漏掉大写<ACP …>与超长属性形态——渲染标签原样到达客户端 #1731 case-drift precedent), trailing whitespace tolerated. Truncated forms (</summa) are deliberately out of scope: zero production samples; that class belongs to tag-echo filter leaks bare<ac/<ac>render-tag fragments to the client (bare truncated open tag survives both process() and flush()) #1755/【bug】最终版issue: 模型生成的<acp …>标签会漏到用户可见输出(附根因、量化与修法建议) #2190.pipePluginChatWithStrip.retryEmptyTurn, src/plugin.ts):draftTail = visibleTextChars > 0 && !sawToolUse && endsWithDraftClose(proseAcc)bypasses gate A (visible-text suppression) and gate E (genuinely-bare exemption); distinct log line citing 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. A second draft-tail still lands in the existing Plugin passthrough leaves the client an empty turn when the model echoes a render tag #870 in-band error path.pipePluginResponsesWithStrip.retryEmptyTurn): same predicate overproseAcc(verified to cover fast-path deltas, filtered deltas, reasoning summaries, and done-family event text); bypasses gates A'/E'.break, mirroring the 启动横幅硬编码 raw-HTTP-capture(on) 而真开关是 ACP_DUMP_BODY(默认关):日志永远撒谎,取证被带偏过 #413-follow-up append semantics (nudge appended after prior rounds' messages; the current attempt's draft is not replayed — the model re-derives the pending action from context + nudge, same as the [BUG] In some cases, with Codex's auto model + DeepSeek, it will suddenly terminate automatically. #732 twin); reuses the per-requestdegenerateRetriedbudget.Behavior change (disclosed)
DEGENERATE_RETRY_NUDGEwording generalizes:Reason: the old sentence is factually wrong for the draft-tail shape (there WAS visible text), and the single shared constant must stay accurate for both shapes. The nudge is ephemeral — never persisted, never replayed; byte-stability of all normal turns is unaffected (cache-proof suite green, incl. the degenerate-refetch tail-append proof).
Deliberately NOT done here
</summary>/</analysis>from prose: 'summary'/'analysis' are legitimate words in user-facing text; a shape-based strip would corrupt user intent ([bug] 插件透传会剥掉工具调用参数里的 render tag(arguments 流挂了 tag-echo 过滤器) #1039 discipline). Exit-layer handling stays [bug] 出口层缺口:文本不在受管字段的帧绕过 tag-echo 状态机(E1/E5 原始转发出口 + 零日志真泄漏样本) #2248/[meta] ACP 标签泄漏综合治理:#2023/#2066/#2190 三切面统筹(修复 #2025/#2067/#2211) #2229 territory (owner-pending content-anchor decision).turnTerminalat all (pre-existing boundary, unchanged).Evidence
tests/issue2303-draft-tail.test.ts(14 tests): detector unit cases; chat openai/anthropic positives (draft split across deltas, retry lands in-stream, exactly one terminal frame); negatives (normal ending, truncated form, tool-call present, finish_reason=length stays on the truncation path); double draft-tail → Plugin passthrough leaves the client an empty turn when the model echoes a render tag #870 in-band error; responses positive + function-call negative; loop-lane positive / one-shot bound / negatives asserting nudge-in-body and client-visible ordering.ci-e2e.ymlauto-triggers onsrc/loop/**(this PR touches src/loop/core.ts); the local sandbox has no live upstream for ACP_TEST_E2E=1.