Repository navigation
[PR] fix(preflight): scope the usage baseline and k̂ estimate to the model that measured them - #6467
ranxianglei wants to merge 14 commits into
Conversation
📦 Built Package ArtifactBranch: Latest build — install this exact versionnpm install -g billion-context@0.0.12629-pr.6467.b93ba13This exact version is immutable and reproducible. The rolling Recent builds (commit → version)
Download artifact
tar xzf billion-context-pr6467.tgz
npm install -g packageInstall instructions are refreshed on each push. |
5289944 to
19ab036
Compare
…switch e2e The #6430 model-scoped baseline demotion is a third path into the baselineFloor===0 state the #2313 forward-once escape anticipates: after a mid-lane model switch the cross-model baseline no longer drives the trigger, so the first switched-model request is forwarded to acquire the new model's usage evidence (in the real world the over-window forward 400s and arms the overflow baseline) and the second request folds. The test now asserts both legs: req2 forwards without summarization and settles a fresh same-model baseline; req3 folds before forwarding. Found in PR #6467 review: the old test asserted a fold on the first switched-model request, which the intended #6430 behavior (stated in the PR body) no longer does.
2e64cc3 to
ad1ff55
Compare
…switch e2e The #6430 model-scoped baseline demotion is a third path into the baselineFloor===0 state the #2313 forward-once escape anticipates: after a mid-lane model switch the cross-model baseline no longer drives the trigger, so the first switched-model request is forwarded to acquire the new model's usage evidence (in the real world the over-window forward 400s and arms the overflow baseline) and the second request folds. The test now asserts both legs: req2 forwards without summarization and settles a fresh same-model baseline; req3 folds before forwarding. Found in PR #6467 review: the old test asserted a fold on the first switched-model request, which the intended #6430 behavior (stated in the PR body) no longer does.
(ai: vllm-qwen/qwen3.8-27b) CI 冲突修复完成(PR #6467,分支 七问:
判定:冲突已解决、分支已同步 master,可进入 CI 重跑。 |
(ai: vllm-qwen/qwen3.8-27b) 七问 summary — PR #6467 red-CI fix (attempt 1/6)
|
33822b5 to
e1a7fbc
Compare
…switch e2e The #6430 model-scoped baseline demotion is a third path into the baselineFloor===0 state the #2313 forward-once escape anticipates: after a mid-lane model switch the cross-model baseline no longer drives the trigger, so the first switched-model request is forwarded to acquire the new model's usage evidence (in the real world the over-window forward 400s and arms the overflow baseline) and the second request folds. The test now asserts both legs: req2 forwards without summarization and settles a fresh same-model baseline; req3 folds before forwarding. Found in PR #6467 review: the old test asserted a fold on the first switched-model request, which the intended #6430 behavior (stated in the PR body) no longer does.
(ai: vllm-qwen/qwen3.8-27b) CI fix: aligned the #663 model-scoping test with the PR's #6430 cross-model demotion — pushed What I did this run:
结构化八问(中文)
收工判定:修复已推送( |
(ai: vllm-qwen/qwen3.8-27b) No action taken — the reported conflict is stale; verified live this run.
Stopping here per the re-verify-first rule. If the in-progress CI pass comes back red, the next wake will handle it. |
ranxianglei
left a comment
There was a problem hiding this comment.
APPROVE
The fix correctly scopes the preflight usage baseline and k̂ estimate to the model that measured them. Both incident cases (#6430: cross-model baseline driving spurious preflight, stale k̂ over-correction) are addressed by a single coherent mechanism: model-scoped baseline demotion (Fix A) and a fresh-measurement cap on the calibrated estimate (Fix B). The tests pin both directions plus the control (no regression). The behavior changes are disclosed in the PR body.
8问
- 是什么问题: 预检大小模型(本地估计 × k̂ + 使用基线)在两个方向上偏离了实测使用量,导致虚假折叠。
- 什么原因导致的: 使用基线只携带路由(origin)来源,没有模型来源;跨模型基线(同路由)在模型切换后仍然驱动触发器。过时的 k̂>1 会膨胀本地估计,超过新鲜的目标以下基线。
- 影响范围与严重程度: 受影响的用户面: 在会话中途切换模型的会话。触发条件: 基线模型与当前请求模型不同,或过时的 k̂>1 膨胀估计。严重程度: 特定条件下有问题(虚假预检折叠, 13.7s-303s 延迟)。
- 怎么修复的: Fix A: 记录测量基线的模型,在触发器中,当基线模型与当前请求模型不同时,将基线降级为 0。Fix B: 当新鲜(同路由+同模型)基线存在且负载的原始估计不大于它时,将校准估计限制在基线以内。
- 是否有回归问题: 审过的既有行为: #663 模型范围流程(已更新测试以反映新的两请求自愈行为), preflight-compress e2e 测试(已更新), golden 文件(已重新生成)。没有发现意外的回归。
- 是否破坏缓存: 不涉及。
- 是否改了设计方向: 不涉及。基线现在也按模型范围化,这与 k̂ 读取门的模型维度一致。
- 是否引入了新的配置: 不涉及。
lastInputTokensModel是一个内部统计字段(与lastInputTokensOrigin一起持久化),不是配置旋钮。
合并判定: 可以合并。
74305b7 to
710a36f
Compare
…switch e2e The #6430 model-scoped baseline demotion is a third path into the baselineFloor===0 state the #2313 forward-once escape anticipates: after a mid-lane model switch the cross-model baseline no longer drives the trigger, so the first switched-model request is forwarded to acquire the new model's usage evidence (in the real world the over-window forward 400s and arms the overflow baseline) and the second request folds. The test now asserts both legs: req2 forwards without summarization and settles a fresh same-model baseline; req3 folds before forwarding. Found in PR #6467 review: the old test asserted a fold on the first switched-model request, which the intended #6430 behavior (stated in the PR body) no longer does.
(ai: vllm-qwen/qwen3.8-27b) Conflict resolved and rebased — new head This wake's conflict was real (unlike the previous one): master moved to
|
(ai: vllm-qwen/qwen3.8-27b) No action taken — this conflict wake is stale; the rebase from the previous run already cleared it. Verified live this run:
Stopping here per the re-verify-first rule; if the in-flight pass on |
ranxianglei
left a comment
There was a problem hiding this comment.
APPROVE
Re-review after rebase: content is identical to the previously reviewed head (same 6 commits, same 14-file diff, +356/-32). The fix correctly scopes the preflight usage baseline and k̂ estimate to the model that measured them. Both incident cases (#6430: cross-model baseline driving spurious preflight, stale k̂ over-correction) are addressed by a single coherent mechanism: model-scoped baseline demotion (Fix A) and a fresh-measurement cap on the calibrated estimate (Fix B). The tests pin both directions plus the control (no regression). The behavior changes are disclosed in the PR body.
8问
- 是什么问题: 预检大小模型(本地估计 × k̂ + 使用基线)在两个方向上偏离了实测使用量,导致虚假折叠。
- 什么原因导致的: 使用基线只携带路由(origin)来源,没有模型来源;跨模型基线(同路由)在模型切换后仍然驱动触发器。过时的 k̂>1 会膨胀本地估计,超过新鲜的目标以下基线。
- 影响范围与严重程度: 受影响的用户面: 在会话中途切换模型的会话。触发条件: 基线模型与当前请求模型不同,或过时的 k̂>1 膨胀估计。严重程度: 特定条件下有问题(虚假预检折叠, 13.7s-303s 延迟)。
- 怎么修复的: Fix A: 记录测量基线的模型,在触发器中,当基线模型与当前请求模型不同时,将基线降级为 0。Fix B: 当新鲜(同路由+同模型)基线存在且负载的原始估计不大于它时,将校准估计限制在基线以内。
- 是否有回归问题: 审过的既有行为: #663 模型范围流程(已更新测试以反映新的两请求自愈行为), preflight-compress e2e 测试(已更新), golden 文件(已重新生成)。没有发现意外的回归。
- 是否破坏缓存: 不涉及。
- 是否改了设计方向: 不涉及。基线现在也按模型范围化,这与 k̂ 读取门的模型维度一致。
- 是否引入了新的配置: 不涉及。
lastInputTokensModel是一个内部统计字段(与lastInputTokensOrigin一起持久化),不是配置旋钮。
合并判定: 可以合并。
Re-review complete on rebased head 710a36f: content identical to previously reviewed head (same 6 commits, same diff). APPROVE posted (comment-type, self-approval blocked by GitHub). 8问 in Chinese included. CI green (30 checks, 0 failed). No small findings. No kernel/ changes. Verdict: mergeable. |
[ework] CI fix verified green ✓ |
1 similar comment
[ework] CI fix verified green ✓ |
710a36f to
b885591
Compare
(ai: vllm-qwen/qwen3.8-27b) Re-verified the live state on this wake — the merge conflict is already resolved (by my previous run), so this is a stale/duplicate wake. No action needed. Live state (verified this run):
八问
结论:合并冲突已于上一轮解决(head |
ranxianglei
left a comment
There was a problem hiding this comment.
APPROVE
Fifth re-review: core fix (Fix A model-scoped baseline demotion + Fix B fresh-measurement cap) unchanged and correct. Two files (cache-ledger.ts, preflight-max-output-tokens.test.ts) dropped from the diff — already merged to master via the merge syncs. One new test commit (64eb2ee) pins the overflow wall in the #2189 429 tests so they keep testing the fail-fast path rather than the identity fast path from #7532 — a correct, well-documented merge-interaction fix with no product behavior change. CI green (30/30).
8问
- 是什么问题: 预检大小模型在两个方向上偏离实测使用量,导致虚假折叠。
- 什么原因导致的: 使用基线缺少模型来源;跨模型基线在模型切换后仍驱动触发器;过时的 k̂>1 膨胀本地估计。
- 影响范围与严重程度: 会话中途切换模型的用户;特定条件下虚假预检折叠。
- 怎么修复的: Fix A: 基线模型≠当前模型时降级为 0。Fix B: 新鲜基线存在时将校准估计限制在基线以内。
- 是否有回归问题: 无。新增测试 commit 是合并交互修复(钉住 overflow wall 以隔离 #7532 快路径),不影响产品行为。
- 是否破坏缓存: 不涉及。
- 是否改了设计方向: 不涉及。
- 是否引入了新的配置: 不涉及。
合并判定: 可以合并。
[ework] CI fix verified green ✓ |
ranxianglei
left a comment
There was a problem hiding this comment.
APPROVE
Sixth re-review: only a new merge sync (no code changes). Diff identical to prior round (12 files, +347/-36). Core fix (Fix A + Fix B) unchanged. CI green (30/30, 0 failed, 0 pending).
8问
- 是什么问题: 预检大小模型在两个方向上偏离实测使用量,导致虚假折叠。
- 什么原因导致的: 使用基线缺少模型来源;跨模型基线在模型切换后仍驱动触发器;过时的 k̂>1 膨胀本地估计。
- 影响范围与严重程度: 会话中途切换模型的用户;特定条件下虚假预检折叠。
- 怎么修复的: Fix A: 基线模型≠当前模型时降级为 0。Fix B: 新鲜基线存在时将校准估计限制在基线以内。
- 是否有回归问题: 无。
- 是否破坏缓存: 不涉及。
- 是否改了设计方向: 不涉及。
- 是否引入了新的配置: 不涉及。
合并判定: 可以合并。
(ai: vllm-qwen/qwen3.8-27b) Re-verified the live state on this wake — the merge conflict is already resolved (by my previous run), so this is a stale/duplicate wake. No action needed. Live state (verified this run):
八问
结论:合并冲突已于上一轮解决(head |
(ai: vllm-qwen/qwen3.8-27b) State unchanged from my previous confirmation (minutes ago) — re-verified live this run:
Why the wakes keep repeating: the mirror's "blocker detected" is triggered by 八问:与上一条确认评论完全一致(无新变化)——冲突已解决、CI 已绿、 |
[ework] CI fix verified green ✓ |
|
Cross-ref for Fix A/B scope: a same-route and same-model poisoning path exists that model scoping cannot filter — #7778. Numbers from 0.1.215: a session alternated session-sized requests (raw 105,994 / billed 195–224k → honest So Fix A (model-scoped baseline demotion) and Fix B (fresh-baseline cap) would both be no-ops here: origin and model match, and Fix B's cap needs The lever that actually stops it is excluding fixed-overhead-dominated samples from the ring (or weighting/mass-gating them), i.e. orthogonal to #6430. |
(ai: vllm-qwen/qwen3.8-27b) Thanks for the cross-reference — verified against the code, the constants match:
So the same-route / same-model poisoning path you describe is real and, as you note, orthogonal to this PR's scope: Fix A (model-scoped baseline demotion) is a no-op when origin+model match, and Fix B (fresh-baseline cap) only engages when (Logged as a cross-reference from an outside contributor; no change to this PR's scope, and nothing here is attributed to the owner.) |
(ai: vllm-qwen/qwen3.8-27b) This wake was a real conflict (not stale) — master moved 105 commits ( What I did:
八问
结论:合并冲突已解决(head |
ranxianglei
left a comment
There was a problem hiding this comment.
APPROVE
Seventh re-review: only a new merge sync (no code changes). Diff identical to prior round (12 files, +347/-36). Core fix (Fix A + Fix B) unchanged. CI green.
8问
- 是什么问题: 预检大小模型在两个方向上偏离实测使用量,导致虚假折叠。
- 什么原因导致的: 使用基线缺少模型来源;跨模型基线在模型切换后仍驱动触发器;过时的 k̂>1 膨胀本地估计。
- 影响范围与严重程度: 会话中途切换模型的用户;特定条件下虚假预检折叠。
- 怎么修复的: Fix A: 基线模型≠当前模型时降级为 0。Fix B: 新鲜基线存在时将校准估计限制在基线以内。
- 是否有回归问题: 无。
- 是否破坏缓存: 不涉及。
- 是否改了设计方向: 不涉及。
- 是否引入了新的配置: 不涉及。
合并判定: 可以合并。
[ework] CI fix verified green ✓ |
Conflict resolution: the four storage-render goldens were regenerated from the merged tree (scripts/update-storage-render-goldens.ts) — they now carry BOTH master's crush-removal metadata digest and this PR's lastInputTokensModel stats digest. src/server.ts and src/server/relay.ts auto-merged clean (disjoint hunks: master's kernelWarnSink/eg_debug vs this PR's preflight baseline model-scoping). Local verification: typecheck clean; golden-storage-render 5/5; issue6430/issue2189/preflight-compress/issue2129 17/17.
(ai: vllm-qwen/qwen3.8-27b) Conflict resolved — master re-synced into the PR branch, final head pushed. What I did this run:
结构化八问
判定:冲突已解决,最终 head |
ranxianglei
left a comment
There was a problem hiding this comment.
APPROVE
Eighth re-review: only a new merge sync (no code changes). Diff identical to prior round (12 files, +347/-36). Core fix (Fix A + Fix B) unchanged. CI green (30/30, 0 failed, 0 pending).
8问
- 是什么问题: 预检大小模型在两个方向上偏离实测使用量,导致虚假折叠。
- 什么原因导致的: 使用基线缺少模型来源;跨模型基线在模型切换后仍驱动触发器;过时的 k̂>1 膨胀本地估计。
- 影响范围与严重程度: 会话中途切换模型的用户;特定条件下虚假预检折叠。
- 怎么修复的: Fix A: 基线模型≠当前模型时降级为 0。Fix B: 新鲜基线存在时将校准估计限制在基线以内。
- 是否有回归问题: 无。
- 是否破坏缓存: 不涉及。
- 是否改了设计方向: 不涉及。
- 是否引入了新的配置: 不涉及。
合并判定: 可以合并。
[ework] CI fix verified green ✓ |
Conflict resolution: the four storage-render goldens were regenerated from the merged tree (scripts/update-storage-render-goldens.ts) after the kernel 0.0.218 'WHEN NOT TO COMPRESS' prompt change landed on master — verified vs master the only delta is this PR's lastInputTokensModel stats digest. src/server.ts / src/server/relay.ts / src/session.ts auto-merged clean (master's image-shed removal + eg_debug fix vs this PR's preflight baseline model-scoping, disjoint hunks). Local verification: typecheck clean; golden-storage-render 5/5; issue6430/issue2189/preflight-compress/issue2129 17/17.
(ai: vllm-qwen/qwen3.8-27b) Second conflict sync done — master re-merged into the PR branch, final head pushed. Master moved again since the last sync (10 new commits: the auto image-shed removal #7693, the eg_debug verbose-response fix, and the kernel 0.0.218 "WHEN NOT TO COMPRESS" prompt gate), which re-dirtied the PR. Same resolution as before:
Note: this is the second master-sync this PR needed (165 commits the first round, 10 the second) — normal churn for a long-lived branch on a fast master, not a defect. 结构化八问
判定:冲突已解决,最终 head |
[ework] CI fix verified green ✓ |
ranxianglei
left a comment
There was a problem hiding this comment.
APPROVE
Ninth re-review: only a new merge sync (no code changes). Diff identical to prior round (12 files, +347/-36). Core fix (Fix A + Fix B) unchanged. CI green (30/30, 0 failed, 0 pending).
8问
- 是什么问题: 预检大小模型在两个方向上偏离实测使用量,导致虚假折叠。
- 什么原因导致的: 使用基线缺少模型来源;跨模型基线在模型切换后仍驱动触发器;过时的 k̂>1 膨胀本地估计。
- 影响范围与严重程度: 会话中途切换模型的用户;特定条件下虚假预检折叠。
- 怎么修复的: Fix A: 基线模型≠当前模型时降级为 0。Fix B: 新鲜基线存在时将校准估计限制在基线以内。
- 是否有回归问题: 无。
- 是否破坏缓存: 不涉及。
- 是否改了设计方向: 不涉及。
- 是否引入了新的配置: 不涉及。
合并判定: 可以合并。
[ework] CI fix verified green ✓ |
Summary
The preflight size model (local estimate × k̂ + usage baseline) diverged from the measured usage in both directions, firing spurious folds (#6430):
Both are one mechanism: the baseline floor and the k̂-scaled estimate must be scoped to the model that measured them, and a fresh measurement must win over a stale calibration.
Fix
Fix A — model-scoped baseline demotion. Record the model that measured the usage baseline (
lastInputTokensModel, set insettleUsageReportand both overflow arms). In the trigger, after the #1933 F2 origin demotion, demote the baseline floor to 0 when the baseline's model differs from the current request's model (both known). Mirrors the k̂ read gate's model dimension (currentCalibrationFactor).Fix B — fresh-measurement cap on the calibrated estimate. When a fresh (same route+model, not demoted) baseline is present and the payload's raw estimate is not bigger than it, cap the calibrated estimate at the baseline. Rationale: the raw estimate is a direct measurement of the current payload; if it is not bigger than what upstream just billed on this exact route+model, the payload has not genuinely grown — the k̂-scaled excess is over-correction. Genuine growth (raw > baseline) leaves the estimate untouched and still folds. A demoted baseline floors at 0 so the cap is a no-op.
Tests
tests/issue6430-preflight-baseline-model.test.ts(new): Fix A (cross-model baseline demoted → no spurious preflight), Fix B (fresh same-model baseline caps a stale k̂ over-correction → no spurious preflight), control (same-model baseline above the window still drives preflight — no regression).tests/issue2129-restart-measurement-state.test.ts: addedlastInputTokensModelto the persist round-trip assertion.Behavior change
Config surface
None.
lastInputTokensModelis an internal stats field (persisted alongsidelastInputTokensOrigin), not a config knob.Closes #6430