Skip to content

[PR] fix(preflight): scope the usage baseline and k̂ estimate to the model that measured them - #6467

Open
ranxianglei wants to merge 14 commits into
masterfrom
2026-11-13_preflight-baseline-model
Open

ranxianglei wants to merge 14 commits into
masterfrom
2026-11-13_preflight-baseline-model

Conversation

@ranxianglei

Copy link
Copy Markdown
Owner

Summary

The preflight size model (local estimate × k̂ + usage baseline) diverged from the measured usage in both directions, firing spurious folds (#6430):

  1. Cross-model baseline (incident case 2, 303s preflight): a usage baseline measured under a prior model on the same route (282K under opus) carried no model provenance, so it survived the DSH: 切换模型后,preflight 在窗口远未满时提前触发压缩 #1933 F2 route demotion and drove the trigger while the current payload's own estimate read far below the target (~55K on a fable lane).
  2. Stale k̂ over-correction (incident case 1, 13.7s stall): a fresh same-route+same-model usage baseline (167K, below the 200K target) was overridden by a stale k̂=1.47 that inflated the local estimate (raw 151K → 223K) past the target.

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 in settleUsageReport and 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: added lastInputTokensModel to the persist round-trip assertion.
  • Verified no regression: issue3645 (calibrated futility), issue1933 (preflight calibration), issue1987 (baseline anchor), issue1841 (futility skip) all green locally.

Behavior change

  • Old: the usage baseline carried only a route (origin) provenance; a cross-model (same-route) baseline drove the trigger. A stale k̂>1 could inflate the estimate past a fresh below-target baseline.
  • New: the baseline is also scoped by model; a cross-model baseline is demoted (the payload's own estimate judges). A fresh same-model baseline caps the calibrated estimate when the raw estimate is not bigger than it.
  • Risk: a session that switches models mid-lane will no longer inherit the prior model's baseline (it re-learns from the new model's first usage report). This is the intended behavior — the prior model's billing is not a valid size model for the new model.

Config surface

None. lastInputTokensModel is an internal stats field (persisted alongside lastInputTokensOrigin), not a config knob.

Closes #6430

@github-actions

github-actions Bot commented Nov 12, 2026 •

Copy link
Copy Markdown
Contributor

📦 Built Package Artifact

Branch: 2026-11-13_preflight-baseline-model (7766e25)

Latest build — install this exact version

npm install -g billion-context@0.0.12629-pr.6467.b93ba13

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
7766e25 billion-context@0.0.12629-pr.6467.b93ba13 build
976dffa billion-context@0.0.12450-pr.6467.4bfb91a build
54f347b billion-context@0.0.12228-pr.6467.238de5e build
7c32a57 billion-context@0.0.11880-pr.6467.801815e build
503eb41 billion-context@0.0.11687-pr.6467.ee51fc3 build
15a059e billion-context@0.0.11452-pr.6467.0982a7e build
7acaab0 billion-context@0.0.11377-pr.6467.e66d17c build
b885591 billion-context@0.0.10982-pr.6467.9fb168b build
710a36f billion-context@0.0.10879-pr.6467.d2294ff build
74305b7 billion-context@0.0.10632-pr.6467.e3d25d8 build

Download artifact

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

Install instructions are refreshed on each push.

@ranxianglei ranxianglei changed the title fix(preflight): scope the usage baseline and k̂ estimate to the model that measured them [PR] fix(preflight): scope the usage baseline and k̂ estimate to the model that measured them Nov 12, 2026
@ranxianglei ranxianglei added bug Something isn't working p2 scope/wiring labels Nov 12, 2026
@ranxianglei
ranxianglei force-pushed the 2026-11-13_preflight-baseline-model branch from 5289944 to 19ab036 Compare November 13, 2026 09:14
ranxianglei pushed a commit that referenced this pull request Nov 13, 2026
…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.
@ranxianglei
ranxianglei force-pushed the 2026-11-13_preflight-baseline-model branch from 2e64cc3 to ad1ff55 Compare November 15, 2026 09:55
ranxianglei pushed a commit that referenced this pull request Nov 15, 2026
…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.
@ranxianglei

Copy link
Copy Markdown
Owner Author

🤖 Powered by ework · qwen3.8-27b

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

CI 冲突修复完成(PR #6467,分支 2026-11-13_preflight-baseline-model)。

七问:

  1. 是什么问题:PR 分支落后 master 228 个提交(领先 4 个),与 base 分支产生合并冲突(merge state dirty),CI 无法合并。

  2. 什么原因:PR 的 4 个提交里有 1 个(2e64cc305a 重新生成 storage-render golden)与 master 同期对同一文件 tests/golden/storage-render/chat.json 的改动撞车——两边都从同一 base 值改了 stateDigest/stateDigestAligned/stats,master 还额外改了 metadata。golden 是持久化会话状态的 SHA-256 摘要,无法手工合并,必须按「master + PR」合并后的代码重新生成。

  3. 怎么处理的:把 PR 分支 rebase 到最新 master(26d9bcc649)。前 3 个提交干净落地;第 4 个提交在 chat.json 冲突。我装了依赖(npm ci)+ 构建 kernel/pi-subagents,跑 scripts/update-storage-render-goldens.ts 按合并后代码重新生成全部 4 个 golden,用生成结果解决冲突,git rebase --continue 完成。

  4. 冲突怎么解的(关键):chat.json 现在是合并态摘要——stateDigest=d3903d5c…(新值,非冲突任一侧)、metadata=0c7d18…(保留 master 的值,因 PR 的 lastInputTokensModel 是 stats 字段、不动 metadata)、stats=99ecef87…(新值,叠加了 master 与 PR 两边改动)。另外 3 个 golden(anthropic/google/responses)master 没动过,重生成后与 PR 原值一致、未变。PR 的逻辑代码一行未改,只解决了 golden 摘要冲突。

  5. 验证了什么:typecheck 干净(exit 0);golden-storage-render.test.ts 5/5 通过(证明重生成正确);preflight 修复测试 + 控制测试(issue6430/2129/3645/1933/1987/1841 + preflight-compress)25/25 通过。全量回归交给远程 CI。

  6. 是否有回归:无。本次只做了 rebase + golden 重生成,PR 的 preflight 逻辑(跨模型 baseline 降级 + 新鲜测量封顶)原样保留;golden 是按合并后代码重新生成的真值,由 storage-render 测试钉住。PR 本身的行为变更(跨模型 baseline 降级、mid-lane 切模型不再继承旧模型 baseline)是作者在 PR 描述里声明过的,非本次引入。

  7. 现在的状态 / 下一步:已 git push --force-with-lease 推回 PR 分支,head 从 2e64cc305a → ad1ff55155。分支现为 4 ahead / 0 behind master,合并冲突已消,等待 CI 在新 head 上重跑。注:镜像 CI 缓存是 2026-11-13 的旧快照(当时多为 skipped/queued),无法据此判断旧 CI 红绿;本次只处理了「合并冲突」这一硬阻塞,CI 结果以新 head 重跑为准。

判定:冲突已解决、分支已同步 master,可进入 CI 重跑。

@ranxianglei

Copy link
Copy Markdown
Owner Author

🤖 Powered by ework · qwen3.8-27b

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

七问 summary — PR #6467 red-CI fix (attempt 1/6)

  1. What failed? 5 test shards failed on run 43701606055 (ubuntu 22/24 shards 1,3; windows 22 shard 2). All 4 failing tests were in tests/issue2189-preflight-billing-block.test.ts (anthropic billing-attribution block, legacy string system, bare-Error 429 fails-fast, genuine 429 replay).

  2. Root cause? The PR's Fix A (cross-model baseline demotion) correctly demotes a usage baseline measured under a different model (tokenizers bill differently across models). The [bug] 订阅登录下 preflight 摘要请求恒 429 rate_limit_error "Error":摘要 system 缺 Claude Code 归属块 #2189 test's setup incidentally relied on a cross-model baseline (300K settled under claude-big, small payload under claude-small) to fire preflight on r2. Under the new behavior that cross-model baseline is correctly demoted, so preflight no longer fires and the 4 billing/429 tests fail. Confirmed PR-caused (not inherited red): the test passes 6/6 on clean master, fails 4/6 on the PR branch.

  3. What did I do? Changed r1's model from claude-big to claude-small (same as r2) in all 4 tests of tests/issue2189-preflight-billing-block.test.ts, so the 300K baseline is same-model and not demoted. Preflight still fires; the test's real purpose (billing-attribution block + 429 handling) is preserved. 4-line test-only change, no production code touched.

  4. How did I verify? The [bug] 订阅登录下 preflight 摘要请求恒 429 rate_limit_error "Error":摘要 system 缺 Claude Code 归属块 #2189 test now passes 6/6 (was 4 fail / 2 pass). The PR's own new test (issue6430-preflight-baseline-model) still passes 3/3. npm run typecheck passes.

  5. Impact (behavior change)? No production behavior change. The PR's cross-model demotion is correct and intended (pinned by the PR's own test, issue6430 Fix A: a cross-model baseline must NOT arm preflight). The fix only aligns the [bug] 订阅登录下 preflight 摘要请求恒 429 rate_limit_error "Error":摘要 system 缺 Claude Code 归属块 #2189 test's setup with that new behavior.

  6. Regressions? None. Test-only change (4 lines). No other test or source file touched.

  7. Decisions needed? None — small mechanical fix consistent with the PR's intended behavior. New CI run started on head 33822b5228 (e2e-native-pi already green; test shards queued).

@ranxianglei
ranxianglei force-pushed the 2026-11-13_preflight-baseline-model branch from 33822b5 to e1a7fbc Compare November 17, 2026 11:30
ranxianglei pushed a commit that referenced this pull request Nov 17, 2026
…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.
@ranxianglei

Copy link
Copy Markdown
Owner Author

🤖 Powered by ework · qwen3.8-27b

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

CI fix: aligned the #663 model-scoping test with the PR's #6430 cross-model demotion — pushed 74305b7050 (single commit, final head, the branch's one full CI pass is now running; its result is not yet verified).

What I did this run:

  1. Re-verified live check state (mirror cache at wake): 3 failing shards on head e1a7fbc1ca — test (ubuntu-latest, 22, 3), test (windows-latest, 22, 2), test (ubuntu-latest, 24, 3); everything else green.
  2. Fetched all 3 job logs: each shard fails on exactly ONE deterministic test — e2e #663 (model scoping): rejection learned for model A keeps model B's 32768 cap at tests/preflight-max-output-tokens.test.ts:387, assertion "second request triggered preflight summaries" (expected ≥1 summary call, got 0). Same failure on all three OS/node shards → not flake.
  3. Root cause: the PR's Fix A demotes a usage baseline measured under a different model. In this test, r2 (same session, model B gpt-6-standard, payload grown over-window) now lands in exactly the state the billion-context 卡死问题 —— 上报材料 usage获取不到导致上下文估计失误 #2313 forward-once escape is designed for: the trigger fires on the payload's own estimate while the cross-model baseline is demoted (baselineFloor === 0 with nonzero lastInputTokens), so the proxy forwards once to acquire model B's evidence instead of folding first (src/server.ts:4067 probeForEvidence). The mock upstream accepts model B, settles a fresh model-B usage baseline, and no summary call happens on r2. The test's r2 expectation predates the PR and assumed the old cross-model baseline inheritance.
  4. Fix (mechanical test alignment — same class as the head commit's [bug] 订阅登录下 preflight 摘要请求恒 429 rate_limit_error "Error":摘要 system 缺 Claude Code 归属块 #2189 alignment): extended the flow by one request. r2 now asserts the evidence forward (reaches upstream, zero summary calls); r3 (same model, still over-window) folds under the fresh trusted model-B baseline and its summaries keep the 32768 cap. The test's real purpose — model A's learned rejection must not strip the cap from model B's summaries — is preserved and still pinned.
  5. Verified locally (targeted): tests/preflight-max-output-tokens.test.ts 6/6 (was 5/6), the PR's own tests/issue6430-preflight-baseline-model.test.ts + tests/issue2189-preflight-billing-block.test.ts + tests/issue2129-restart-measurement-state.test.ts 13/13, tests/preflight-compress.test.ts 4/4, tsc --noEmit clean.
  6. Push discipline: fetched + rebased onto the remote head before pushing (remote was up to date, no concurrent changes), no force-push, no [ework:ci-held] marker on this final head.

结构化八问(中文)

  1. 是什么问题:CI 三个红 shard 实为同一个确定性测试失败——fix: Codex preflight summaries fail with unsupported max_output_tokens #663 model-scoping e2e 测试的第二请求(model B)不再触发 preflight summary(断言期望 ≥1 次 summary 调用,实际 0 次)。
  2. 什么原因导致的:PR 的 Fix A 把「不同模型测得的 usage baseline」降级为不可信([Bug][preflight] 0.1.213: local estimate × k̂ diverges from measured usage both ways → spurious preflight / wrong fold depth #6430 cross-model demotion)。第二请求(model B)的 baseline 被降级后(baselineFloor=0 但 lastInputTokens>0),恰好落入 billion-context 卡死问题 —— 上报材料 usage获取不到导致上下文估计失误 #2313 forward-once 逃生路径的设计场景:trigger 按 payload 自身估计触发,但代理先转发一次获取 model B 的新证据,不先折叠。测试的 r2 断言写于 PR 之前,基于旧的跨模型 baseline 继承行为。
  3. 影响范围与严重程度:仅影响该测试的期望值,无生产行为影响——forward-once 是 billion-context 卡死问题 —— 上报材料 usage获取不到导致上下文估计失误 #2313 的设计自愈路径(成功→settle 新 baseline;4xx→arm overflow),PR 自己的测试(issue6430)已钉住小 payload 的降级场景。
  4. 怎么修复的:把测试流程对齐到新行为(与 head commit 对 [bug] 订阅登录下 preflight 摘要请求恒 429 rate_limit_error "Error":摘要 system 缺 Claude Code 归属块 #2189 测试的对齐同类):r2 断言证据转发(到达上游、零 summary 调用),r3(同模型、仍超窗)在新的可信 model-B baseline 下折叠,且其 summary 保留 32768 cap——测试的真实目的(model A 学到的拒绝不得剥掉 model B summary 的 cap)保持不变且仍被钉住。
  5. 是否有回归问题:无。改动仅测试文件,无 src 变更;同文件 6 个测试 + PR 自有 3 个测试文件 13 个测试 + preflight-compress 4 个测试本地全过;typecheck 干净。
  6. 是否破坏缓存:不涉及——未触碰缓存/重试/增量游标/去重键。
  7. 是否改了设计方向:不涉及——未改 PR 的设计,测试只是对齐到已设计的 forward-once 行为。
  8. 是否引入了新的配置:不涉及。

收工判定:修复已推送(e1a7fbc1ca..74305b7050,单 commit,最终 head),CI 全量 pass 正在新 head 上运行,结果以 CI test lane 为准。

@ranxianglei

Copy link
Copy Markdown
Owner Author

🤖 Powered by ework · qwen3.8-27b

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

No action taken — the reported conflict is stale; verified live this run.

  • Conflict check (live): GitHub API reports mergeable: true; the branch's merge base is exactly the current master head 77fe0b1d63 (the 19:25 [PR] docs(clients): dsh-go host | docs(clients): dsh-go 宿主 #6592 merge) — git merge-base --is-ancestor master branch confirms the branch already sits on the latest master, and git merge-tree against it produces a clean tree with zero conflicting files. An earlier run had already rebased onto this master (this worktree is the conflict-rebase one); the "dirty" flag in the event predates that state.
  • Check state (live, mirror cache @ 12:03:40Z, head 74305b7050): 0 failing — 14 in progress, 1 success, 15 skipped. That is the full CI pass triggered by the test-alignment fix pushed in the previous run; its verdict is still pending.
  • Pushes this run: none (no rebase needed, so nothing to push; no force-push).

Stopping here per the re-verify-first rule. If the in-progress CI pass comes back red, the next wake will handle it.

@ranxianglei ranxianglei left a comment

Copy link
Copy Markdown
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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问

  1. 是什么问题: 预检大小模型(本地估计 × k̂ + 使用基线)在两个方向上偏离了实测使用量,导致虚假折叠。
  2. 什么原因导致的: 使用基线只携带路由(origin)来源,没有模型来源;跨模型基线(同路由)在模型切换后仍然驱动触发器。过时的 k̂>1 会膨胀本地估计,超过新鲜的目标以下基线。
  3. 影响范围与严重程度: 受影响的用户面: 在会话中途切换模型的会话。触发条件: 基线模型与当前请求模型不同,或过时的 k̂>1 膨胀估计。严重程度: 特定条件下有问题(虚假预检折叠, 13.7s-303s 延迟)。
  4. 怎么修复的: Fix A: 记录测量基线的模型,在触发器中,当基线模型与当前请求模型不同时,将基线降级为 0。Fix B: 当新鲜(同路由+同模型)基线存在且负载的原始估计不大于它时,将校准估计限制在基线以内。
  5. 是否有回归问题: 审过的既有行为: #663 模型范围流程(已更新测试以反映新的两请求自愈行为), preflight-compress e2e 测试(已更新), golden 文件(已重新生成)。没有发现意外的回归。
  6. 是否破坏缓存: 不涉及。
  7. 是否改了设计方向: 不涉及。基线现在也按模型范围化,这与 k̂ 读取门的模型维度一致。
  8. 是否引入了新的配置: 不涉及。lastInputTokensModel 是一个内部统计字段(与 lastInputTokensOrigin 一起持久化),不是配置旋钮。

合并判定: 可以合并。

@ranxianglei

Copy link
Copy Markdown
Owner Author

🤖 Powered by ework · qwen3.8-27b

Review complete: APPROVE posted on PR #6467 (comment-type review, self-approval blocked by GitHub). 8问 in Chinese included. CI green (30/30 checks, 0 failed). No small findings to fix on the spot. No kernel/ changes. Verdict: mergeable.

@ranxianglei
ranxianglei force-pushed the 2026-11-13_preflight-baseline-model branch from 74305b7 to 710a36f Compare November 18, 2026 19:29
ranxianglei pushed a commit that referenced this pull request Nov 18, 2026
…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.
@ranxianglei

Copy link
Copy Markdown
Owner Author

🤖 Powered by ework · qwen3.8-27b

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

Conflict resolved and rebased — new head 710a36f2, CI pass now running.

This wake's conflict was real (unlike the previous one): master moved to a446a3c1 (the #6827 batch11-wave11 merge), whose golden-regen commit 75a45380 (#6775 persisted fields) collided with this PR's own golden-regen commit d8127c60 (persisted lastInputTokensModel field) in the 4 tests/golden/storage-render/*.json files.

  1. What was wrong: base-branch conflict on the 4 storage-render goldens — both sides had regenerated the same digest fields from different code trees (master: [PR] fix(persist): keep k̂ model provenance and the emergency-shrink marker across restarts #6775 fields; PR: lastInputTokensModel).
  2. How resolved: rebased all 6 PR commits onto origin/master; for the goldens, took master's side as placeholder and regenerated from the merged code with the repo's own mechanism (node --import tsx scripts/update-storage-render-goldens.ts) — the same "take master, regenerate below" precedent master itself used in 307337c7.
  3. Resolution correctness: the regenerated stateDigest/stateDigestAligned/sectionDigests.stats are a genuine third value, distinct from both sides (they hash the merged persisted state carrying BOTH [PR] fix(persist): keep k̂ model provenance and the emergency-shrink marker across restarts #6775's fields and lastInputTokensModel); all per-turn wire digests unchanged — outbound wire untouched, matching both sides' stated intent.
  4. Verification (local, targeted): tests/golden-storage-render.test.ts 5/5 on the final tree; the PR's own suites (preflight-max-output-tokens incl. the fix: Codex preflight summaries fail with unsupported max_output_tokens #663 model-scoping flow, issue6430, issue2189, issue2129) 11/11; tsc --noEmit clean. Full-suite verdict = the CI pass now running.
  5. Push: one force-push 74305b705 → 710a36f2 (explicitly authorized for this conflict-rebase; remote head verified unchanged before push; no CI-hold marker — this is the branch's one full CI pass).
  6. Live state after push: GitHub API confirms head 710a36f2a, mergeable: true, state open; checks pending on the new head.
  7. Notes: the workdir had been wiped between runs — remotes/checkout rebuilt from origin before starting. No design decisions needed, no gates tripped, no other files touched.

@ranxianglei

Copy link
Copy Markdown
Owner Author

🤖 Powered by ework · qwen3.8-27b

(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:

  • No conflict: branch head is 710a36f2a (the rebased head pushed in the previous run); master is still at a446a3c1c, the branch sits directly on it (merge-base --is-ancestor = yes), and git merge-tree against master is clean — zero conflicting files. GitHub API confirms mergeable: true on head 710a36f2a.
  • CI: the mirror cache still reports the pre-rebase head 74305b705 (its poller hasn't picked up the new head yet), so I can't yet state the verdict for 710a36f2a — the full CI pass triggered by the rebase push is in flight. mergeable_state: blocked right now reflects pending checks, not a conflict.

Stopping here per the re-verify-first rule; if the in-flight pass on 710a36f2a comes back red, the next wake will handle it.

@ranxianglei ranxianglei left a comment

Copy link
Copy Markdown
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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问

  1. 是什么问题: 预检大小模型(本地估计 × k̂ + 使用基线)在两个方向上偏离了实测使用量,导致虚假折叠。
  2. 什么原因导致的: 使用基线只携带路由(origin)来源,没有模型来源;跨模型基线(同路由)在模型切换后仍然驱动触发器。过时的 k̂>1 会膨胀本地估计,超过新鲜的目标以下基线。
  3. 影响范围与严重程度: 受影响的用户面: 在会话中途切换模型的会话。触发条件: 基线模型与当前请求模型不同,或过时的 k̂>1 膨胀估计。严重程度: 特定条件下有问题(虚假预检折叠, 13.7s-303s 延迟)。
  4. 怎么修复的: Fix A: 记录测量基线的模型,在触发器中,当基线模型与当前请求模型不同时,将基线降级为 0。Fix B: 当新鲜(同路由+同模型)基线存在且负载的原始估计不大于它时,将校准估计限制在基线以内。
  5. 是否有回归问题: 审过的既有行为: #663 模型范围流程(已更新测试以反映新的两请求自愈行为), preflight-compress e2e 测试(已更新), golden 文件(已重新生成)。没有发现意外的回归。
  6. 是否破坏缓存: 不涉及。
  7. 是否改了设计方向: 不涉及。基线现在也按模型范围化,这与 k̂ 读取门的模型维度一致。
  8. 是否引入了新的配置: 不涉及。lastInputTokensModel 是一个内部统计字段(与 lastInputTokensOrigin 一起持久化),不是配置旋钮。

合并判定: 可以合并。

@ranxianglei

Copy link
Copy Markdown
Owner Author

🤖 Powered by ework · qwen3.8-27b

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.

@ranxianglei

Copy link
Copy Markdown
Owner Author

🤖 Powered by ework · qwen3.8-27b

[ework] CI fix verified green ✓

1 similar comment
@ranxianglei

Copy link
Copy Markdown
Owner Author

🤖 Powered by ework · qwen3.8-27b

[ework] CI fix verified green ✓

@ranxianglei ranxianglei mentioned this pull request Nov 19, 2026
@ranxianglei
ranxianglei force-pushed the 2026-11-13_preflight-baseline-model branch from 710a36f to b885591 Compare November 19, 2026 11:52
@ranxianglei

Copy link
Copy Markdown
Owner Author

🤖 Powered by ework · qwen3.8-27b

(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):

  • Master has NOT moved (still 045228cfa3e).
  • PR branch head is 503eb419ca7 (the merge from my previous run) and contains all of master (0 master commits not in the PR head) → no conflict possible.
  • Direct GitHub API read: mergeable: True (conflict cleared).
  • Mirror cache is lagging (still shows old head 15a059e7ee + the 3 old failures); the new CI run on 503eb419ca7 will register shortly. As noted last run, the new master includes the inherited-red fix (PR [PR] fix: preflight one-shot gate must not block a replaced epoch's first fold (#7545) #7558), so the new CI should come back green.

八问

  1. 是什么问题:系统再次报告 PR 与 base 冲突(merge state: dirty),但这是上一轮已解决的重复/过期事件。
  2. 什么原因导致的:上一轮已把 master(045228cfa3e)merge 进 PR 分支(head 503eb419ca7),冲突已解决;master 此后未再移动,故无新冲突。
  3. 影响范围与严重程度:无——PR 已可合并(mergeable: True),不阻塞合并。
  4. 怎么修复的:本轮无需修复(上一轮已修);本轮仅重新验证 live 状态,确认冲突已解决、master 未再移动。
  5. 是否有回归问题:不涉及(本轮无代码改动)。
  6. 是否破坏缓存:不涉及。
  7. 是否改了设计方向:不涉及。
  8. 是否引入了新的配置:不涉及。

结论:合并冲突已于上一轮解决(head 503eb419ca7,mergeable: True),master 未再移动,本轮为重复事件,无需任何操作;新 CI 应转绿(新 master 已含继承红修复 PR #7558)。

@ranxianglei ranxianglei left a comment

Copy link
Copy Markdown
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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问

  1. 是什么问题: 预检大小模型在两个方向上偏离实测使用量,导致虚假折叠。
  2. 什么原因导致的: 使用基线缺少模型来源;跨模型基线在模型切换后仍驱动触发器;过时的 k̂>1 膨胀本地估计。
  3. 影响范围与严重程度: 会话中途切换模型的用户;特定条件下虚假预检折叠。
  4. 怎么修复的: Fix A: 基线模型≠当前模型时降级为 0。Fix B: 新鲜基线存在时将校准估计限制在基线以内。
  5. 是否有回归问题: 无。新增测试 commit 是合并交互修复(钉住 overflow wall 以隔离 #7532 快路径),不影响产品行为。
  6. 是否破坏缓存: 不涉及。
  7. 是否改了设计方向: 不涉及。
  8. 是否引入了新的配置: 不涉及。

合并判定: 可以合并。

@ranxianglei

Copy link
Copy Markdown
Owner Author

🤖 Powered by ework · qwen3.8-27b

Fifth re-review on head 503eb41: core fix unchanged. New test commit pins overflow wall for #2189 429 tests (merge interaction with #7532, no product change). Two files dropped from diff (already in master). APPROVE posted. CI green (30/30). Mergeable.

@ranxianglei

Copy link
Copy Markdown
Owner Author

🤖 Powered by ework · qwen3.8-27b

[ework] CI fix verified green ✓

@ranxianglei ranxianglei left a comment

Copy link
Copy Markdown
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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问

  1. 是什么问题: 预检大小模型在两个方向上偏离实测使用量,导致虚假折叠。
  2. 什么原因导致的: 使用基线缺少模型来源;跨模型基线在模型切换后仍驱动触发器;过时的 k̂>1 膨胀本地估计。
  3. 影响范围与严重程度: 会话中途切换模型的用户;特定条件下虚假预检折叠。
  4. 怎么修复的: Fix A: 基线模型≠当前模型时降级为 0。Fix B: 新鲜基线存在时将校准估计限制在基线以内。
  5. 是否有回归问题: 无。
  6. 是否破坏缓存: 不涉及。
  7. 是否改了设计方向: 不涉及。
  8. 是否引入了新的配置: 不涉及。

合并判定: 可以合并。

@ranxianglei

Copy link
Copy Markdown
Owner Author

🤖 Powered by ework · qwen3.8-27b

Sixth re-review on head 7c32a57: merge sync only, no code changes. Diff identical. APPROVE posted. CI green (30/30). Mergeable.

@ranxianglei

Copy link
Copy Markdown
Owner Author

🤖 Powered by ework · qwen3.8-27b

(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):

  • Master has NOT moved (still 85afa7b21).
  • PR branch head is 7c32a57bc (the merge from my previous run) and contains all of master (0 master commits not in the PR head) → no conflict possible.
  • Direct GitHub API read: mergeable: True (conflict cleared).
  • CI is green on the new head (mirror cache: 0 failed, 0 pending, 30 total).
  • mergeable_state: blocked is from branch protection (required review), not a conflict — that's a human-only step.

八问

  1. 是什么问题:系统再次报告 PR 与 base 冲突(merge state: dirty),但这是上一轮已解决的重复/过期事件。
  2. 什么原因导致的:上一轮已把 master(85afa7b21)merge 进 PR 分支(head 7c32a57bc),冲突已解决;master 此后未再移动,故无新冲突。
  3. 影响范围与严重程度:无——PR 已可合并(mergeable: True),CI 已绿,不阻塞。
  4. 怎么修复的:本轮无需修复(上一轮已修);本轮仅重新验证 live 状态,确认冲突已解决、CI 已绿。
  5. 是否有回归问题:不涉及(本轮无代码改动)。
  6. 是否破坏缓存:不涉及。
  7. 是否改了设计方向:不涉及。
  8. 是否引入了新的配置:不涉及。

结论:合并冲突已于上一轮解决(head 7c32a57bc,mergeable: True),master 未再移动,CI 已绿,本轮为重复事件,无需任何操作;mergeable_state: blocked 是分支保护(需人工 review),非冲突,属 human-only 步骤。

@ranxianglei

Copy link
Copy Markdown
Owner Author

🤖 Powered by ework · qwen3.8-27b

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

State unchanged from my previous confirmation (minutes ago) — re-verified live this run:

  • Master still 85afa7b21 (not moved); PR head 7c32a57bc contains all of master (0 commits behind) → no conflict.
  • mergeable: True; CI green (0 failed, 0 pending, 30 total).

Why the wakes keep repeating: the mirror's "blocker detected" is triggered by mergeable_state: blocked — but that state here is branch protection (required review), not a merge conflict. The conflict is resolved and CI is green; the only remaining step is a human review/merge, which is human-only and outside this auto-fix lane. No further action from me until a human reviews/merges.

八问:与上一条确认评论完全一致(无新变化)——冲突已解决、CI 已绿、blocked 为分支保护(需人工 review),非冲突,属 human-only 步骤。

@ranxianglei

Copy link
Copy Markdown
Owner Author

🤖 Powered by ework · qwen3.8-27b

[ework] CI fix verified green ✓

@Maluslock

Copy link
Copy Markdown

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 k̂ ≈ 2.0–2.11) with three 2-message host side calls (billed 10,663–10,695, local est ≈2,540 → sample ≈4.2). Because CALIBRATION_SAMPLE_WINDOW = 3, the side bars evicted every genuine sample, k̂ jumped 2.31 → CLAMP_MAX 4.00, and the next real payload was judged 419,196 against a 244,800 target → futile round (#1841) → non-retryable 413.

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 raw <= baseline, which holds (104,799 vs a baseline the same side calls had already clobbered from 206,312 down to 10,695 — capping at that would under-estimate by ~20×).

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.

@ranxianglei

Copy link
Copy Markdown
Owner Author

🤖 Powered by ework · qwen3.8-27b

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

Thanks for the cross-reference — verified against the code, the constants match:

  • CALIBRATION_SAMPLE_WINDOW = 3 (src/cache-ledger.ts:1802) — the ring keeps only the last 3 samples, so three fixed-overhead-dominated side calls evict every genuine sample.
  • CALIBRATION_CLAMP_MAX = 4 (src/cache-ledger.ts:1799) — k̂ clamps to 4.00.
  • Ring eviction ring.values.shift() (src/cache-ledger.ts:1857).

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 raw <= baseline — which the already-clobbered baseline defeats. This PR stays scoped to model-scoping (Fix A/B); the ring-exclusion / mass-gating lever is separate work, tracked under #7778 (orthogonal to #6430).

(Logged as a cross-reference from an outside contributor; no change to this PR's scope, and nothing here is attributed to the owner.)

@ranxianglei

Copy link
Copy Markdown
Owner Author

🤖 Powered by ework · qwen3.8-27b

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

This wake was a real conflict (not stale) — master moved 105 commits (85afa7b21 → 4cad86035b3) since my last sync, so the PR branch was behind and conflicted.

What I did:

  1. Re-verified live: master at 4cad86035b3, PR head 7c32a57bc was 105 commits behind → real conflict.
  2. Reset my local branch (another process had moved it back to an ancestor commit 1e357bf2d66) to the remote PR head 7c32a57bc.
  3. Merged origin/master (4cad86035b3) into the PR branch. Only the 4 storage-render golden files conflicted (digest values).
  4. Resolved by regenerating the goldens with scripts/update-storage-render-goldens.ts on the merged code (not picking a side).
  5. Verified locally: npm run typecheck clean, npm run build OK, tests/golden-storage-render.test.ts 5/5.
  6. Pushed the merge (fast-forward, no force). New head 54f347b6960.
  7. Confirmed via GitHub API: mergeable: True (conflict cleared).

八问

  1. 是什么问题:master 前进了 105 个 commit,PR 分支落后并与之冲突(4 个 storage-render golden 文件的 digest 值)。
  2. 什么原因导致的:master 持续前进([PR] eg cleanup: identity row persistence on arm + eg new DB 7-table creation gate + kv 256 cap + flag default reverted to 0 | eg 扫尾:arm 时身份行落地 + eg 新库 7 表创建门 + kv 256 上限 + flag 默认值改回 0 (#7735/#7737) #7738 等合入),PR 分支停在 7c32a57bc(上次同步 85afa7b21),两边的 golden digest 都变了,产生内容冲突。
  3. 影响范围与严重程度:仅阻塞合并(merge state: dirty),不影响 PR 的功能正确性;CI 之前已绿。
  4. 怎么修复的:把 origin/master merge 进 PR 分支,4 个 golden 冲突用 scripts/update-storage-render-goldens.ts 在合并后的代码上重新生成(不选边),本地 typecheck+build+golden 测试全过后推送。
  5. 是否有回归问题:不涉及——只重新生成 golden(反映 master 的 storage-render 输出变化),未改动 PR 的逻辑代码;typecheck/build/golden 测试全绿。
  6. 是否破坏缓存:不涉及。
  7. 是否改了设计方向:不涉及。
  8. 是否引入了新的配置:不涉及。

结论:合并冲突已解决(head 54f347b6960,mergeable: True),PR 分支现已包含全部 master(4cad86035b3);mergeable_state: blocked 是分支保护(需人工 review),非冲突,属 human-only 步骤。新 CI 会在 54f347b6960 上运行。

@ranxianglei ranxianglei left a comment

Copy link
Copy Markdown
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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问

  1. 是什么问题: 预检大小模型在两个方向上偏离实测使用量,导致虚假折叠。
  2. 什么原因导致的: 使用基线缺少模型来源;跨模型基线在模型切换后仍驱动触发器;过时的 k̂>1 膨胀本地估计。
  3. 影响范围与严重程度: 会话中途切换模型的用户;特定条件下虚假预检折叠。
  4. 怎么修复的: Fix A: 基线模型≠当前模型时降级为 0。Fix B: 新鲜基线存在时将校准估计限制在基线以内。
  5. 是否有回归问题: 无。
  6. 是否破坏缓存: 不涉及。
  7. 是否改了设计方向: 不涉及。
  8. 是否引入了新的配置: 不涉及。

合并判定: 可以合并。

@ranxianglei

Copy link
Copy Markdown
Owner Author

🤖 Powered by ework · qwen3.8-27b

Seventh re-review on head 54f347b: merge sync only, no code changes. Diff identical. APPROVE posted. CI green. Mergeable.

@ranxianglei

Copy link
Copy Markdown
Owner Author

🤖 Powered by ework · qwen3.8-27b

[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.
@ranxianglei

Copy link
Copy Markdown
Owner Author

🤖 Powered by ework · qwen3.8-27b

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

Conflict resolved — master re-synced into the PR branch, final head pushed.

What I did this run:

  1. Verified live state first: PR head 54f347b6960 (last master sync at 4cad86035b3) vs master now at 5bb3eb2cd9a — 165 commits apart, merge state dirty. All CI checks on the old head were skipped (consequence of the conflict, not a code failure).
  2. Merged origin/master (5bb3eb2cd9a) into the branch — following the branch's established merge-sync pattern (its history is a chain of merge: sync origin/master (…) commits, no rebase).
  3. Conflicts were exactly the 4 storage-render goldens (tests/golden/storage-render/{anthropic,chat,google,responses}.json): both sides had regenerated them — master for the crush removal (metadata digest change), this PR for the persisted lastInputTokensModel field (stats digest change). src/server.ts and src/server/relay.ts auto-merged cleanly (disjoint hunks: master's kernelWarnSink + eg_debug evidence table vs this PR's preflight baseline model-scoping).
  4. Resolved the goldens by regeneration, not by picking a side: ran node --import tsx scripts/update-storage-render-goldens.ts on the merged tree (fresh npm install + full build, kernel dist current). Verified the result is the true union: vs master the only delta is the stats digest (this PR's lastInputTokensModel); vs the PR's old head the only delta is the metadata digest (master's crush removal).
  5. Local verification (targeted, per local-testing discipline): npm run typecheck clean; tests/golden-storage-render.test.ts 5/5; the PR's preflight suites (issue6430-preflight-baseline-model, issue2189-preflight-billing-block, preflight-compress, issue2129-restart-measurement-state) 17/17.
  6. Pushed the final head 976dffaf7fb (no [ework:ci-held] marker — this is the branch's one full CI pass, now running). Re-fetched before push; remote head unchanged, clean non-force push.
  7. Post-push live check: mergeable: true (conflict gone; mergeable_state: blocked is the normal pre-approval state). No decision needed, no gates hit.

结构化八问

  1. 是什么问题:PR [PR] fix(preflight): scope the usage baseline and k̂ estimate to the model that measured them #6467 分支与 master 产生合并冲突(merge state dirty),导致 PR 不可合并、CI 全部 skipped。
  2. 什么原因导致的:分支最后一次同步停在 4cad86035b3,之后 master 前进了 165 个提交;双方各自重生了同一组 storage-render golden 文件——master 因移除 crush 改了 metadata digest,本 PR 因新增持久化字段 lastInputTokensModel 改了 stats digest,digest 值在同一行上直接冲突。
  3. 影响范围与严重程度:仅影响本 PR 的可合并性,不涉及任何线上行为;不解决则 PR 无法合并、CI 无法运行。
  4. 怎么修复的:按分支既有的 merge-sync 模式把 origin/master(5bb3eb2cd9a)合入分支;golden 冲突不手挑任一侧 digest,而是从合并后的代码重新生成(scripts/update-storage-render-goldens.ts),结果经双向 diff 验证是两侧变更的真并集;src/server.ts/src/server/relay.ts 由 git 自动合并(双方 hunk 不重叠),已逐一确认两侧改动都在。
  5. 是否有回归问题:无。合并本身不引入任何语义变更;typecheck 干净,golden 测试 5/5,本 PR 的 preflight 相关 17 个测试全过;自动合并文件里 master 侧(kernelWarnSink、eg_debug)与本 PR 侧(preflight 模型 scoping)的改动均已核实保留。
  6. 是否破坏缓存:不涉及——未触碰任何缓存/重试/增量游标/去重键逻辑;golden digest 变化是测试快照的有意更新(持久化状态的测试快照),不是运行时缓存。
  7. 是否改了设计方向:不涉及——纯冲突同步,无架构/边界/数据流变化。
  8. 是否引入了新的配置:不涉及——本次同步自身不引入新配置;随 master 带入的新配置(如 close-object-guard CI 门、pluginFullResendWatermark 默认值回 0)已在各自原 PR 中披露。

判定:冲突已解决,最终 head 976dffaf7fb 已推送(无 ci-held 标记,全量 CI 运行中),merge state 已实测转干净(mergeable: true)。等 CI 绿 + 人工合并。

@ranxianglei ranxianglei left a comment

Copy link
Copy Markdown
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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问

  1. 是什么问题: 预检大小模型在两个方向上偏离实测使用量,导致虚假折叠。
  2. 什么原因导致的: 使用基线缺少模型来源;跨模型基线在模型切换后仍驱动触发器;过时的 k̂>1 膨胀本地估计。
  3. 影响范围与严重程度: 会话中途切换模型的用户;特定条件下虚假预检折叠。
  4. 怎么修复的: Fix A: 基线模型≠当前模型时降级为 0。Fix B: 新鲜基线存在时将校准估计限制在基线以内。
  5. 是否有回归问题: 无。
  6. 是否破坏缓存: 不涉及。
  7. 是否改了设计方向: 不涉及。
  8. 是否引入了新的配置: 不涉及。

合并判定: 可以合并。

@ranxianglei

Copy link
Copy Markdown
Owner Author

🤖 Powered by ework · qwen3.8-27b

Eighth re-review on head 976dffa: merge sync only, no code changes. Diff identical. APPROVE posted. CI green (30/30). Mergeable.

@ranxianglei

Copy link
Copy Markdown
Owner Author

🤖 Powered by ework · qwen3.8-27b

[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.
@ranxianglei

Copy link
Copy Markdown
Owner Author

🤖 Powered by ework · qwen3.8-27b

(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:

  1. Verified live first: PR head 976dffaf7fb (my previous sync), master now at bc0d6e996e1, merge state dirty.
  2. Merged origin/master (bc0d6e996e1) into the branch — the branch's established merge-sync pattern.
  3. Conflicts were again exactly the 4 storage-render goldens — master's kernel prompt change rewrites the per-turn wire digests, so both sides' goldens diverged on the same lines. src/server.ts, src/server/relay.ts, src/session.ts auto-merged cleanly (disjoint hunks: master's image-shed removal + imageCountCaps field deletion vs this PR's preflight baseline model-scoping + lastInputTokensModel).
  4. Regenerated the goldens from the merged tree (fresh npm install + full build with kernel 0.0.218, then scripts/update-storage-render-goldens.ts). Verified vs master the only delta is this PR's lastInputTokensModel stats digest — master's new prompt/state digests are carried through untouched.
  5. Local verification (targeted): typecheck clean; golden-storage-render 5/5; the PR's preflight suites (issue6430, issue2189, preflight-compress, issue2129) 17/17.
  6. Pushed final head 7766e25c0ff (no [ework:ci-held] marker — the branch's one full CI pass, now running). Re-fetched before push; remote head unchanged, clean non-force push.
  7. Post-push live check: mergeable: true (conflict gone; blocked is the normal pre-approval state). No decision needed, no gates hit.

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.


结构化八问

  1. 是什么问题:PR [PR] fix(preflight): scope the usage baseline and k̂ estimate to the model that measured them #6467 分支再次与 master 冲突(merge state dirty)——上次同步后 master 又前进了 10 个提交(自动 image-shed 移除、eg_debug 修复、kernel 0.0.218 压缩提示词新增 "WHEN NOT TO COMPRESS" 门)。
  2. 什么原因导致的:master 侧的 kernel 提示词变更重写了 storage-render golden 的逐轮 wire digest,与本 PR 新增 lastInputTokensModel 字段导致的 stats digest 变化落在同一组 golden 文件的同一行上,直接冲突;代码文件(server.ts/relay.ts/session.ts)双方 hunk 不重叠,git 自动合并。
  3. 影响范围与严重程度:仅影响本 PR 的可合并性,不涉及线上行为;不解决则 PR 无法合并、CI 无法运行。
  4. 怎么修复的:按分支既有的 merge-sync 模式把 origin/master(bc0d6e996e1)合入;golden 冲突不手挑任一侧,从合并后代码重新生成(先完整重建 kernel 0.0.218 的 dist 再生成),结果经与 master 的 diff 验证只多出本 PR 的 stats digest——是两侧变更的真并集。
  5. 是否有回归问题:无。合并不引入语义变更;已核实本 PR 侧改动(preflight 模型 scoping:baselineModel 降级、rawTextEstimate 封顶、lastInputTokensModel 持久化)与 master 侧改动(image-shed 移除、imageCountCaps 字段删除、提示词门)全部在位;typecheck 干净,golden 5/5,preflight 相关 17/17 全过。
  6. 是否破坏缓存:不涉及——未触碰缓存/重试/增量游标/去重键逻辑;golden digest 变化是测试快照的有意更新。
  7. 是否改了设计方向:不涉及——纯冲突同步,无架构/数据流变化。
  8. 是否引入了新的配置:不涉及——本次同步自身不引入新配置;随 master 带入的变更(如 image-shed 移除后 network.wsOutboundBytes 的语义变化)已在各自原 PR 中披露。

判定:冲突已解决,最终 head 7766e25c0ff 已推送(无 ci-held 标记,全量 CI 运行中),merge state 已实测转干净(mergeable: true)。等 CI 绿 + 人工合并。

@ranxianglei

Copy link
Copy Markdown
Owner Author

🤖 Powered by ework · qwen3.8-27b

[ework] CI fix verified green ✓

@ranxianglei ranxianglei left a comment

Copy link
Copy Markdown
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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问

  1. 是什么问题: 预检大小模型在两个方向上偏离实测使用量,导致虚假折叠。
  2. 什么原因导致的: 使用基线缺少模型来源;跨模型基线在模型切换后仍驱动触发器;过时的 k̂>1 膨胀本地估计。
  3. 影响范围与严重程度: 会话中途切换模型的用户;特定条件下虚假预检折叠。
  4. 怎么修复的: Fix A: 基线模型≠当前模型时降级为 0。Fix B: 新鲜基线存在时将校准估计限制在基线以内。
  5. 是否有回归问题: 无。
  6. 是否破坏缓存: 不涉及。
  7. 是否改了设计方向: 不涉及。
  8. 是否引入了新的配置: 不涉及。

合并判定: 可以合并。

@ranxianglei

Copy link
Copy Markdown
Owner Author

🤖 Powered by ework · qwen3.8-27b

Ninth re-review on head 7766e25: merge sync only, no code changes. Diff identical. APPROVE posted. CI green (30/30). Mergeable.

@ranxianglei

Copy link
Copy Markdown
Owner Author

🤖 Powered by ework · qwen3.8-27b

[ework] CI fix verified green ✓

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

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Bug][preflight] 0.1.213: local estimate × k̂ diverges from measured usage both ways → spurious preflight / wrong fold depth

2 participants