Repository navigation
[PR] feat: self-classifying diagnostics for degenerate terminal turns (part of #3102) - #3107
ranxianglei wants to merge 8 commits into
Conversation
📦 Built Package ArtifactBranch: Latest build — install this exact versionnpm install -g billion-context@0.0.6203-pr.3107.2f98734This exact version is immutable and reproducible. The rolling Recent builds (commit → version)
Download artifact
tar xzf billion-context-pr3107.tgz
npm install -g packageInstall instructions are refreshed on each push. |
d2c64e3 to
b90da1b
Compare
[bot] 🏷 审核结论:PR 代码本身通过审核,可合;CI test lane 的红是 master 既有回归(已单独立项 #3125),与本 PR 无关。 已完成:rebase 到当前 master( 结构化八问
验证与 CI 状态
收工判定:代码可合。 唯一拦路的是 master 自身的 golden 回归(#3125)——它清掉后 lane 即绿;若 owner 判定该漂移可接受并走 regen,同样解锁。合并动作留给人工。 |
[bot] 🏷 CI 终态更新:b90da1b4a 上 33/33 check 全绿,含四条 test lane(ubuntu/windows × node 22/24)。 之前预期会继承的 4 个 storage-render golden 失败没有发生——test lane 跑的是 PR merge ref(head + 当时最新 master),而 master 在跑测窗口内已合入该回归的修复(#3119,merge 最终收工判定:全绿可合——代码审核通过、rebase 到当前 master、定向本地验证 70/70、CI 33/33。合并动作留给人工:#3107 |
|
冲突 |
The #2756 refusal line reported only char counters, so the two normal-budget length-finish empty turns of #3102 could not be self-classified from logs (budget burned in reasoning vs produced nothing; sidecar co-occurrence needed manual archaeology). - src/concurrent-forwards.ts: per-session in-flight forward counter (in-memory only) — correlation signal for same-session sidecars - relay.ts: thin forward() wrapper counts model forwards per session - plugin.ts: UsageSample.reasoningTokens sniffed from completion_tokens_details.reasoning_tokens / top-level spelling / anthropic thinking_tokens; degenerate-terminal line now carries outputTokens, reasoningTokens, sawThinking, elapsedMs, sessConcurrentForwards
b90da1b to
09ef5bb
Compare
(ai: vllm-qwen/qwen3.8-27b) 冲突已解决,rebase 到当前 master(d8c0e50)后 force-push,新 head 结构化八问
行为变更披露(本 PR 自身内容,非 rebase 引入):#2756 的 degenerate-terminal 告警行末尾追加 收工判定:冲突清零,分支可合并,等 CI 绿灯即可由人工合并。 |
(ai: vllm-qwen/qwen3.8-27b) 这条「冲突」评论(01:52)早于我刚才的修复——已处理完,现在没有冲突了。刚重新核过一遍:
等 CI 全绿后页面冲突标记会消失,可以直接合并。详情见我上一条八问回复。 |
(ai: vllm-qwen/qwen3.8-27b) 第二轮冲突已解决并推送(head 这一轮撞了什么:master 又前进了( 解法:union 保留双方—— 八问:
判定:冲突闭环,等 CI 全量绿后即可合并。若 master 再前进导致第三次冲突,按同一 union 原则处理即可。 |
master window commits 293ae65/de5e03659 bumped kernel/package.json to 0.0.165 without regenerating the lockfiles; lock-sync re-resolution then rewrites the stale recorded versions (root 0.0.163, kernel 0.0.164) and fails. Pure recorded-version sync via npm install --package-lock-only; no dependency or semantic change.
Part of #3102 — observability only; no wire, config, kernel, or persistence behavior change.
Background
Two of the
finish=lengthempty turns in #3071 had normal output budgets (32768) yet returned zero visible chars; both coincided with the dsh title-gen sidecar (#2503). The code audit (full write-up in the #3102 thread) ruled out stream interleaving as a bili-level cause: undici defaults to pipelining=0 (one socket per concurrent request; each fetch owns its response stream), and the side lane touches neither kernel state nor session stats (the strip pipe runs with session=undefined). Remaining suspects — budget burned in reasoning before any prose vs an upstream co-occurrence effect — were NOT distinguishable from current logs: the #2756 refusal line reported only char counters, and the reasoning-token split that gateways report inside completion_tokens was never sniffed.What this PR adds
src/concurrent-forwards.ts: per-session in-flight forward counter (in-memory only, never persisted). A thinforward()wrapper in relay.ts counts model forwards per session id (GET/HEAD excluded), so the diagnostic line can report whether another same-session forward (the title-gen sidecar) was in flight when the turn ended. Correlation signal only — it never asserts causation.src/plugin.ts:UsageSample.reasoningTokenssniffed fromcompletion_tokens_details.reasoning_tokens(plus the top-levelreasoning_tokensspelling some relays use) and Anthropicthinking_tokens; merged into the per-response accumulator like the other fields.item.content[]带 reasoning 的退化轮永不重试(客户端拿到空轮) #2756 non-clean-stop refusal line now self-classifies:old:
...not retried (finish length is not a clean stop): visibleTextChars=0, releasedMarkupChars=0 (#2756)new:
...not retried (finish length is not a clean stop): visibleTextChars=0, releasedMarkupChars=0, outputTokens=32768, reasoningTokens=32768, sawThinking=true, elapsedMs=1450, sessConcurrentForwards=1 (#2756/#3102)The next occurrence states its own class: budget burned in reasoning (reasoningTokens≈outputTokens, sawThinking=true) vs produced nothing (reasoningTokens=?/0, small elapsedMs) — and whether the sidecar was actually in flight.
Behavior-change disclosure
Log-line format extension only (additive fields on one warn line). No wire/message shape, config surface, persistence format, kernel, or retry-semantics change. The
forward()export keeps its exact signature; the original body moved intoforwardInnerunchanged (pure rename + wrapper).Tests
tests/issue3102-degenerate-diag.test.ts: counter semantics (own-forward exclusion, underflow clamp, session isolation); an openai length-finish zero-visible turn reporting the full field set incl. concurrency=1; the zero-concurrency control; Anthropic thinking_tokens capture.Fixes #3102
(孤儿认领:标题本已指向 #3102,补上关闭关键字 —— 第三批清理)