Skip to content

[PR] fix: session-level compress.modelContextLimit now sizes every window consumer (#5937) - #5944

Open
ranxianglei wants to merge 4 commits into
masterfrom
2026-11-08_honour-compress-modelcontext-limit
Open

ranxianglei wants to merge 4 commits into
masterfrom
2026-11-08_honour-compress-modelcontext-limit

Conversation

@ranxianglei

Copy link
Copy Markdown
Owner

Closes #5937

A session-level compress.modelContextLimit was honoured by the judging chain (preflight limit / headroom) but ignored by three window consumers, so a 450K cap could never stop an over-cap body (#5885 defect-4: 2M-token outbound, 31 preflight rounds chasing a deficit measured against the wrong wall):

  1. preflight post-fold fit proof (nativeFitAfterClamp) judged against the RAW resolved native window.
  2. relay egress fuse sized every declared window through its 1M anti-guess floor, so an explicit sub-1M cap could never doom a body.
  3. DSH native plugin lane: effectiveContextWindow read only the cached model info — both the host-side oversize gate and the x-bili-plugin-context-window stamp ([dsh-native] takeover-gate refusal (threw state) fails open with the FULL uncompressed transcript; a >window local history dies upstream with 400 (maximum context length) #2924) ignored the key entirely.

Changes

config surface

No new keys. Semantics extension of existing compress.modelContextLimit: it now governs the token-measured egress guards in addition to the preflight fold/headroom. Window priority, highest first: upstream 400 evidence (overflow arm) > this key > registry/native resolution > top-level modelContextLimit fallback. Route/model-level compress overrides unchanged (proxy-side only).

Behavior changes (old → new)

  1. Egress fuse bar for sessions carrying an explicit cap: max(cap, 1M) × 7.5 B/tok → cap × 7.5 B/tok (min 2 MB). Bodies between the two bars that used to forward now get a local 413 naming compress.modelContextLimit. Rationale: an explicit declaration is a deliberate operator wall, not the wrong-small guess the floor exists for (Context Window Overflow Issue Summary: Raw Requests Sent Directly to Upstream Rejected + Local Intercept Cooldown Lockin | 上下文超窗问题汇总:请求裸冲上游被拒 + 本地拦截冷却锁死会话(统一分析入口) #4079).
  2. Preflight forward-once fit proof: fires on the operator cap even when the native window is unknown, and drops its bar to the cap when cap < native. Rationale: a body over the operator's declared wall can never fit even if it fits the raw native window.
  3. DSH plugin lane: oversize gate + x-bili-plugin-context-window reflect the global cap instead of only the cached model info. Rationale: the key is documented as the effective window; the incident showed the plugin lane ignoring it end-to-end.
  4. Follow-up needed once this lands: PR [PR] Over-window requests no longer sent raw upstream: three forwarding gates metered by actual outbound body size + 32 MiB c | 超窗请求不再裸发上游:三道转发闸按真实出站体计量 + 大请求 32MiB 成本带准入 (#5000 #4543 #5885 #5794) #5932's armMeasuredBar/gateMeasuredBar (+ its relay fuse token tier) still use raw resolvedNativeWindow; they need a 2-line rewire to meteringWindow ?? limit. Not done here to avoid landing dependent code on another thread's open branch.

Tests

New tests/issue5937-operator-window.test.ts: main-path pin ([window] base=450000, [headroom] 450000→337500, stamps), fuse both-ways (over-cap 413 / under-cap forwards — verified to FAIL against master relay.ts), dsh-native resolution rows (abs/pct/no-info/garbage). Targeted suites green locally: issue4079-egress-window-fuse, preflight-client-abort, compress-settings, dsh-native, issue5191-arm-judge-line, headroom-behavior files, context-overflow, side-request-isolation, issue2317-route-miss-diagnostics. Full suite = CI.

No kernel/ changes; metadata key is additive (no persistence format change).

@github-actions

github-actions Bot commented Nov 8, 2026 •

Copy link
Copy Markdown
Contributor

📦 Built Package Artifact

Branch: 2026-11-08_honour-compress-modelcontext-limit (2d908fc)

Latest build — install this exact version

npm install -g billion-context@0.0.12502-pr.5944.861d013

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
2d908fc billion-context@0.0.12502-pr.5944.861d013 build
4d89245 billion-context@0.0.11694-pr.5944.efc9998 build
7e1bb72 billion-context@0.0.11693-pr.5944.954e092 build
33a8d21 billion-context@0.0.11500-pr.5944.6d10993 build
74a0b93 billion-context@0.0.9719-pr.5944.76f56c0 build
fc6494b billion-context@0.0.8626-pr.5944.a09121c build
b6a90ab billion-context@0.0.8624-pr.5944.833659e build

Download artifact

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

Install instructions are refreshed on each push.

@ranxianglei ranxianglei changed the title fix: session-level compress.modelContextLimit now sizes every window consumer (#5937) [PR] fix: session-level compress.modelContextLimit now sizes every window consumer (#5937) Nov 8, 2026
@ranxianglei

Copy link
Copy Markdown
Owner Author

🤖 Powered by ework · qwen3.8-27b

[bot] 🏷 (ai: vllm-qwen/qwen3.8-27b)

Duplicate screening: not a duplicate. No other open PR targets #5937 — checked all open [PR] rows; the closest relative is #5934 (three forwarding gates metered by outbound body size, same #5885 incident family but a different mechanism: body-size gates vs. window-consumer sizing) and #5932 (the measured-bar arms this PR explicitly defers rewiring to a follow-up). No parallel second fix for this thread.

Labels: PR #5944 already carries bug + p2 + dsh + scope/kernel, all judged against its own diff and all holding up: bug (defect fix), p2 (cap silently ignored — usable but the declared wall never bites; workaround exists via top-level fallback), dsh (one of the three fixed consumers is the DSH native plugin lane), scope/kernel = compression/context-management domain (the diff touches zero files under kernel/). No relabel needed.

Review in progress: branch b6a90ab fetched locally; reading the full diff file-by-file against current master, verifying the three claimed consumer wirings plus regression surface (non-operator sessions must stay byte-for-byte), then CI status via the mirror cache. Structured eight-question conclusion (八问) follows as a separate comment once verification is done.

@ranxianglei

Copy link
Copy Markdown
Owner Author

🤖 Powered by ework · qwen3.8-27b

🔶 需要决策
(ai: vllm-qwen/qwen3.8-27b)

背景一句话:同一 issue #5943 有两个在途 PR(#5945 先到、#5946 后到),核心语义互斥——「成功折叠是否消耗 nudge 信用」;我用 issue 正文的事故时间线对两个方案各做了一次代码级回放,#5946 的「折叠即消耗」语义修不掉标题现象,需要你拍板以哪个为准。

查重结论:重复。 #5946 与 #5945 同症状(requireNudge 下多轮清理压缩被误拒)+ 同根因(prepare 每轮重盖 armed,资格是单轮布尔)+ 同机制族(单轮武装改 nudge 信用窗口),差异只在两处设计取舍:①成功折叠是否消耗信用;②窗口计数单位(#5945 按模型轮、非模型形态不衰减;#5946 按每次 prepare)。按先来后到,保留 #5945(11:21:30Z 开)、#5946(11:23:17Z 开)标 duplicate——agent 无关闭权,关不关由你定。

待决问题:信用语义取哪种?合哪个 PR?

我的推荐:C(实质 A 先行)。理由:#5946 经回放证明修不掉标题现象,合入即「修了个没修的」;#5945 修掉事故、测试含 K±1 边界、偏离已披露且正是在等这个裁决。不决定的默认行为:两个 PR 我都不能合也不能关(owner-only);方向性缺陷使 #5946 不宜合入,默认轨迹 = #5945 待 CI 转绿后等你确认合入,#5946 等你关闭。


为什么判断 #5946 修不掉事故(独立回放,非引用 #5945 结论)。issue 证据时间线(session 01a1b6a5,请求级 host,每模型轮 = 新 HTTP 请求 = 新 prepare):18:40 T1 nudge 注入(usage 72%)→ 18:41:11 模型当轮成功压 5 块(72%→38%)→ 18:42:27/18:43:29/18:44:15/18:46:21 连续 4 轮压剩余范围全部 REFUSED requireNudge。按 #5946 代码走:18:40 轮 stampUnpromptedGate(nudgeInjected=true) → armed、until=R+19;18:41 折叠提交走到 src/stream.ts 提交点 consumeNudgeCredit → consumed=true(同轮余量仍放行);18:42 起每轮 prepare 重 stamp,creditLive = prev.armed && prev.consumed !== true → false → armed=false → 4 连拒逐分复现。即 #5946 只救场景 1(延迟首次履约:nudge 轮没压、之后几轮回来压),救不了 issue 自认「更常见的现场」场景 3(主范围当轮压完、跨轮清理剩余范围)——而事故现场恰恰是场景 3。#5945 的不消耗语义下同时间线:18:42–18:46 信用仍在窗口内(20→16),4 次清理放行,事故修复。

结构化八问(审的是 #5946):

  1. 是什么问题:开 compress.requireNudge 后压缩资格只在 nudge 注入那一轮有效,模型隔轮回来把推荐范围的剩余部分压完 → 每轮被拒、白烧 tool call + 思考,回执还把「下轮再压」引导成「别压了」。
  2. 什么原因导致的:src/server/handle.ts prepare 每轮重盖 armed: nudgeOutcome === "injected"——单轮布尔,无跨轮延续、无履约概念,nudge 轮一结束资格蒸发。
  3. 影响范围与严重程度(按选项):仅显式开启该 opt-in 开关的会话(默认关 = 零变化);受影响会话多轮清理全拒、opt-in 功能实际不可用,p2(无数据丢失/缓存泄露,preflight 兜底不受此门影响)。若走 B 合入:事故现象保留,对 compress.requireNudge is only valid in the round where the nudge is injected: if the model comes back in a later round t | compress.requireNudge 只在 nudge 注入的那一轮有效:模型隔轮回来压缩就被拒,多轮清理式压缩全部白拒 #5943 验收标准不达成;走 A/C:零额外影响,由 [PR] fix(#5943): requireNudge judges a nudge credit window, not this-round arm #5945 承接。
  4. 怎么修复的([PR] compress.requireNudge single-round arming changed to 20-round nudge credit: the model returning on alternating rounds to | compress.requireNudge 的单轮武装改为 20 轮 nudge 信用:模型隔轮回来压缩不再被误拒(#5943) #5946 方案):armed 改 20 轮 nudge 信用(NUDGE_CREDIT_ROUNDS=20 常量)——真实注入开窗、新注入刷新、committed 折叠消耗(同轮放行、下一轮边界失效)、窗口尽过期;纯内存重启清零。我对实现的独立核验(状态机、preflight 经 loopTracking:false 豁免、所有模型车道汇入 applyRanges 单执行点、fork 子车道 gate-OFF 不变、默认关字节级不变)均成立;本地定向测试 21/21 + 相邻面 59/59 绿、typecheck 干净。缺陷在语义选择层,不在实现层。
  5. 是否有回归风险(按选项):[PR] compress.requireNudge single-round arming changed to 20-round nudge credit: the model returning on alternating rounds to | compress.requireNudge 的单轮武装改为 20 轮 nudge 信用:模型隔轮回来压缩不再被误拒(#5943) #5946 代码本身逐项审过既有行为——默认关路径字节不变、preflight 豁免不变、时序门先于范围门顺序不变、拒收回执文案变更已进 docs 四件套披露,未见无意回归。B 的风险是方向性的:合入 = 带着未修复的标题现象关 issue。A/C 无回归面。
  6. 是否破坏缓存:不涉及缓存/重试/增量游标/去重键。行为变更披露(若 B 合入):旧 = 资格仅 nudge 注入当轮 → 新 = 最近一次真实注入起 ≤20 轮内有效且首次成功折叠即消耗(仅开关开启时生效)。
  7. 是否改了设计方向:架构无转向(仍是 prepare 盖章 + applyRanges 单执行点),只是盖章事实从「单轮布尔」换成「信用状态机」。
  8. 是否引入新配置:无(K=20 为代码常量;i18n/yaml/CHANGELOG/docs 文案四件套已同步、生成器已跑)。

标签:GitHub PR #5946 = bug / p2 / scope/kernel / duplicate(按本 PR diff 独立判定:opt-in 功能缺陷、非 p1 类);镜像 5948 = pr + bug / scope/kernel / p2 / duplicate / needs-decision(同判定 + 待你裁决)。不打客户端标签——证据宿主为 qwen3.8-27b 请求级 host,无具体客户端指纹可判。

CI 状态(刚读的实时值,head 6ca0e91):0 failed,13 项运行中/排队(test shards + static-gates),已完成项全部 success/skipped。

我的动作披露:review 中向 #5946 分支补了 2 个标注 commit——c3b7381e1b(test:钉死「被拒的折叠不消耗信用」,该分支本地 22/22)与 6ca0e91(docs:澄清 armedUntilRound 缺省字段语义)。若走 A/C 两者随分支作废;若走 B 则保留有效。

收工判定:#5946 实现质量过关但方向有缺陷(修不掉标题现象),不建议合入;推荐 C,等你拍板。

@ranxianglei
ranxianglei force-pushed the 2026-11-08_honour-compress-modelcontext-limit branch from fc6494b to 74a0b93 Compare November 14, 2026 00:49
ranxianglei pushed a commit that referenced this pull request Nov 14, 2026
… new operatorWindow param (rebase #5944)

Rebasing #5944 onto master surfaced two rebase-induced breaks:

1. master added a measured-body egress fuse (relay.ts) that fires BEFORE
   the PR's core-text fuse. Its 413 message hardcoded the non-operator
   wording, so an operator-declared session's over-cap body was refused
   without naming compress.modelContextLimit (#5937). Added the operator
   wall clause + remedy to the measured-body fuse message, mirroring the
   core-text fuse.

2. the PR added a required operatorWindow param to
   preflightCompressIfNeeded (pos 13). Two master-added test files still
   called it with 17 args → TS2554/TS7006. Inserted the operatorWindow
   undefined at pos 13 in both.

3. the PR's own egress-fuse test (issue5937-operator-window) was written
   against the core-text byte bar; with the measured-body fuse the bar is
   the token cap, so the over-cap direction now matches the measured-body
   message format and the under-bar body is sized below the token cap.
@ranxianglei

Copy link
Copy Markdown
Owner Author

🤖 Powered by ework · qwen3.8-27b

[bot] 🏷

Rebase + red-CI fix for PR #5944 (mirror #5946) — done, force-pushed.

The PR was 1489 commits behind master at merge-base. I rebased onto current master, resolved 2 conflicts, and fixed 3 rebase-induced breaks the rebase itself didn't catch. All verified green locally; force-pushed fc6494ba6a…74a0b937f7.

What I did:

  1. Rebase onto master (merge-base 3ac3e95c0e → master; re-rebased once master moved 23 commits). Two conflicts, both resolved:

  2. Fixed the typecheck break the rebase exposed: the PR added a required operatorWindow param (pos 13) to preflightCompressIfNeeded. Two master-added test files still called it with 17 args → TS2554/TS7006. Inserted the operatorWindow undefined at pos 13 in both (tests/issue5907-anon-preflight-warn.test.ts:121, tests/preflight-zero-fold-calibration.test.ts:113).

  3. Fixed the test failure the rebase exposed: master added a measured-body egress fuse (src/server/relay.ts:1013-1031) that fires BEFORE the PR's core-text fuse. Its 413 message hardcoded the non-operator wording, so an operator-declared session's over-cap body was refused without naming compress.modelContextLimit ([Bug][config] Session-level compress.modelContextLimit is ignored by the window resolution chain: the compression condit | [Bug][config] 会话级 compress.modelContextLimit 被窗口解析链忽略:压缩判式按默认 1M 窗口算,450K 限制永不生效 (#5885-defect-4) #5937). Added the operator wall clause + remedy to the measured-body fuse message (mirroring the core-text fuse at relay.ts:1036-1041). The PR's own egress-fuse test was written against the core-text byte bar; with the measured-body fuse the bar is the token cap, so I updated the over-cap direction to match the measured-body message format and sized the under-bar body below the token cap (bigMessages(670→300, 4_450) — 760K→341K measured tokens, under the 450K cap).

Verification (all green on rebased head 74a0b937f7):

  • npm run typecheck → exit 0
  • node --import tsx --test tests/issue5937-operator-window.test.ts tests/issue5907-anon-preflight-warn.test.ts tests/preflight-zero-fold-calibration.test.ts → 18 pass, 0 fail
  • node tools/gen-config-docs.mjs generate → NO drift (docs-sync CI job)
  • Force-pushed: fc6494ba6a…74a0b937f7 (forced update)

The mirror cache still shows the old SHA (fc6494ba6a, fetched 2026-11-08) — the new CI run for 74a0b937f7 is in-flight and will appear once the mirror poller picks it up (~60s).


七问 (CI engineer summary):

  1. 是什么问题: PR [PR] fix: session-level compress.modelContextLimit now sizes every window consumer (#5937) #5944 与 master 冲突(merge-base 落后 1489 个 commit);rebase 后又暴露出 3 处 rebase 引入的破坏(typecheck 参数不匹配 + 测试失败)。
  2. 什么原因导致的: master 在 merge-base 之后新增了一个 measured-body egress fuse(relay.ts),它在 PR 的 core-text fuse 之前触发,且 413 消息硬编码了非 operator 措辞;PR 又给 preflightCompressIfNeeded 加了必填的 operatorWindow 参数,导致 master 新增的两个测试文件调用时参数数量不匹配(TS2554/TS7006)。
  3. 影响范围与严重程度: 仅影响 operator-declared(显式 compress.modelContextLimit)会话的 egress fuse 413 消息措辞——bar 本身(= cap,无 1M floor)是对的,只是消息没点名 compress.modelContextLimit。属于可诊断性/体验问题,不是行为回归。
  4. 怎么修复的: 给 measured-body fuse 的 413 消息补上 operator wall clause + remedy(镜像 core-text fuse 的写法);给两个 master 测试文件补上 operatorWindow 的 undefined 参数;把 PR 自己的 egress-fuse 测试的 over-cap 方向改成匹配 measured-body 消息格式,under-bar body 缩小到 token cap 以下。
  5. 是否有回归问题: 无。bar 的计算(fuseWindow = operatorDeclared ? declaredWindow : max(declaredWindow, 1M))没动,只改了消息措辞;非 operator 会话走原分支(措辞逐字不变)。typecheck + 3 个测试文件 + docs-sync 全绿。
  6. 是否破坏缓存: 不涉及。改动只触及 egress fuse 的 413 消息字符串和测试,不触及缓存/重试/游标/去重键。
  7. 是否改了设计方向: 不涉及。这是 rebase 适配,不是设计变更。PR 的意图(operator-declared 会话的 egress fuse 点名 compress.modelContextLimit,bar = cap 无 1M floor)完整保留。

收工判定: rebase 完成,2 处冲突已解,3 处 rebase 引入的破坏已修,本地 typecheck + 测试 + docs-sync 全绿,已 force-push。新 CI run 在途,等镜像 poller 拾取后即可看绿。

@ranxianglei
ranxianglei force-pushed the 2026-11-08_honour-compress-modelcontext-limit branch from 74a0b93 to 33a8d21 Compare November 22, 2026 20:45
ranxianglei pushed a commit that referenced this pull request Nov 22, 2026
… new operatorWindow param (rebase #5944)

Rebasing #5944 onto master surfaced two rebase-induced breaks:

1. master added a measured-body egress fuse (relay.ts) that fires BEFORE
   the PR's core-text fuse. Its 413 message hardcoded the non-operator
   wording, so an operator-declared session's over-cap body was refused
   without naming compress.modelContextLimit (#5937). Added the operator
   wall clause + remedy to the measured-body fuse message, mirroring the
   core-text fuse.

2. the PR added a required operatorWindow param to
   preflightCompressIfNeeded (pos 13). Two master-added test files still
   called it with 17 args → TS2554/TS7006. Inserted the operatorWindow
   undefined at pos 13 in both.

3. the PR's own egress-fuse test (issue5937-operator-window) was written
   against the core-text byte bar; with the measured-body fuse the bar is
   the token cap, so the over-cap direction now matches the measured-body
   message format and the under-bar body is sized below the token cap.
@ranxianglei

Copy link
Copy Markdown
Owner Author

🤖 Powered by ework · qwen3.8-27b

[bot] 🏷

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

七问 — CI-engineer run (attempt 1/6)

1. 是什么问题?
PR 与 master 冲突(merge state: dirty),且 master 已前进 709 个 commit。本次任务:rebase master 进 PR 分支,解决全部冲突,force-push。

2. 什么原因导致的?
PR 分支 2026-11-08_honour-compress-modelcontext-limit 基于旧 master(e1f31ad9d5)rebase,此后 master 又前进了 709 个 commit。其中 src/server.ts 的 preflight 413 区域被 master 新增的 trustedForward 身份快速路径改动,与 PR 的 meteringWindow(#5937 operator-declared wall)改动在同一代码块内产生冲突。

3. 影响范围与严重程度?
仅 src/server.ts 一处冲突(4848-4871 行)。冲突涉及 preflight 413 的 nativeFitAfterClamp 判定臂——master 加了 trustedForward 旁路,PR 把 resolvedNativeWindow 换成 meteringWindow。两者正交:trustedForward 控制"是否旁路 doom 门",meteringWindow 控制"用什么窗口做尺寸判定"。解决为 union(两者都保留),行为不变。

4. 怎么修复的?

  • 冲突解决(union):保留 PR 的 meteringWindow 定义 + PR 的 nativeFitAfterClamp 用 meteringWindow + master 的 trustedForward 在 if 条件里。trustedForward 定义在 src/server.ts:4080,作用域可用。
  • rebase 完成:HEAD=33a8d215772,master 是 HEAD 的祖先,0 commit 落后。
  • 验证:npm run typecheck exit 0;node --import tsx --test tests/issue5937-operator-window.test.ts tests/issue5907-anon-preflight-warn.test.ts tests/preflight-zero-fold-calibration.test.ts → 18 pass 0 fail;node tools/gen-config-docs.mjs generate → NO drift(docs-sync CI)。
  • push:force-push 74a0b93→33a8d215772(--force-with-lease),unmarked final head(无 [ework:ci-held]),触发一次完整 CI。

5. 是否有回归问题?
无。冲突解决为 union,未改变任何既有行为:trustedForward 旁路逻辑保持 master 原样,meteringWindow 替换保持 PR 原样。typecheck + 18 个定向测试全绿。

6. 是否破坏缓存?
不涉及。本次只改 preflight 413 判定臂的窗口来源,不涉及缓存/重试/增量游标/去重键。

7. 是否改了设计方向?
不涉及。本次是 rebase 冲突解决,未引入新设计方向。PR 的 #5937 设计(operator-declared wall 替换 native window)保持不变。


状态:PR 已 rebase 到当前 master(9ad612e8bc65),force-push 完成(33a8d215772),触发一次完整 CI。等待 CI 结果。

@ranxianglei

Copy link
Copy Markdown
Owner Author

🤖 Powered by ework · qwen3.8-27b

[bot] 🏷
🔶 需要决策

CI Red Analysis — PR #5944 (head 33a8d21, run 45068260226)

6 test jobs failed. After fetching all 6 job logs and running targeted tests locally, I found TWO distinct failing tests:

1. #2391: a 272k Responses proxy forwards the full deferred catalog and rejects eager/loaded overflow — PR-caused

Failing jobs: ubuntu24-s2, win22-s5, ubuntu22-s2 (3 of 6)
Error: 413 !== 200 — the egress fuse refuses the ~300K deferred-catalog body at the 272K explicit cap.

Root cause: The PR's egress-fuse change (src/server/relay.ts:1017-1018) now uses the operator-declared window directly when operatorWindowTuned === true (fuseWindow = declaredWindow, no 1M floor). The fuse measures the full outbound body via measuredOutbound() → estimateRawBodyBreakdown() (src/preflight.ts:525), which counts ALL tokens including deferred tool schemas. The #2391 test sets compress.modelContextLimit: 272_000 plus a ~300K deferred catalog; the fuse sees 300K > 272K and returns 413.

Verified locally: The test PASSES on master (9ad612e) and FAILS on the PR head → PR-caused regression.

Design conflict: The #2391 design says deferred schemas don't consume the visible tool budget (modelVisibleTools in src/server/budget.ts), and the upstream (OpenAI Responses API) doesn't count deferred schemas against the context window (they're stored server-side, loaded on demand). But the egress fuse measures the raw body, which includes the deferred schemas. The PR's author changed the fuse to treat the explicit cap as a hard wall without considering the deferred-catalog case.

Options:

Recommendation: Option A. The egress fuse should be consistent with the preflight's handling of deferred tools. The upstream doesn't count deferred schemas against the context window, so the fuse shouldn't either.

2. e2e #6069: history replaced under the same session id, then grown past the window: the turn is folded and forwarded — pre-existing master regression

Failing jobs: ubuntu22-s3, ubuntu24-s3, win22-s2 (3 of 6)
Error: assert.ok(summaryCalls() > foldedBefore, "preflight summarized the new history") — expected true, actual false (the turn was forwarded 200 but NO summary call was made; the over-window payload was forwarded verbatim, not folded).

Verified locally: The test FAILS on master (9ad612e) AND on the PR head → pre-existing master regression, NOT caused by this PR.

Note: The ci-fixes branch is STALE (353 commits behind master; merge-base = ci-fixes head itself). Merging ci-fixes into the PR branch adds nothing. The #6069 master regression has not been converged into ci-fixes by the sentinel. Per the CI-failure coordination policy (2026-10-24), master-level failures are not fixed in the PR branch; they converge to ci-fixes via the sentinel. This needs a sentinel run to fix the #6069 regression on master/ci-fixes.

Summary


七问 (Review Checklist)

  1. 是什么问题:PR [PR] fix: session-level compress.modelContextLimit now sizes every window consumer (#5937) #5944 的 egress fuse 改动导致 [Bug][Codex Responses] fixed instruction/tool overhead exceeds 272k budget; preflight has zero compressible ranges #2391 测试失败(300K deferred catalog 在 272K 显式 cap 下被 413 拒绝);另有 Context limit exceeded. | 上下文超了 #6069 测试在 master 上就已失败(非本 PR 引入)。
  2. 什么原因导致的:PR 将 egress fuse 的窗口从 max(cap, 1M) 改为 cap(operator-declared 时),fuse 测量的是完整出站 body(含 deferred schema),而 [Bug][Codex Responses] fixed instruction/tool overhead exceeds 272k budget; preflight has zero compressible ranges #2391 设计中 deferred schema 不占可见 tool budget。Context limit exceeded. | 上下文超了 #6069 是 master 上的既有回归。
  3. 影响范围与严重程度:[Bug][Codex Responses] fixed instruction/tool overhead exceeds 272k budget; preflight has zero compressible ranges #2391 — 使用 compress.modelContextLimit 显式 cap + Responses API deferred tool 的会话会被 fuse 误拒(特定条件:deferred catalog 超过 cap)。Context limit exceeded. | 上下文超了 #6069 — master 上 epoch-pause over-window 场景的 preflight 折叠失效(影响所有使用 epoch-pause 的会话)。
  4. 怎么修复的:[Bug][Codex Responses] fixed instruction/tool overhead exceeds 272k budget; preflight has zero compressible ranges #2391 推荐 Option A(fuse 测量排除 deferred schema,与 preflight 的 modelVisibleTools 一致);Context limit exceeded. | 上下文超了 #6069 需 sentinel 在 master/ci-fixes 上修复。
  5. 是否有回归问题:[Bug][Codex Responses] fixed instruction/tool overhead exceeds 272k budget; preflight has zero compressible ranges #2391 失败是 PR 引入的回归(master 通过,PR head 失败)。Context limit exceeded. | 上下文超了 #6069 是 master 既有回归(非本 PR 引入)。
  6. 是否破坏缓存:不涉及。
  7. 是否改了设计方向:[Bug][Codex Responses] fixed instruction/tool overhead exceeds 272k budget; preflight has zero compressible ranges #2391 的修复(Option A)不改设计方向,只是让 fuse 测量与 preflight 一致。

判定:需要 owner 决策 #2391 的修复方案(推荐 Option A);#6069 需 sentinel 在 master/ci-fixes 上收敛。本轮无 push。

@ranxianglei

Copy link
Copy Markdown
Owner Author

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

Independent end-to-end review of PR #5944 (head 33a8d2157). I verified the core wiring against current master and reproduced the CI failures locally (master vs PR head A/B).

Verdict: REQUEST_CHANGES — one verified PR-caused regression (#2391)

Verified CORRECT

  • Core window-consumer wiring. operatorWindow (= reqConfig.modelContextLimit, which resolveRequestConfig sets from compress.modelContextLimit via resolveContextLimitValue, src/compress-settings.ts:420) is correctly threaded into all three consumers:
    • preflightCompressIfNeeded's meteringWindow (src/server.ts:4848-4858) — the post-fold fit proof runs against the operator cap; without an explicit setting it IS resolvedNativeWindow (behavior unchanged).
    • session.metadata.operatorWindowTuned (src/server/handle.ts:3257-3262) — tri-state (true→set / false→delete / undefined→leave untouched), so a no-model turn never erases a prior modeled turn's stamp.
    • dsh-native.ts effectiveContextWindow (src/agent/dsh-native.ts:591-614) — operatorContextLimit reads the GLOBAL-level compress.modelContextLimit (abs, or "N%" of the cached info window; no info window + percent/garbage → arm disabled, never guessed). loadConfigFile() is parse-cached (page-cache hit ~µs), so the per-call read is not a perf issue.
  • resolveContextLimitValue relocation (compress-settings.ts → util.ts): byte-identical move, re-exported for existing importers. Clean.
  • PR's own test (tests/issue5937-operator-window.test.ts): 3/3 pass locally. Note: it covers non-deferred over-cap/under-cap only — it does NOT cover the deferred-catalog case that [Bug][Codex Responses] fixed instruction/tool overhead exceeds 272k budget; preflight has zero compressible ranges #2391 pins (see below).

The blocking regression (#2391) — reproduced locally

The egress-fuse change (src/server/relay.ts:1017-1018) drops the 1M anti-guess floor for operator-declared sessions (fuseWindow = declaredWindow vs max(declaredWindow, 1M)). The fuse measures the FULL outbound body via measuredOutbound() → estimateRawBodyBreakdown() (src/preflight.ts:525), which counts ALL tools including deferred schemas. But the #2391 design (and the OpenAI Responses API) does NOT count deferred schemas against the visible window — they're stored server-side, loaded on demand.

Local A/B (I ran both):

This is a real, PR-caused regression: a Responses-API session with an explicit compress.modelContextLimit and a large deferred catalog gets a false 413 instead of a forward. It breaks a pinned test.

Why this is NOT a small on-the-spot fix

The root issue: the fuse's measurement (raw body, all tools) is inconsistent with the #2391 design (deferred schemas don't count). The 1M floor was masking this; the PR's change exposed it. The fix requires making the fuse's measurement deferred-aware (consistent with modelVisibleTools/countSystemAndToolsTokens in src/server/budget.ts) — a semantic, cross-file change = a design decision, not a mechanical fix. The previous CI-engineer already flagged this as 🔶 需要决策 (comment above) with Option A (exclude deferred schemas from the fuse's measurement) recommended — I concur with Option A.

CI state

The mirror cache was incomplete (30 of 100 checks, all "skipped"/"success"); the full check-runs for head 33a8d2157 show 6 failing test shards. I verified the two distinct failures locally: #2391 (PR-caused, above) and #6069 (tests/issue6069-epoch-pause-over-window.test.ts, 2/3 — fails on master too, so pre-existing, not this PR's fault; converges via sentinel/ci-fixes per the CI-coordination rule).


八问 (Review Checklist)

  1. 是什么问题:会话级 compress.modelContextLimit 被三个窗口消费者忽略(preflight 折后装得下证明、relay 出站熔断、DSH 插件车道),450K 上限拦不住超窗体([Bug][dsh] Rewind (fork+seed) leaves non-monotonic refs: preflight folds only ~5k tokens/round, so 31 rounds (649 s) cannot close a 283k deficit — and the "NOT forwarded" payload is sent anyway #5885 defect-4 的 2M token 出站、31 轮空转)。
  2. 什么原因导致的:effectiveContextLimit/resolvedNativeWindow 一系只认 live model target → 全局默认 → 缓存 modelInfo,不读 compress.modelContextLimit;三个消费者各自用原始窗口/1M 下限计量,没接进该键。
  3. 影响范围与严重程度:仅显式设置 compress.modelContextLimit 的会话(默认无设置 = 零变化),p2(声明的墙不生效,需绕行顶层 fallback)。但本 PR 的出站熔断改动引入 [Bug][Codex Responses] fixed instruction/tool overhead exceeds 272k budget; preflight has zero compressible ranges #2391 回归:显式 cap + 大 deferred catalog 的 Responses API 会话被误 413(master 通过 / PR head 失败,已本地复现)。
  4. 怎么修复的:operatorWindow(= reqConfig.modelContextLimit,由 resolveContextLimitValue 从 compress.modelContextLimit 解析)接进 preflight meteringWindow、operatorWindowTuned 元数据(三态)、DSH effectiveContextWindow(全局级);出站熔断对 operator 会话去掉 1M 下限、413 点名该键。
  5. 是否有回归问题:有,[Bug][Codex Responses] fixed instruction/tool overhead exceeds 272k budget; preflight has zero compressible ranges #2391 是 PR 引入的回归(master 7/7 通过,PR head 6/7 失败,413 !== 200)。根因:熔断计量用原始 body(含 deferred schema)对比 operator cap,而 [Bug][Codex Responses] fixed instruction/tool overhead exceeds 272k budget; preflight has zero compressible ranges #2391 设计里 deferred schema 不占可见窗口。其余消费者(preflight/DSH)逐项审过,默认无设置路径字节不变,未见其他无意回归。
  6. 是否破坏缓存:不涉及缓存/重试/增量游标/去重键。operatorWindowTuned 是新增 session metadata(加性,无持久化格式变更)。
  7. 是否改了设计方向:无架构转向。把 compress.modelContextLimit 从「判式链专用」扩展为「所有 token 计量出站守卫的墙」,是既有语义扩展,不是新方向。
  8. 是否引入新配置:无新键。compress.modelContextLimit 语义扩展(现在也驱动出站熔断);窗口优先级:上游 400 证据 > 本键 > registry/原生解析 > 顶层 fallback。

判定

REQUEST_CHANGES(不批准)。核心接线正确,但出站熔断改动引入已验证的 #2391 回归。修复需设计决策(推荐 Option A:熔断计量排除 deferred schema,与 preflight modelVisibleTools 一致),已在 comment 6 立为 🔶 需要决策、needs-decision 标签已挂——等 owner 拍板修复方向后再合。#6069 为 master 既有回归(非本 PR 引入),走 sentinel/ci-fixes 收敛,不阻塞本判定。

@ranxianglei

Copy link
Copy Markdown
Owner Author

🤖 Powered by ework · qwen3.8-27b

[bot] 🏷 (ai: vllm-qwen/qwen3.8-27b)

PR #5944 review is complete — full review is the comment directly above this one. Concise outcome:

Verdict: REQUEST_CHANGES (not approved). Core wiring is correct; one verified PR-caused regression blocks merge.

Verified correct: preflight meteringWindow, operatorWindowTuned tri-state metadata (no-model turn never erases a prior stamp), DSH effectiveContextWindow (global-level only, never guesses a percent with no base), resolveContextLimitValue relocation (byte-identical). No cache/persistence impact; no new config keys. CI: 6 failing shards = #2391 (PR) + #6069 (master, pre-existing).

@ranxianglei
ranxianglei force-pushed the 2026-11-08_honour-compress-modelcontext-limit branch from 33a8d21 to 7e1bb72 Compare November 24, 2026 00:04
ranxianglei pushed a commit that referenced this pull request Nov 24, 2026
… new operatorWindow param (rebase #5944)

Rebasing #5944 onto master surfaced two rebase-induced breaks:

1. master added a measured-body egress fuse (relay.ts) that fires BEFORE
   the PR's core-text fuse. Its 413 message hardcoded the non-operator
   wording, so an operator-declared session's over-cap body was refused
   without naming compress.modelContextLimit (#5937). Added the operator
   wall clause + remedy to the measured-body fuse message, mirroring the
   core-text fuse.

2. the PR added a required operatorWindow param to
   preflightCompressIfNeeded (pos 13). Two master-added test files still
   called it with 17 args → TS2554/TS7006. Inserted the operatorWindow
   undefined at pos 13 in both.

3. the PR's own egress-fuse test (issue5937-operator-window) was written
   against the core-text byte bar; with the measured-body fuse the bar is
   the token cap, so the over-cap direction now matches the measured-body
   message format and the under-bar body is sized below the token cap.
@ranxianglei

Copy link
Copy Markdown
Owner Author

🤖 Powered by ework · qwen3.8-27b

[bot] 🏷 (ai: vllm-qwen/qwen3.8-27b)

Rebase + #7537 adaptation done, force-pushed to 4d892455905.

This run rebased PR #5944 onto current master and adapted the egress-fuse change to master's #7537 ruling (no local estimate-refusal), which landed after the PR was written and resolves the earlier #2391 REQUEST_CHANGES blocker.

What changed on this run:

  1. Rebase onto master — the branch was behind master; re-based and resolved the rebase-induced breaks (the new operatorWindow param on preflightCompressIfNeeded + the measured-body egress fuse master added in src/server/relay.ts).
  2. Egress fuse adapted to Preflight: don't reject based on local estimation — after folding, forward unconditionally; if it exceeds the window, le | preflight 不用本地估算拒发:折叠后一律转发,超窗让上游自己说(413 拒发家族总根因) #7537 (src/server/relay.ts:1017-1018, 1057-1074) — master's Preflight: don't reject based on local estimation — after folding, forward unconditionally; if it exceeds the window, le | preflight 不用本地估算拒发:折叠后一律转发,超窗让上游自己说(413 拒发家族总根因) #7537 (owner ruling 2026-11-22, KDD fix: route auto-update logs through the tee logger #19) abolished the 413 refusal: the fuse now logs the measurement and forwards (no local estimate-refusal). The PR's original design (413 for operator-declared caps) is superseded. What remains of the PR's egress-fuse contribution: the bar is sized at the operator cap (no 1M anti-guess floor) when operatorWindowTuned === true, and the profile log line names the operator wall (compress.modelContextLimit, #5937). The two retained local refusals (message-count gate, 5GiB byte cap) are untouched.
  3. Test updated (tests/issue5937-operator-window.test.ts) — the over-cap direction now asserts the Preflight: don't reject based on local estimation — after folding, forward unconditionally; if it exceeds the window, le | preflight 不用本地估算拒发:折叠后一律转发,超窗让上游自己说(413 拒发家族总根因) #7537 forward (200) + the profile log line naming the operator wall, instead of the old 413. (The test file had been updated in the working tree during the prior rebase run but not committed — the force-push pushed the stale 413 assertion, which is what turned the 3 test shards red. This run lands the committed test.)

The #2391 blocker is resolved by #7537. The earlier REQUEST_CHANGES was for the egress-fuse 413 on a 272K cap + ~300K deferred catalog. Since the fuse no longer refuses (it logs and forwards), tests/deferred-tool-budget.test.ts now passes 7/7 — verified locally 3× (the first run's single "fail" was a transient port collision, not a code failure). The earlier "Option A" design decision is no longer needed: the refusal is gone, so the deferred-schema measurement-consistency question no longer gates anything.

The preflight meteringWindow is still meaningful post-#7537 — it sizes the forward-once fit proof (nativeFitAfterClamp, src/server.ts:4935-4936), a forwarding decision, not a 413. No dead code path left by the rebase.

Verified locally (rebased head 4d892455905):

  • npm run typecheck → exit 0
  • tests/issue5937-operator-window.test.ts → 3/3 pass
  • tests/deferred-tool-budget.test.ts → 7/7 pass (×3)
  • node tools/gen-config-docs.mjs generate → no drift (docs-sync gate)

CI (head 4d892455905, run 45296924782): static-gates (ubuntu24) + mysql-contract green; 12 test shards in_progress; no failures so far. mergeable_state: blocked is the review/needs-decision state, not CI.

Remaining risk: tests/issue6069-epoch-pause-over-window.test.ts was confirmed failing on master in the prior runs (pre-existing, not this PR's fault). If it shows in this CI, it's an inherited master failure → converges via sentinel/ci-fixes per the CI-coordination rule, not fixed here.


八问 (CI-engineer run):

  1. 是什么问题: PR [PR] fix: session-level compress.modelContextLimit now sizes every window consumer (#5937) #5944 落后 master 且有冲突;master 在 PR 之后落地了 Preflight: don't reject based on local estimation — after folding, forward unconditionally; if it exceeds the window, le | preflight 不用本地估算拒发:折叠后一律转发,超窗让上游自己说(413 拒发家族总根因) #7537(废除本地估算拒发),PR 的出站熔断 413 设计与之冲突。
  2. 什么原因导致的: PR 的出站熔断改动(operator 会话 413)写于 Preflight: don't reject based on local estimation — after folding, forward unconditionally; if it exceeds the window, le | preflight 不用本地估算拒发:折叠后一律转发,超窗让上游自己说(413 拒发家族总根因) #7537 之前;Preflight: don't reject based on local estimation — after folding, forward unconditionally; if it exceeds the window, le | preflight 不用本地估算拒发:折叠后一律转发,超窗让上游自己说(413 拒发家族总根因) #7537 把熔断从「413 拒发」改成「打日志 + 转发」,PR 的 413 断言与 master 新行为不符;上一轮 rebase 只把改好的测试留在工作区未提交,force-push 推的是旧 413 断言,导致 3 个 test shard 红。
  3. 影响范围与严重程度: 仅出站熔断的 bar 计量 + 日志措辞;[Bug][Codex Responses] fixed instruction/tool overhead exceeds 272k budget; preflight has zero compressible ranges #2391 回归(先前 REQUEST_CHANGES 的阻塞项)被 Preflight: don't reject based on local estimation — after folding, forward unconditionally; if it exceeds the window, le | preflight 不用本地估算拒发:折叠后一律转发,超窗让上游自己说(413 拒发家族总根因) #7537 解决。无数据/缓存影响。
  4. 怎么修复的: rebase 到 master;出站熔断适配 Preflight: don't reject based on local estimation — after folding, forward unconditionally; if it exceeds the window, le | preflight 不用本地估算拒发:折叠后一律转发,超窗让上游自己说(413 拒发家族总根因) #7537(保留 log-and-forward,operator 会话 bar = cap 无 1M floor,日志点名 operator wall);测试改为断言转发 + 日志点名;提交并 force-push。
  5. 是否有回归问题: 无新回归。先前 [Bug][Codex Responses] fixed instruction/tool overhead exceeds 272k budget; preflight has zero compressible ranges #2391 回归已被 Preflight: don't reject based on local estimation — after folding, forward unconditionally; if it exceeds the window, le | preflight 不用本地估算拒发:折叠后一律转发,超窗让上游自己说(413 拒发家族总根因) #7537 解决(deferred-tool-budget 7/7 通过)。Context limit exceeded. | 上下文超了 #6069 是 master 既有回归(非本 PR 引入),若 CI 出现属继承性失败,走 sentinel/ci-fixes 收敛。
  6. 是否破坏缓存: 不涉及缓存/重试/增量游标/去重键。
  7. 是否改了设计方向: 无架构转向。PR 的设计(operator cap 驱动窗口消费者)保留;出站熔断的拒发机制被 master 的 Preflight: don't reject based on local estimation — after folding, forward unconditionally; if it exceeds the window, le | preflight 不用本地估算拒发:折叠后一律转发,超窗让上游自己说(413 拒发家族总根因) #7537 取代(非本 PR 决定),PR 在熔断上的贡献收窄为 bar 计量 + 日志点名。
  8. 是否引入新配置: 无新键。

收工判定: rebase + #7537 适配完成,本地 typecheck + 定向测试全绿,已 force-push。CI test shards 在途、暂无失败;#2391 阻塞项已被 #7537 解决,待 reviewer 复核。#6069 若出现属 master 继承红,另行收敛。

@ranxianglei

Copy link
Copy Markdown
Owner Author

Verdict: APPROVE — round-1 regression resolved, PR is clean (head 4d8924559)

Re-reviewed the rebased head end-to-end. The one blocking finding from round 1 (#2391) is resolved, and the pre-existing master regression (#6069) is also fixed by the newer master. All targeted tests pass locally; CI is green (0 failures, 0 pending).

What changed since round 1 (33a8d2157 → 4d8924559)

The PR was rebased onto a much newer master and gained one new commit:

Why the round-1 #2391 regression is gone

The #2391 false-413 happened because the fuse measured the raw body (incl. deferred tool schemas) against the operator cap and refused (413). With #7537, the fuse now logs and forwards — so a 272K cap + ~300K deferred catalog is forwarded (the upstream decides), not refused. Verified locally:

  • tests/deferred-tool-budget.test.ts → 7/7 pass (was 6/7 on the old head).
  • tests/issue5937-operator-window.test.ts (PR's own) → 3/3 pass (now asserts the fuse profile log names the operator wall 450,000 + forwarding per #7537; the op-fuse match is the session id, so the assertion is meaningful, not a false positive).
  • tests/issue6069-epoch-pause-over-window.test.ts → 3/3 pass (the pre-existing master regression is fixed by the newer master).

Core wiring (re-verified on the new master)

  • operatorWindow (= reqConfig.modelContextLimit, set from compress.modelContextLimit via resolveContextLimitValue, src/compress-settings.ts:420) correctly threaded into preflight meteringWindow (src/server.ts), operatorWindowTuned tri-state metadata (src/server/handle.ts), and DSH effectiveContextWindow (src/agent/dsh-native.ts, global-level only, never guesses a percent with no base).
  • resolveContextLimitValue relocation (compress-settings.ts → util.ts): byte-identical, re-exported.
  • No new config keys; no cache/persistence impact; operatorWindowTuned is additive session metadata.

八问 (Review Checklist)

  1. 是什么问题:会话级 compress.modelContextLimit 被三个窗口消费者忽略(preflight 折后装得下证明、relay 出站熔断、DSH 插件车道),450K 上限拦不住超窗体([Bug][dsh] Rewind (fork+seed) leaves non-monotonic refs: preflight folds only ~5k tokens/round, so 31 rounds (649 s) cannot close a 283k deficit — and the "NOT forwarded" payload is sent anyway #5885 defect-4 的 2M token 出站、31 轮空转)。
  2. 什么原因导致的:effectiveContextLimit/resolvedNativeWindow 一系只认 live model target → 全局默认 → 缓存 modelInfo,不读 compress.modelContextLimit;三个消费者各自用原始窗口/1M 下限计量,没接进该键。
  3. 影响范围与严重程度:仅显式设置 compress.modelContextLimit 的会话(默认无设置 = 零变化),p2(声明的墙不生效,需绕行顶层 fallback)。
  4. 怎么修复的:operatorWindow(= reqConfig.modelContextLimit,由 resolveContextLimitValue 从 compress.modelContextLimit 解析)接进 preflight meteringWindow、operatorWindowTuned 元数据(三态)、DSH effectiveContextWindow(全局级);出站熔断对 operator 会话去掉 1M 下限(Preflight: don't reject based on local estimation — after folding, forward unconditionally; if it exceeds the window, le | preflight 不用本地估算拒发:折叠后一律转发,超窗让上游自己说(413 拒发家族总根因) #7537 后为 log-and-forward,不再本地 413)。
  5. 是否有回归问题:无。round 1 发现的 [Bug][Codex Responses] fixed instruction/tool overhead exceeds 272k budget; preflight has zero compressible ranges #2391 回归已随 master Preflight: don't reject based on local estimation — after folding, forward unconditionally; if it exceeds the window, le | preflight 不用本地估算拒发:折叠后一律转发,超窗让上游自己说(413 拒发家族总根因) #7537(出站熔断改 log-and-forward)解决([Bug][Codex Responses] fixed instruction/tool overhead exceeds 272k budget; preflight has zero compressible ranges #2391 测试 7/7 通过);Context limit exceeded. | 上下文超了 #6069 是 master 既有回归,新版 master 已修(测试 3/3 通过)。其余消费者(preflight/DSH)逐项审过,默认无设置路径字节不变,未见其他无意回归。
  6. 是否破坏缓存:不涉及缓存/重试/增量游标/去重键。operatorWindowTuned 是新增 session metadata(加性,无持久化格式变更)。
  7. 是否改了设计方向:无架构转向。把 compress.modelContextLimit 从「判式链专用」扩展为「所有 token 计量出站守卫的墙」,是既有语义扩展,不是新方向。
  8. 是否引入新配置:无新键。compress.modelContextLimit 语义扩展(现在也驱动出站熔断);窗口优先级:上游 400 证据 > 本键 > registry/原生解析 > 顶层 fallback。

判定

APPROVE(可合)。round 1 的 #2391 回归已解决(#7537 log-and-forward),#6069 既有回归已由新版 master 修复,核心接线正确,定向测试全过,CI 绿。无阻塞项。

@ranxianglei

Copy link
Copy Markdown
Owner Author

🤖 Powered by ework · qwen3.8-27b

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

Round-2 复审结论:APPROVE(可合)

PR 已 rebase 到更新版 master(head 4d8924559),round 1 的阻塞项已解决。

round 1 的 #2391 回归已解决:master 的 #7537(owner 裁定 2026-11-22)把出站熔断从本地 413 拒发改为 log-and-forward(不本地拒发,上游的大小判决才是权威)。所以 272K cap + ~300K deferred catalog 现在会转发(上游决定),不再 413。#2391 测试 7/7 通过。

#6069 既有 master 回归已修复:新版 master 已修,测试 3/3 通过。

核心接线正确(在更新版 master 上重新验证):operatorWindow 接进 preflight meteringWindow、operatorWindowTuned 元数据、DSH effectiveContextWindow;resolveContextLimitValue 搬迁字节不变。

定向测试全过:#2391 (7/7)、PR 自测 (3/3)、#6069 (3/3)。CI 绿(0 failures, 0 pending)。

已在 PR #5944 贴 APPROVE 复审(含八问),已在协调 issue #4599 报一行。无阻塞项。

@ranxianglei

Copy link
Copy Markdown
Owner Author

🤖 Powered by ework · qwen3.8-27b

[bot] 🏷 (ai: vllm-qwen/qwen3.8-27b)

Round-2 复审完成,结论:APPROVE(可合)。

(上一条是镜像把我自己的 GitHub 复审同步回来,非新问题,不重复回复。)

ci-check added 4 commits November 30, 2026 08:24
…consumer (#5937)

judgments — they all ran off the raw model window while the judging chain
(preflight limit / headroom) already consumed the key:

- preflightCompressIfNeeded gains operatorWindow (post-self-heal tuned
  value); the post-fold measured-token fit proof (nativeFitAfterClamp) now
  judges a meteringWindow = operator cap > raw native > undefined instead
  of always the raw native window. No explicit setting => identical
  behavior. Proven upstream evidence still clamps lower (#5191 ruling).
- relay egress fuse: sessions stamped with an explicit cap (new
  session.metadata.operatorWindowTuned provenance twin, written beside
  effectiveContextLimit on every full-pipeline request) size the bar at
  cap x 7.5 B/tok (min 2MB) WITHOUT the 1M anti-guess floor; non-operator
  sessions keep the floor byte-for-byte. The 413 names the setting and how
  to release it. A no-model request no longer erases a prior modeled turn's
  operator stamp (tri-state operatorWindowTuned).
- dsh-native effectiveContextWindow honours the GLOBAL-level
  compress.modelContextLimit (resolveContextLimitValue moved to util.ts so
  the host bundle shares the exact resolution without pulling kernel pack
  machinery; compress-settings re-exports it). Fixes both the oversize gate
  doom math and the x-bili-plugin-context-window stamp at once: the proxy
  then sees the cap as its pluginWindow source and the whole existing chain
  sizes off it. Route/model-level overrides stay proxy-side only.

No new config keys — semantics extension of an existing one. Window
priority, highest first: upstream 400 evidence > this key >
registry/native resolution > top-level modelContextLimit fallback.

Tests: tests/issue5937-operator-window.test.ts (main-path pin [window]
base=450000 / [headroom] 450000->337500; fuse both-ways, verified to fail
against master relay.ts; dsh-native resolution rows). Docs:
configuration.md en+zh (guard wall + priority line).
…n-config-docs (#5937)

The summary tables in docs/configuration.md are generated from
website/config-reference/*.yaml (docs-sync lane: generate + drift check).
Edit the seed instead of the generated rows; site_en/site_zh carry the
same guard-wall semantics to website/main.js and website/docs/index.html.
… new operatorWindow param (rebase #5944)

Rebasing #5944 onto master surfaced two rebase-induced breaks:

1. master added a measured-body egress fuse (relay.ts) that fires BEFORE
   the PR's core-text fuse. Its 413 message hardcoded the non-operator
   wording, so an operator-declared session's over-cap body was refused
   without naming compress.modelContextLimit (#5937). Added the operator
   wall clause + remedy to the measured-body fuse message, mirroring the
   core-text fuse.

2. the PR added a required operatorWindow param to
   preflightCompressIfNeeded (pos 13). Two master-added test files still
   called it with 17 args → TS2554/TS7006. Inserted the operatorWindow
   undefined at pos 13 in both.

3. the PR's own egress-fuse test (issue5937-operator-window) was written
   against the core-text byte bar; with the measured-body fuse the bar is
   the token cap, so the over-cap direction now matches the measured-body
   message format and the under-bar body is sized below the token cap.
… 413)

The egress fuse test was written for the old 413-refusal behavior. Master's
#7537 ruling (2026-11-22) changed the fuse to log-and-forward (no local
estimate-refusal). The test now asserts the fuse profile log line names the
operator-declared window and the #7537 forward decision, instead of asserting
a 413 response.

The test file was updated in the working directory during the previous rebase
run but not committed — the force-push pushed the old test, causing CI to fail
on the old 413 assertion. This commit lands the updated test.
@ranxianglei
ranxianglei force-pushed the 2026-11-08_honour-compress-modelcontext-limit branch from 4d89245 to 2d908fc Compare November 30, 2026 00:29
@ranxianglei

Copy link
Copy Markdown
Owner Author

🤖 Powered by ework · qwen3.8-27b

[bot] 🏷

Rebased #5944 onto current master and resolved the single merge conflict. Branch is now at 2d908fcb5d4 (force-pushed, unmarked final head → one full CI pass will run).

What I did this run:

  1. Verified live state (status-freshness): PR head was 4d892455905, master head 5bb3eb2cd9a — the branch was 1689 commits behind (merge-base 045228cfa3e). The mirror's "dirty" merge state was 6 days stale; the real blocker was the rebase distance.
  2. Rebased the 4 PR commits onto origin/master. One conflict in src/server/handle.ts at the nativeWindow declaration site: master's [PR] egress plane: cross-lane model/protocol switching — render fidelity + wire-granularity pinning #7684 changed const nativeWindow → let nativeWindow and added a window-ratchet block, which collided with the PR's new const operatorWindow = operatorWindowTuned ? nativeWindow : undefined.
  3. Resolution: kept master's full ratchet block, then computed operatorWindow AFTER it. Verified safe — ratchetableWindowModel is only set when !operatorWindowTuned (src/server/handle.ts:1191), so when the operator tuned the window the ratchet block is skipped and nativeWindow stays at the operator cap; operatorWindow then correctly equals that cap. Commits 2–4 applied cleanly.
  4. Reinstalled node_modules — the workdir had been reset between runs (tsup/tsx were missing, the pre-typecheck kernel build failed until I ran npm install + npm --prefix kernel install).
  5. Local verification on 2d908fcb5d4: npm run typecheck clean; tests/issue5937-operator-window.test.ts 3/3; tests/deferred-tool-budget.test.ts 7/7; node tools/gen-config-docs.mjs generate no drift (docs-sync gate).
  6. Force-pushed with --force-with-lease — remote head was still the pre-rebase 4d892455905 (no concurrent pushes), so the lease held.

八问:

  1. 是什么问题:PR [PR] fix: session-level compress.modelContextLimit now sizes every window consumer (#5937) #5944 与 master 合并冲突(master 领先 1689 提交),需 rebase 到最新 master 并解决冲突。
  2. 什么原因导致的:PR 分支基于旧 merge-base(045228cfa3e),master 期间合入 [PR] egress plane: cross-lane model/protocol switching — render fidelity + wire-granularity pinning #7684(window ratchet),把 nativeWindow 从 const 改成 let 并加了 ratchet 块,与 PR 新增的 operatorWindow 计算在同一声明点发生文本冲突。
  3. 影响范围与严重程度:仅 PR 分支自身的合并状态;若解决错误会让 operator 窗口计量或 ratchet 失效。已解决并本地验证通过,无用户面影响。
  4. 怎么修复的:保留 master 的 ratchet 块,在其后追加 PR 的 operatorWindow 计算。验证 ratchetableWindowModel 仅在 !operatorWindowTuned 时赋值,operator 调窗时 ratchet 块被跳过、nativeWindow 保持 operator 上限,故 operatorWindow 在 ratchet 后取值语义正确。
  5. 是否有回归问题:审了 handle.ts 的 nativeWindow 声明路径、relay.ts 的 egress fuse(operator 栏 + Preflight: don't reject based on local estimation — after folding, forward unconditionally; if it exceeds the window, le | preflight 不用本地估算拒发:折叠后一律转发,超窗让上游自己说(413 拒发家族总根因) #7537 log-and-forward,relay.ts:1064-1065 / :1107-1121)、dsh-native.ts 的 effectiveContextWindow。typecheck 干净、issue5937 3/3、deferred-tool-budget 7/7、gen-config-docs 无漂移。无回归。
  6. 是否破坏缓存:不涉及(纯冲突解决,未改缓存/重试/游标逻辑)。
  7. 是否改了设计方向:不涉及(master 的 ratchet 与 PR 的 operator window 正交,两者都保留)。
  8. 是否引入了新的配置:不涉及(未新增 env/config/默认值)。

判定:rebase + 冲突解决完成,本地全绿,已 force-push 未标记的最终 head(2d908fcb5d4),等 CI 全量跑一遍。

@ranxianglei

Copy link
Copy Markdown
Owner Author

🤖 Powered by ework · qwen3.8-27b

[bot] 🏷 (ai: vllm-qwen/qwen3.8-27b)

Round-3 复审(rebase 后 head 2d908fcb5d4):APPROVE(可合,维持)

11-30 rebase 后的新 head 独立复核完毕。结论:rebase 增量只有 handle.ts 一处冲突解决,语义正确;PR 本体与 round-2 APPROVE 的设计逐字节一致;定向测试与 typecheck 全绿。一个需要你知晓的 CI 事实:这个 head 的全量 test matrix 被 #7785 stale-PR 门跳过了(见下),不是失败,但本 head 上没有全量套件绿灯。

本轮审了什么(rebase 增量,4d8924559 → 2d908fcb5d4)

  1. 冲突解决核验(src/server/handle.ts,唯一 rebase 增量):master [PR] egress plane: cross-lane model/protocol switching — render fidelity + wire-granularity pinning #7684 把 const nativeWindow 改成 let 并加了 window-ratchet 块,与 PR 的 operatorWindow 计算在同一声明点冲突。解法 = 保留 ratchet 块、在其后计算 operatorWindow(handle.ts:3124)。关键不变量已逐行验证:ratchetableWindowModel 仅在 native === undefined && !operatorWindowTuned 时武装(handle.ts:1191)——operator 调窗的会话永不进 ratchet,nativeWindow 保持 operator cap,operatorWindow 取值正确;非调窗会话 operatorWindow = undefined,metering 回退 resolvedNativeWindow(含 ratchet 提升值),行为不变;无 model 请求三态保持(undefined 不动旧 stamp,handle.ts:3302-3303)。
  2. PR 本体 vs 当前 master 全 diff 通读(15 文件,+423/−45):preflightCompressIfNeeded 的 operatorWindow 参数与 meteringWindow(src/server.ts:4961-4976)、relay fuse 的 operatorDeclared 分支 + Preflight: don't reject based on local estimation — after folding, forward unconditionally; if it exceeds the window, le | preflight 不用本地估算拒发:折叠后一律转发,超窗让上游自己说(413 拒发家族总根因) #7537 log-and-forward 保留(src/server/relay.ts:1057-1121)、dsh-native operatorContextLimit(无 info 窗口时百分比/垃圾值 → 禁用,绝不猜)、resolveContextLimitValue 搬迁字节不变 + re-export——与 round-2 批准的设计完全一致,无 rebase 引入的语义漂移。
  3. 本地定向验证(head 2d908fcb5d4):npm run typecheck exit 0;定向测试 17/17 通过——tests/issue5937-operator-window.test.ts 3/3、tests/deferred-tool-budget.test.ts([Bug][Codex Responses] fixed instruction/tool overhead exceeds 272k budget; preflight has zero compressible ranges #2391,round-1 阻塞项)7/7、tests/issue6069-epoch-pause-over-window.test.ts 3/3、tests/issue4079-egress-window-fuse.test.ts(非 operator 会话 1M floor 不变)4/4。
  4. 既有行为清点(回归面):非 operator 路径逐项保持——preflight meteringWindow 回退原值、fuse bar 保留 max(declared, 1M) floor、dsh-native 无配置时回退 infoWindow、三处 master 测试文件的 1 行参数补齐。未见无意回归。

CI 状态(重要)

head 2d908fcb5d4 的 CI run 46329179233:14 个 guard job 全绿(close-object / config-surface / kernel / lane / lock-sync / docs-sync / docs-coverage / architecture-docs / version-guard / test-import-graph / unused-exports / pi-subagents-guard / plan 等),但 test matrix、static-gates、mysql-contract、全部 e2e 车道均 skipped。根因已定位到 .github/workflows/ci.yml:254-259 的 #7785 stale-PR 门:PR 已开 22 天 > 72h 且无 ci:force 标签 → plan job 判 scope=skip → 空矩阵。这是资源门按设计工作,不是代码失败;但 skipped 不满足 required checks,所以本 head 没有全量套件绿灯。如需合并前补全量绿:给 PR 加 ci:force(core 矩阵)或 ci:full(全矩阵)标签即可重新武装。

八问

  1. 是什么问题:PR [PR] fix: session-level compress.modelContextLimit now sizes every window consumer (#5937) #5944 在 11-30 与 master 冲突后 rebase 到新 head 2d908fcb5d4,本轮确认 rebase 没有破坏 round-2 已批准的设计。
  2. 什么原因导致的:master [PR] egress plane: cross-lane model/protocol switching — render fidelity + wire-granularity pinning #7684(window ratchet)把 nativeWindow 从 const 改 let 并插入 ratchet 块,与 PR 新增的 operatorWindow 计算在同一声明点文本冲突。
  3. 影响范围与严重程度:仅 handle.ts 冲突解决点;若解错会让 operator 窗口计量或 ratchet 失效。已验证正确,无用户面影响。
  4. 怎么修复的:保留 master ratchet 块,operatorWindow 在其后计算;安全性由 !operatorWindowTuned 武装门(handle.ts:1191)保证——operator 调窗会话永不进 ratchet,两机制正交。
  5. 是否有回归问题:无。非 operator 路径字节不变(preflight/fuse/dsh-native 逐项核过);定向测试 17/17 + typecheck 干净。
  6. 是否破坏缓存:不涉及(无缓存/重试/游标/去重键改动;operatorWindowTuned 为加性 session metadata)。
  7. 是否改了设计方向:不涉及(纯 rebase 适配,PR 设计维持 round-2 批准形态)。
  8. 是否引入新配置:不涉及(无新 env/config/默认值)。

收工判定:APPROVE(维持,可合)。代码面无阻塞项;唯一待办是 CI 全量矩阵因 #7785 stale 门被跳过——需要全量绿灯的话由 owner 加 ci:force/ci:full 标签重武装,合并仍为 human-only。

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

bug Something isn't working dsh p2 scope/kernel

Projects

None yet

1 participant