Skip to content

[PR] plugin chat lane: make the degenerate retry terminal reachable + compat.degenerateTurn escape hatch (#4913) - #6993

Open
ranxianglei wants to merge 9 commits into
masterfrom
fix-4913-degenerate-turn-terminal
Open

ranxianglei wants to merge 9 commits into
masterfrom
fix-4913-degenerate-turn-terminal

Conversation

@ranxianglei

@ranxianglei ranxianglei commented Nov 17, 2026 •

Copy link
Copy Markdown
Owner

What

Two commits, both for #4913 (36% retry→hard-fail rate reported on a local-model deployment):

  1. df673be02 mechanical fix — the 【bug】空轮重试门闸把 reasoning 记成可见正文 —— Responses 协议下 item.content[] 带 reasoning 的退化轮永不重试(客户端拿到空轮) #2756 bare-turn exemption sat below the fatal "degenerated again" branch, so a retry the model left genuinely bare could never pass through; and the qualifying counters (sawThinking/sawStrippedEcho/releasedMarkupChars) accumulated across the retry, so attempt 1's thinking qualified attempt 2. The bare gate now runs first, the per-attempt counters reset when the retry takes over, and the fatal log carries the qualifying signals (sawThinking/sawStrippedEcho/releasedMarkupChars/stalledTail/visibleTextChars/answerChars).
  2. 3ec1989a5 config knob — compat.degenerateTurn: "error" | "passthrough" (default "error", env BILI_DEGENERATE_TURN). "passthrough" opts the plugin chat lane into the pre-Plugin passthrough leaves the client an empty turn when the model echoes a render tag #870 terminal: the empty turn passes through as a normal completion — the same terminal the proxy lane and the responses wire already take for this condition.

Config surface (AGENTS.md §3)

Verification

158/158 across all 13 affected test files; typecheck clean; gen-config-docs generate idempotent (CI no-drift); check-coverage, lifecycle-ledger, and config-surface guards pass. Docs updated: seed yaml, env-map (en/zh/ja), hand-written compat sections (en/zh/ja), lifecycle.md §1 ledger.

ci-check and others added 6 commits November 16, 2026 20:42
The probe anchor PROXY_TOOL_AT=6 was calibrated on 2026-10-31 for #4521
(schedule {4,6,8,9}). The nudge scheduling has shifted again — nudge now
lands at {3,5,11,14}. Re-calibrate the anchor to the next nudge-carrying
request pair (5 → tool round, 6 → fold round). The fold/proxy-tool-round
mechanics under test are unchanged.

Closes: master-red on test (windows-latest, 22, 3) and (ubuntu-latest, 22, 1).
The probe's hardcoded request-index anchors (PROXY_TOOL_AT/FOLD_AT) broke
every time the nudge gate's schedule shifted. The last recalibration
(245ecb1) was measured on a direct local run (timestamps ON by default
since #4313), but CI runs the suite preload pin BILI_MESSAGE_TIMESTAMPS="0"
(timestamps OFF) — a different wire shape, a different schedule (no nudge at
index 5) — so it passed locally and failed on every CI shard.

Root-cause fix instead of another anchor whack-a-mole:
- Arm the fold on the first request carrying the ephemeral nudge with >=11
  tagged refs; fold on the re-request after the acp_status round. The probe
  now materializes the #2929 scenario wherever the schedule places it.
- Pin compress.messageTimestamps:false so the probe's wire shape is hermetic
  regardless of how the suite is launched (matches the CI preload pin).

Supersedes the 245ecb1 recalibration. Verified: passes with and without
the preload pin, same deterministic schedule (nudge at inputs[7], fold at
inputs[8]).
…ean (#4913)

Two mechanical bugs behind the 36% retry->hard-fail rate in #4913:

1. The #2756 bare-turn exemption sat BELOW the fatal 'degenerated again'
   branch, so a retry the model left genuinely bare (no thinking, no echo,
   no released markup) could never pass through — the fatal branch always
   won. The bare gate now runs FIRST: a truly bare second attempt is passed
   through as a normal completion (its log line names the situation and the
   counters); only a retry that shows a qualifying signal dies.

2. The qualifying counters (sawThinking / sawStrippedEcho /
   releasedMarkupChars / visibleTextChars / answerProse) accumulated ACROSS
   the retry re-issue, so the first attempt's content qualified the second.
   They are now reset when the retry takes over; stream-level accumulators
   (proseAcc, diag*, blocksForwarded, seenToolCalls) keep their scope.

The fatal log now carries the qualifying signals + finish reason so a
hard failure is diagnosable from the log alone.
… terminal (#4913)

New knob compat.degenerateTurn: "error" (default, #870 in-band stream
error when the degenerate-turn retry ALSO ends empty) or "passthrough"
(pre-#870: the empty turn passes through as a normal completion — the same
terminal the proxy lane and the responses wire already take). Env twin
BILI_DEGENERATE_TURN wins over the file; unknown values fall back to
"error", so existing deployments are byte-for-byte unchanged.

Config surface (AGENTS.md §3): added compat.degenerateTurn because the
existing surface had no exit from the fatal terminal at all — the proxy
lane (src/loop/core.ts falls through to plain completion) and the
responses wire already pass this condition through silently, making the
chat-pipe fatal branch the outlier. Rejected: a new top-level section
(one knob does not justify one; AGENTS.md §3.2), and plugin.*
(its only current member snapshotCapBytes is public fork-API config —
the name/substance mismatch that got #1437 rejected as #1469). Sibling of
compat.streamErrorShape by design (same env>file>default wiring, same
permissive parse style, and streamErrorShape already shapes the error
this knob can emit). No migration: default preserves current behavior.
@ranxianglei ranxianglei changed the title plugin chat lane: make the degenerate retry terminal reachable + compat.degenerateTurn escape hatch (#4913) [PR] plugin chat lane: make the degenerate retry terminal reachable + compat.degenerateTurn escape hatch (#4913) Nov 17, 2026
@github-actions

github-actions Bot commented Nov 17, 2026 •

Copy link
Copy Markdown
Contributor

📦 Built Package Artifact

Branch: fix-4913-degenerate-turn-terminal (8c2cb88)

Latest build — install this exact version

npm install -g billion-context@0.0.10564-pr.6993.a369c20

This exact version is immutable and reproducible. The rolling pr tag tracks the newest test build across all PRs.

Recent builds (commit → version)

commit version build
8c2cb88 billion-context@0.0.10564-pr.6993.a369c20 build
7b6aa99 billion-context@0.0.10547-pr.6993.87123e5 build
08c237c billion-context@0.0.10541-pr.6993.4b9e714 build
3ec1989 billion-context@0.0.10540-pr.6993.8303ac5 build

Download artifact

  1. Download the artifact from the Actions run
  2. Extract the tarball and install:
tar xzf billion-context-pr6993.tgz
npm install -g package

Install instructions are refreshed on each push.

@ranxianglei

Copy link
Copy Markdown
Owner Author

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

Review passed. I re-derived the gate ladder shape-by-shape against the diff, ran the targeted suites locally, and did three small fixes directly (listed below).

Regression audit — existing behaviors on the touched paths, item by item:

  • Pass-1 gate order — the bare gate moved from below the degenerateRetried branch to above it; on the first pass that branch is a no-op, so pass-1 outcomes are byte-identical.
  • Pass-2 (retry) outcomes, every shape re-derived — thinking-only / stripped-echo-only / released-markup-only / draft-or-announce-tail / usable-output second attempts all land on the SAME terminal as before. The ONLY changed slice: a retry attempt the model left genuinely bare (no thinking, no stripped echo, no released markup, no tail of its own) — was: fatal in-band error; now: 【bug】空轮重试门闸把 reasoning 记成可见正文 —— Responses 协议下 item.content[] 带 reasoning 的退化轮永不重试(客户端拿到空轮) #2756 pass-through as a normal empty completion. That is the intended mechanical-bug fix, and it is now disclosed old→new in the PR body (fix ① below).
  • Counter reset scope — the reset changes attribution and the per-attempt tail computation only; for every non-bare pass-2 shape the gate outcome is unchanged (the tail is computed from the accumulated string's END, so a non-tail second attempt already un-arms stalledTail in the old code too).
  • [dsh] Retry-exhausted degenerate turn is serialized as successful completion (0.1.213) #5958 error shape — untouched; the fatal path still passes streamErrorShape through.
  • Responses wire + proxy lane — untouched; both verified to have no fatal branch for this condition (responses retryEmptyTurn returns false on degenerateRetried; the proxy loop falls through to plain completion).
  • Truncation-retry budget sharing (retryZeroByteCut/retryReasoningOnlyCut) — untouched.
  • Existing test pins — the two pins that used a truly-bare second attempt were re-pinned to the production (thinking-only) shape, documented in the test comments; the 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 draft-tail+draft-tail fatal pin still passes (a second draft tail is not bare). Local on the PR head: 90/90 across the 7 degenerate/draft-tail/cache-proof suites; after the master sync below: typecheck clean + 53/53 on the three core files.

Small fixes applied directly (no decision needed):

  1. PR body said "the default preserves current behavior byte-for-byte" — inaccurate for the bare-retry slice described above; replaced with the precise old→new statement.
  2. PR body said the fatal log "carries the qualifying signals + finish reason" — the code carries sawThinking/sawStrippedEcho/releasedMarkupChars/stalledTail/visibleTextChars/answerChars (no finish reason; at that branch the reason is always a clean stop, so the field set is the right call). Body now lists the actual fields.
  3. The branch was behind master and every CI lane was skipping on the head — merged origin/master (301e1a5) in, clean, typecheck + targeted tests green, pushed as 08c237c. CI should now run for real.

八问

  1. 是什么问题:plugin chat 车道的退化回合重试([BUG] In some cases, with Codex's auto model + DeepSeek, it will suddenly terminate automatically. #732/workbuddy报错Empty stream: upstream gateway sent only placeholder chunks without any model output (chunks=0, bytes=0) #821 的一次续写 nudge)耗尽后只有 Plugin passthrough leaves the client an empty turn when the model echoes a render tag #870 致命带内错误一个终局、没有任何出口;且两个机械缺陷(【bug】空轮重试门闸把 reasoning 记成可见正文 —— Responses 协议下 item.content[] 带 reasoning 的退化轮永不重试(客户端拿到空轮) #2756 bare 豁免被致命分支遮挡、够格计数器跨重试不重置)在放大失败率(生产数据 36% 重试→判死)。
  2. 什么原因导致的:Plugin passthrough leaves the client an empty turn when the model echoes a render tag #870 的致命分支加在 【bug】空轮重试门闸把 reasoning 记成可见正文 —— Responses 协议下 item.content[] 带 reasoning 的退化轮永不重试(客户端拿到空轮) #2756 bare 豁免之后,重试趟永远走不到豁免;重试接管时逐次累计量(sawThinking/sawStrippedEcho/releasedMarkupChars 等)不重置,第一趟的信号替第二趟"够格"。
  3. 影响范围与严重程度:仅 plugin chat 车道(pi/opencode 插件模式,openai chat wire);触发条件 = 退化终局回合且唯一一次续写重试也无可用输出;严重度 p2——回合被硬性判死、宿主无逃生(只能手动重发),其余两车道不受影响。
  4. 怎么修复的:① bare 门提到耗尽重试分支之前(真正 bare 的重试趟走 【bug】空轮重试门闸把 reasoning 记成可见正文 —— Responses 协议下 item.content[] 带 reasoning 的退化轮永不重试(客户端拿到空轮) #2756 放行);② 重试接管时重置逐次累计量(判决只度量重试趟自身输出);③ 致命日志点名够格信号;④ 新增 compat.degenerateTurn="passthrough"(env BILI_DEGENERATE_TURN)恢复 pre-Plugin passthrough leaves the client an empty turn when the model echoes a render tag #870 终局;默认 "error" 保留致命终局。
  5. 是否有回归问题:逐形状重推 pass-2 全谱系——唯一变化的切片是"真正 bare 的重试趟"(fatal → 空回合放行),属有意变更且已在 PR 正文披露 old→new;pass-1 全路径、[dsh] Retry-exhausted degenerate turn is serialized as successful completion (0.1.213) #5958 错误形状、responses/proxy 车道、截断重试预算均不变;既有 pin 已按新形状重钉。本地定向 90/90 + 同步 master 后 typecheck 干净、53/53;CI 在同步后的 head 上运行中。
  6. 是否破坏缓存:不涉及——缓存/重试预算/游标/去重键均未触碰,nudge 注入与 refetch 机制不变。
  7. 是否改了设计方向:不涉及——knob 是 compat.streamErrorShape 的同层兄弟(同一 env>file>default 接线),无架构/边界/数据流转向。
  8. 是否引入了新的配置:是——compat.degenerateTurn("error"|"passthrough",默认 "error",env BILI_DEGENERATE_TURN,未知值回落 "error");en/zh/ja 文档 + seed yaml + lifecycle 台账(退役条件:确认无人用 passthrough 后)已齐。

Verdict: mergeable — CI green on the synced head (08c237c) + owner merge. My earlier observability PR #4918 is superseded by commit df673be (the fatal log now carries the qualifying signals there) — I have left a note on it recommending closure.

…l log (#4913)

The PR body promises the fatal log carries the qualifying signals + finish
reason, but both terminal log lines (the #870 fatal and the new
compat.degenerateTurn=passthrough branch) named the signals without the
finish reason. That also drops the finishReason field the superseded
observability PR #4918 carried. Add finishReason=${reason} to both lines.
Log-only; no behavior change.
@ranxianglei

Copy link
Copy Markdown
Owner Author

🤖 Powered by ework · qwen3.8-27b

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

查重:不重复。 本 issue 是 0.1.215 dsh lane 的综合报告(三症状),相关 drift / tag-leak 条目我已逐一关联(见下);但你 10:45 的 passthrough 判别实验是新的、决定性的归因数据,把"用户可见停"和"日志层 abort"分开了,不与既有条目重复,值得单独处理。

先确认你的判别实验(这组对照把归因钉死了):

  • passthrough: true(热切换)后,用户可见症状全部消失(会话不再自己停 + <acp> 标签不再泄漏)→ 根因在 bili 压缩路径(0.1.215 dsh lane + glm-5.3),不是上游、不是 DSH 宿主。
  • 日志层 client disconnected mid-stream 在 passthrough 下照旧 → 这些是 DSH 宿主收到完整 tool_use 块后主动掐流执行工具的正常行为,bili 侧记为 aborted,是背景噪音,不是用户可见"自己停"的直接原因。你把 232 次 abort 降级为"待定性信号"是对的。
  • 现象 C(DIGEST DRIFT / envelope FROZEN)是独立的存储层问题,与 A/B 不同根,full 模式下仍未解决。

问题 1 ── storage.unified=full 是不是默认/灰度?开关在哪?

问题 2 ── A 和 C 同根吗?

  • 不同根,三个独立机制:
    • C(envelope FROZEN)只冻结 JSON 信封的旁路写(src/persist.ts:3219:"the unified store keeps receiving the save and compression continues from the in-memory view")—— 服务路径(统一索引 + 内存视图)不受影响,C 不会导致客户端断流/会话停。
    • A(用户可见"自己停")= 压缩路径(你的实验已证)。
    • 日志层 abort = DSH 宿主行为(你的实验已证)。
    • 462f524b 同时出现 abort+drift 只是共现,不是因果。

问题 3 ── 标签泄漏(现象 B)是不是 0.1.215 dsh lane 的已知回归?

  • 是已知未决问题族,不是 0.1.215 新回归。 你看到的 <acp tokens="1" type="text">m00078</acp>(一次性空请求被铸 ref + 标签漏进用户可见流)落在这一族:
    • #4162(tag-echo 流式过滤器跨 chunk 边界漂移,open)
    • #5175 / #5178 [PR](strip drifted open-tag names and mid-turn draft envelopes,open)—— 不在 0.1.215(已核 head sha 不在 v0.1.215 祖先集)
    • #5192/#5256(DSH lane 0.1.209 泄漏)、#6310(一次性请求走主管线)

现象 C 的相关条目(存储层 drift 族):

结论与下一步:

  • 你的主诉(A 真身 + B)根因 = 压缩路径,0.1.215 缺 #5178;C 的根因 = 存储层 drift,0.1.215 缺 #5691。这两个在途 PR 都不在 0.1.215 里。
  • 0.1.216 要真正兜住你这条路径,需要 #5178 + #5691 合入(或确认它们覆盖 dsh lane + glm-5.3 的具体形态)。建议 owner 关注这两个 PR 的 review/合并进度。
  • 我这边:① 修掉那条误导性启动日志(顺手修,独立 commit + 小 PR);② 如需要,我可以核对 #5178/#5691 的 diff 是否覆盖你的具体形态(一次性空请求 / 长会话 drift),给一份"能不能兜住"的核对结论 —— 说一声我就做。

你继续 passthrough 观察是安全姿态(压缩路径旁路,不会更糟)。等 0.1.216 时把上面两个 PR 的合入状态带上看一眼即可。

@ranxianglei

Copy link
Copy Markdown
Owner Author

🤖 Powered by ework · qwen3.8-27b

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

CI-engineer handoff complete — the architecture-docs red is resolved.

I was handed off the architecture-docs CI failure (floor 4). Root cause: stale base — the branch was behind master, and master's reference/architecture.md + src/ file set had moved, so the old head's file map was out of date. The reviewer's master sync (08c237c862) brought it current.

Verified on the PR head — ran tools/check-architecture-docs.mjs directly on 08c237c862:

ok: map covers all 323 src files, no ghosts
ok: ledger: 8 modules, 8 active, page set matches
ok: diagram references + SVG well-formedness pass
architecture-docs guard: all green

Red items & conflicts — none. Mirror cache on head 08c237c862: 0 failed, no merge conflict (mergeable_state: blocked = checks pending, not dirty). The PR only modifies existing src/ files (config.ts, plugin.ts, relay.ts) — no add/remove, no reference/architecture.md change — so the file-map guard is structurally unaffected by the PR itself.

Current CI (mirror snapshot 02:51Z, ~16 min old and not yet refreshed): static gates all green (static-gates ×2, mysql-contract, pi-subagents-guard, docs-sync, kernel-guard); 11 test lanes in progress (the full regression); e2e lanes skipped (gated, not triggered by this diff).

Verdict: the CI red items and conflicts I was handed off are cleared. The PR is in a mergeable state pending the in-progress test lanes — owner can merge once they go green; I'll flag it if any lane goes red.

八问

  1. 是什么问题:CI 工程师接管的 architecture-docs 红项——分支落后 master 的 stale-base 失败。
  2. 什么原因导致的:旧 head 的 reference/architecture.md + src/ 文件图落后于 master,文件图过期 → architecture-docs 红;非 PR 代码问题。
  3. 影响范围与严重程度:仅 CI 红项(阻塞合并),无运行时影响;stale-base 是机械问题。
  4. 怎么修复的:reviewer 已 merge master(08c237c862)同步;我在 PR head 直接跑 check-architecture-docs.mjs 验证全绿(323 src 文件无 ghost、8 模块页面配对、图 well-formed)。
  5. 是否有回归问题:不涉及——只跑 CI 检查,未改任何代码。
  6. 是否破坏缓存:不涉及。
  7. 是否改了设计方向:不涉及。
  8. 是否引入了新的配置:不涉及(PR 本身的 compat.degenerateTurn 已在 floor 5 披露)。

@ranxianglei

Copy link
Copy Markdown
Owner Author

🤖 Powered by ework · qwen3.8-27b

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

查重: 不重复。本 PR 与仍 open 的 #4918 同属 #4913,但 #6993 是 #4918 的超集——#4918 只做「fatal log 命名 qualifying signals + finishReason」(observability-only,不动行为);#6993 的 commit 1 已包含同样的 log 命名,加上 gate 顺序修复 + per-attempt 计数器 reset + compat.degenerateTurn 开关。即 #6993 取代 #4918,建议 owner 关闭 #4918(我不关)。其余 open 项均非重复:#6034 是「传输超时被误判为退化回合」(机制不同);#6475 是 side-lane 跳过 gate(非本车道重试终局)。

标签: bug / pi / dsh / scope/wiring / p2(缺陷:plugin 聊天车道退化重试终局不可达 + 无逃生开关;repro 在 pi 车道、代码注释点名 DSH 受影响;属客户端接入层接线;能用但有明显可靠性问题且有绕行开关 → p2)。

审核结论(按 PR Review 优先级)

① 原 issue 方向: #4913 报告本地模型部署 36% 重试→硬失败。三诉求:(1) #2756 bare 豁免写在 fatal 分支之下 → 真正 bare 的重试永远过不去(终局不可达);(2) qualifying 计数器跨重试累积 → attempt 1 的 thinking 让 attempt 2 也判「又退化」;(3) 无配置逃生口。方向正确,打到了根因(终局不可达 + 计数器污染 + 无开关)。

② 回归审查(逐项既有行为):

  • 默认路径行为变更(commit 1,必须披露): 真正 bare 的重试(无 thinking/无 echo/无 markup/无 stalledTail)——旧: fatal in-band error;新: 作为空回合 pass-through。对齐 【bug】空轮重试门闸把 reasoning 记成可见正文 —— Responses 协议下 item.content[] 带 reasoning 的退化轮永不重试(客户端拿到空轮) #2756 文档契约(bare = 上游自己的空答案 = pass-through)。PR 正文「default preserves current behavior byte-for-byte」只对 commit 2(开关,默认 error)成立;commit 1 对 bare-retry 这一 case 确实改了默认行为。已在第 5 问披露。
  • 36% 不会被机械修复降低: 生产 shape 是 thinking-only(sawThinking=true, visibleTextChars=0, clean stop),不是 bare。机械修复(gate 顺序 + reset)对 thinking-only 这一 shape 默认仍 fatal;只有 opt-in 的 passthrough 开关才让它 pass-through。所以「修 36%」靠的是开关,不是机械修复。PR 正文未明确区分,易让读者误以为机械修复就解决了 36%。
  • reset 不破坏相邻重试: retryZeroByteCut / retryReasoningOnlyCut 都在最前 gate if (degenerateRetried || truncationRetried) return false,不读累积器(已读码确认)。
  • draftTail/announceTail/stalledTail: 依赖 per-attempt 的 visibleTextChars + append-only 的 proseAcc tail → 重试趟上 effectively per-attempt,reset 后语义正确。
  • buildTruncationDiag: emit 时从累积器构建 → 重试趟现在反映重试自己的计数器(比修复前混合计数器更准,符合其注释)。
  • CI: architecture-docs 红是继承性(master base 同 lane 也红;PR 树本地 node tools/check-architecture-docs.mjs = all green)。非本 PR 引入。owner 已把 master merge 进 PR 分支,PR 不再 behind。

③ 代码审查: 逻辑正确。gate 顺序(bare 先于 fatal)+ per-attempt reset + 开关 wiring 都对。一处文档-代码不符已顺手修(见下)。

④ 测试有效性: 真测试,断言有牙。tests/plugin-empty-turn-retry.test.ts 27 条本地实跑全过;degenerate-retry 簇 5 文件 78 条全过。thinking-only 第二趟 fatal 断言 log 含 sawThinking=true + releasedMarkupChars=0;bare-retry 断言 pass-through;开关 env>file>default 有专门测试。bug 回归时抓得住。

⑤ diff 整洁度: 干净。9 文件 +302/-20,每行都与本 PR 目的相关(机械修复 + 开关 + 文档 + 测试)。无跑题文件、无锁文件 churn、无纯空行重排。

⑤b 代码整洁: 命名达意(degenerateTurn/passthrough)、无死代码、错误处理完整(fatal log 带 qualifying signals)、风格一致、未引入新依赖。

顺手修(已 push 到 PR 分支)

commit 7b6aa99 — fix(plugin): name the retry's finish reason on the degenerate terminal log (#4913):PR 正文承诺「fatal log carries the qualifying signals + finish reason」,但两条终局 log 行(#870 fatal + 新 passthrough 分支)只命名了 signals、漏了 finishReason——这也丢掉了被取代的 #4918 带过的 finishReason 字段。给两行都补上 finishReason=${reason}(仅 log,无行为变更)。本地 27/27 复跑通过。

待 owner 处理(我不关)


结构化八问

  1. 是什么问题: plugin 聊天车道的「退化重试终局」有两个机械 bug——【bug】空轮重试门闸把 reasoning 记成可见正文 —— Responses 协议下 item.content[] 带 reasoning 的退化轮永不重试(客户端拿到空轮) #2756 的 bare 豁免写在 fatal 分支之下导致真正 bare 的重试永远过不去(终局不可达),且 qualifying 计数器跨重试累积导致「又退化」判定被上一趟污染;同时没有任何配置开关能把该条件从 fatal 降级为 pass-through。
  2. 什么原因导致的: 根因是终局分支的顺序与状态管理——bare 豁免(应优先)被放在 fatal 判定之后,且 per-attempt 判定计数器没有随重试重置、跨趟累积;加上该条件在另外两条车道(proxy/responses)本就静默 pass-through,唯独 plugin 聊天车道是 fatal outlier 却无逃生口。
  3. 影响范围与严重程度: 触发条件 = plugin 聊天车道 + 模型产出空/thinking-only 退化回合 + 续写重试后仍退化。生产实证为本地模型部署(Qwen3.8-Flash FP4, pi 车道, openai wire)36% 重试→硬失败。严重度 p2:能用(64% 重试成功)但有明显可靠性问题,且有绕行开关(passthrough)。非数据丢失/非缓存泄露/非会话不可恢复。
  4. 怎么修复的: 三层——(a) bare 豁免 gate 提到 fatal 判定之前,让真正 bare 的重试按 【bug】空轮重试门闸把 reasoning 记成可见正文 —— Responses 协议下 item.content[] 带 reasoning 的退化轮永不重试(客户端拿到空轮) #2756 契约 pass-through;(b) 重试接管时重置 per-attempt 计数器(sawThinking/sawStrippedEcho/sawToolUse/visibleTextChars/answerProse/releasedMarkupChars),让「又退化」只测本趟;(c) 新增 compat.degenerateTurn: "error"|"passthrough" 开关(默认 error 保持现状,env BILI_DEGENERATE_TURN),passthrough 让该条件走与 proxy/responses 车道一致的 pass-through 终局。
  5. 是否有回归问题: 有一处有意的默认路径行为变更——真正 bare 的重试从 fatal 变为 pass-through(commit 1)。这是对 【bug】空轮重试门闸把 reasoning 记成可见正文 —— Responses 协议下 item.content[] 带 reasoning 的退化轮永不重试(客户端拿到空轮) #2756 文档契约的修正,非无意回归;已披露旧值→新值+原因。其余既有行为(相邻重试 gate、draft/stalled tail、truncation diag)逐项核对无破坏。CI 的 architecture-docs 红是继承性(master 同红),非本 PR 引入。
  6. 是否破坏缓存: 不涉及。改动在 plugin 聊天车道的终局判定与 log,不触碰缓存/重试游标/去重键/前缀。
  7. 是否改了设计方向: 不涉及架构转向。是把 plugin 聊天车道的退化终局对齐到另外两条车道的既有契约(bare=pass-through),并补一个与 compat.streamErrorShape 同族的逃生开关。数据流/边界不变。
  8. 是否引入了新的配置: 是。新增 compat.degenerateTurn(config 文件 compat.degenerateTurn + env BILI_DEGENERATE_TURN),取值 "error"|"passthrough",默认 "error"(保持现状 byte-for-byte)。无迁移:默认值即旧行为。文档已同步(seed yaml、env-map en/zh/ja、手写 compat 段 en/zh/ja、lifecycle.md ledger)。

判定: 可合。机械修复 + 开关方向正确、测试有牙、diff 干净;已顺手修掉 finishReason 缺失(commit 7b6aa99)。合入前需:owner 关闭被取代的 #4918;architecture-docs 继承红按 CI 协调政策在 #4599 收敛(非本 PR 阻塞项)。

@ranxianglei

Copy link
Copy Markdown
Owner Author

🤖 Powered by ework · qwen3.8-27b

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

CI fix: merged ci-fixes into the PR branch (inherited master red)

The 3 failing test shards (windows 22/4, ubuntu 22/3, ubuntu 24/3) all hit the same inherited master red: tests/issue2929-codex-fold-double-miss.test.ts (#2929 fold-probe anchor drift after #6151 landed on master).

Verified inherited, not PR-caused: the test fails identically on clean master (de895aa88c) with the exact same assertion (scenario miss: no ephemeral nudge in the pre-fold request (inputs[6])). This PR's src/server/relay.ts change is 2 lines (passing opts.degenerateTurn to createHandoffReply) — it does not touch the nudge schedule, and the PR does not modify the test file.

Fix: merged origin/ci-fixes (7247410976: probe schedule-independence + recalibrate anchor + hermetic wire shape) into the PR branch.

  • New head: 8c2cb8816e (merge commit, no CI-hold marker — this is the final head)
  • Local verification: codex 命中率问题分析 #2929 test passes (1/1), architecture-docs guard all green (325 src files, 8 modules, diagrams well-formed)
  • Pushed to fix-4913-degenerate-turn-terminal

CI will re-run on the new head. No code changes to the PR itself — pure ci-fixes merge.

八问

  1. 是什么问题:3 个 test 分片(windows 22/4、ubuntu 22/3、ubuntu 24/3)同挂 tests/issue2929-codex-fold-double-miss.test.ts(codex 命中率问题分析 #2929 fold-probe 锚点漂移)。
  2. 什么原因导致的:[PR] feat: pi lane — show the injected nudge text verbatim in the terminal when debug is on #6151 落 master 后 nudge 调度变化,probe 硬编码请求下标锚点失配;CI preload 钉 BILI_MESSAGE_TIMESTAMPS=0 与本地直跑 wire 形状不同。属 master 级继承红,非本 PR 引入(本 PR 的 relay.ts 改动仅 2 行,传 opts.degenerateTurn,不触及 nudge 调度;且未修改该测试文件)。
  3. 影响范围与严重程度:仅 CI 信号级问题(3 个 test 分片红),非用户侧功能问题;本 PR 代码无缺陷。
  4. 怎么修复的:merge origin/ci-fixes(7247410976,probe 改调度无关 + 钉 messageTimestamps:false 保 hermetic)进 PR 分支,新 head 8c2cb8816e;本地验证 codex 命中率问题分析 #2929 绿 + architecture-docs 绿。
  5. 是否有回归问题:不涉及——本 PR 代码零改动,仅带入 ci-fixes 的测试文件修复(codex 命中率问题分析 #2929 probe 校准)与 reference/architecture.md 一行(补 src/responses-system-sections.ts 模块图)。
  6. 是否破坏缓存:不涉及。
  7. 是否改了设计方向:没有。
  8. 是否引入了新配置:没有。

判定:PR 分支已含 ci-fixes 修复,CI 重跑应转绿;等 CI 结果确认。

@ranxianglei

Copy link
Copy Markdown
Owner Author

🤖 Powered by ework · qwen3.8-27b

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

CI green confirmed. Run 44023145830 on head 8c2cb8816e completed with conclusion=success (all 30 checks: 0 failed). The 3 previously-failing test shards (windows 22/4, ubuntu 22/3, ubuntu 24/3) now pass after the ci-fixes merge.

PR #6993 is ready for review/merge — no further CI action needed.

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant