Repository navigation
[PR] fix: overflow-stated counts steer local fold targets immediately (provisional estimator bias) (#5373) - #5382
ranxianglei wants to merge 2 commits into
Conversation
📦 Built Package ArtifactBranch: Latest build — install this exact versionnpm install -g billion-context@0.0.9118-pr.5382.f2be328This exact version is immutable and reproducible. The rolling Recent builds (commit → version)
Download artifact
tar xzf billion-context-pr5382.tgz
npm install -g packageInstall instructions are refreshed on each push. |
(ai: vllm-qwen/qwen3.8-27b) Reviewed PR #5382 (head 查重(独立判定,不复读 issue 结论):不重复。 本 PR 的机制是「第一次 overflow 就把上游声明的 payload 计数保留成一条 provisional 每路由估算偏差,让本地折叠判断立刻按它走,直到 ring 发布后由 ring 取代」。这与它引用的既有工作机制不同:#3450 是 stated-WINDOW 面(arm baseline 钉在 ceiling),这里是 stated-PAYLOAD-COUNT 面(steer fold target),且用 mismatch guard 保住了 #3450 的 burn-and-net;#3900 是把单次样本喂进 ring(要 ≥2 一致才发布),这里是在发布前就立即 steer。同一起事故家族、不同失败面 → 符合「同症状同 issue、不同机制可分」的口径。方向关通过:这是疏不是堵——修掉的是「本地判断在环里永远停在 raw calibre」这个产生现象的机制,而不是把 400 挡住。 八问
行为变更披露(旧→新):OLD:overflow 后本地判断停在 raw calibre,直到 ring 发布(≥2 一致、未被清)——在全新 overflow-only 会话上实际等于永远发不出 ⇒ 永久 400;武装救援烧完整阶梯。NEW:第一次 overflow 就用 clamp(stated/est,[0.25,4]) steer 同 origin 同 model 的判断,直到 ring 取代;武装救援在校准停止点退出。后果:愈合轮前置折更深(恢复轮 summarize 调用/成本上升)——有意自愈合。视图不匹配(≥4×/≤¼)情形不变(mismatch guard 保住 master 的 burn-and-net,e2e #3450 T1 覆盖)。 测试有效性(④):新文件 CI:static-gates / mysql-contract / version-guard 已绿;全量 test 矩阵(ubuntu/windows × node 22/24 × 5 shards)仍在跑,目前 0 failed。 合并判定:方向正确(疏)、回归未发现、测试有牙、diff 干净(单 commit 11 文件全部与本 PR 目的相关,无 lockfile/generated churn)、行为变更已披露。待全量 test 矩阵转绿即可合;当前证据下我判断可合。 |
(ai: vllm-qwen/qwen3.8-27b) Reviewed this against master (base
Tracking CI on this head — completed gates green, test shards still running. Full verdict will come from remote CI on the pushed head. |
6494d6e to
fa6fe4b
Compare
(ai: vllm-qwen/qwen3.8-27b) Conflict resolved and pushed. The PR branch ( What the resolutions were (all mechanical, union-of-intent):
Live state verified this run: PR 中文八问(结构化结论)
收工判定:冲突已解、分支已推、状态已转干净(blocked = 等 CI/保护规则),等待 CI 全绿后即可走人工合并。 |
A fresh overflow-only session (resume-miss sub-session, no usage history) could never publish the calibration ring while every forward kept overflowing: publication needs >=2 agreeing samples on one origin+model slot that any foreign settle clobbers, and the armed prefold comparator could not fit-exit under a clamped arm. Local judgments therefore stayed raw-estimate calibre forever and each forward re-400'd — a permanent loop (incident 2026-10-31, dsh lane). - armOverflowShrink retains clamp(stated/local-est, [0.25, 4]) per origin+model as stats.overflowBias (persisted, validated on restore); a ratio outside the band flags the record 'mismatched' (the stated count describes payload bili does not hold, #3450 shape) and such a record does not steer. - new util.effectiveCalibration picks the factor allowed to steer THIS route: ring k-hat when applicable to the decision origin, else the un-mismatched bias, else absent; all application sites (trigger, preflight mass/target, relay overhead, output clamp x3 lanes) now use it. - the armed preflight comparator exits on the calibrated round text when a factor applies (folds until est*k <= budget instead of burning an unsatisfiable floor comparison); legacy behavior when no factor applies. - ingest/settle/arm now log accept/reject reasons (the learning path was silent before, which made the incident undiagnosable from production logs). - the post-fold summary line quotes savings from its own endpoints instead of the floor-clamped meter ('~0 tokens saved (913329 -> 875788)' can no longer happen); the meter field itself is unchanged (consumed by the #3444 backoff gate). Tests: tests/issue5373-overflow-bias.test.ts (unit gates for effectiveCalibration/calibrationOriginApplies incl. the mismatch guard; e2e mechanism + regression through DeepSeek-shaped overflows with a billing mock).
An unclamped overflow arm (measured count already above the stated ceiling — declared window wider than the provider's real one) keeps master's raw-scale fit judgments in preflight. Applying the provisional bias there declares an unfoldable payload over-limit; the walk books a non-materializable emergency-truncate credit and the #1987 anchor then clobbers the upstream-measured arm baseline (source flips to 'estimate'), breaking the #1195 B passthrough contract. The armed-comparator carve-out gets the same clamped-arm restriction so a ring-published factor cannot take an unclamped arm off its floored path either.
fa6fe4b to
2409888
Compare
(ai: vllm-qwen/qwen3.8-27b) 结论先行:本轮现场核验确认——PR #5382 当前没有合并冲突,无需 rebase、无需 push。 任务标注的「merge state: dirty」是过期/瞬时检测标签;实时状态是 本轮证据(全部现场核验,非记忆):
为何会触发: floor 13(今日 04:28Z)前一轮 CI 工程师已解过一次真冲突(当时分支基于约 10 天前的旧 master);此后分支又被重新落到当前 master 本轮动作:零改动、零 rebase、零 push。 理由:rebase 到已是祖先的 master 是空操作(up-to-date,不改任何 SHA);强推同一 SHA 属无谓重写,会白白再触发一轮全量 CI、浪费算力,且可能与并行处理本分支的其他 agent 抢分支。前提(存在冲突)经三重独立验证为假——如实报告比盲目执行破坏性 force-push 更安全。 当前 CI(非红项): 截至镜像 check 缓存快照(sha 中文八问
收工判定:无冲突可解、无红项可修;分支为当前 master 之上的干净 fast-forward 栈, |
[ework] CI fix verified green ✓ |
2 similar comments
[ework] CI fix verified green ✓ |
[ework] CI fix verified green ✓ |
Closes #5373
What this changes
After an overflow 400, bili now RETAINS the upstream-stated payload count as a provisional estimator scale for that route (
stats.overflowBias, persisted), and every local judgment on that route (preflight trigger, fold mass/target, relay overhead, output clamp ×3 lanes) picks its factor through one new selectorutil.effectiveCalibration: ring-published k̂ when applicable to the decision route, else the retained bias, else absent (today's raw behavior). The armed preflight comparator additionally exits on the calibrated round text when a factor applies, so a rescue fold stops atest × k̂ ≤ budgetinstead of burning an unsatisfiable floor comparison.Why: on a fresh overflow-only session (the incident's resume-miss sub-session, no usage history) the ring can never publish while every forward keeps overflowing — publication needs ≥2 agreeing samples on one origin+model slot that any foreign settle clobbers — so local judgments stayed raw-estimate calibre forever and each forward re-400'd: a permanent loop. The first overflow's stated counts are high-confidence measurements (three mutually consistent numbers in one body); using them immediately is what breaks the loop. Algebraically identical to the issue's proposed
bias = max(bias, stated/estimate)divisor on the fold target.Safety gates:
mismatched(stated count describes ≥4×/≤¼ of bili's own view — content bili does not hold, the [Bug][dsh native] preflight fold target sits ABOVE the engine's own denominator (1048576 vs 1000000) and the upstream-stated window from a 400 never feeds it — 'deficit 0' forwards an over-window payload → context_length_exceeded kills the turn #3450 shape) and does NOT steer; a later sane measurement supersedes it (trust beats distrust; MAX within one trust class);calibration.disabledpolicy respected at retention time;Also in this PR (same incident evidence):
autoFoldTargetTokenscauses a fold storm, andexternalSummary.*file edits do not take effect until aPUT /__bili/config#3444 backoff gate).Behavior change (old → new)
mismatchedguard preserves master's burn-and-net; verified by e2e [Bug][dsh native] preflight fold target sits ABOVE the engine's own denominator (1048576 vs 1000000) and the upstream-stated window from a 400 never feeds it — 'deficit 0' forwards an over-window payload → context_length_exceeded kills the turn #3450 T1).Tests
tests/issue5373-overflow-bias.test.ts: unit gates for effectiveCalibration/calibrationOriginApplies (incl. the mismatch guard, clamp band, model/origin gates) + e2e through the real pipeline with a billing mock (DeepSeek-shaped 400s): mechanism (bias retained at first arm, ring discipline intact) and regression (the grown turn fits on its INITIAL forward with bounded fold work; learning completes by turn 2). Targeted suites green locally on the rebased head: 104 tests across the #3900/#3450/#1987/#2313/#1839/#2029/#1492/#2484/cjk-context-overflow/fold-anchor-doctrine/fix-arm-headroom-clamp families; full suite on CI.查重: 不重复 — #3900 (closed, fixed in 0.1.201 via #4093) is the same upstream signature predating this variant; #4079 (open hub) covers over-window forwards reaching upstream, this is its compression-lane variant where the LOCAL TARGET itself is wrong; #5278/#5291/#5296 are the output-clamp safety-buffer family (the clamp never fired in the incident); #3450 is the stated-WINDOW facet (this PR is the stated-PAYLOAD-COUNT facet and preserves #3450's pinned netting behavior).