Repository navigation
[PR] fix: session-level compress.modelContextLimit now sizes every window consumer (#5937) - #5944
ranxianglei wants to merge 3 commits into
Conversation
📦 Built Package ArtifactBranch: Latest build — install this exact versionnpm install -g billion-context@0.0.9719-pr.5944.76f56c0This exact version is immutable and reproducible. The rolling Recent builds (commit → version)
Download artifact
tar xzf billion-context-pr5944.tgz
npm install -g packageInstall instructions are refreshed on each push. |
[bot] 🏷 (ai: vllm-qwen/qwen3.8-27b) Duplicate screening: not a duplicate. No other open PR targets #5937 — checked all open Labels: PR #5944 already carries Review in progress: branch |
🔶 需要决策 背景一句话:同一 issue #5943 有两个在途 PR(#5945 先到、#5946 后到),核心语义互斥——「成功折叠是否消耗 nudge 信用」;我用 issue 正文的事故时间线对两个方案各做了一次代码级回放,#5946 的「折叠即消耗」语义修不掉标题现象,需要你拍板以哪个为准。 查重结论:重复。 #5946 与 #5945 同症状(requireNudge 下多轮清理压缩被误拒)+ 同根因(prepare 每轮重盖 待决问题:信用语义取哪种?合哪个 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 轮 结构化八问(审的是 #5946):
标签: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:澄清 收工判定:#5946 实现质量过关但方向有缺陷(修不掉标题现象),不建议合入;推荐 C,等你拍板。 |
…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.
fc6494b to
74a0b93
Compare
[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 What I did:
Verification (all green on rebased head
The mirror cache still shows the old SHA ( 七问 (CI engineer summary):
收工判定: rebase 完成,2 处冲突已解,3 处 rebase 引入的破坏已修,本地 typecheck + 测试 + docs-sync 全绿,已 force-push。新 CI run 在途,等镜像 poller 拾取后即可看绿。 |
Closes #5937
A session-level
compress.modelContextLimitwas 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):nativeFitAfterClamp) judged against the RAW resolved native window.effectiveContextWindowread only the cached model info — both the host-side oversize gate and thex-bili-plugin-context-windowstamp ([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
preflightCompressIfNeededgains anoperatorWindowparam (post-self-heal tuned value from handle.ts); the fit proof now runs againstmeteringWindow = operator cap > raw native > undefined. Without an explicit setting the value ISresolvedNativeWindow— behavior unchanged. Proven upstream evidence still clamps lower vialimit(thecompress.modelContextLimit(1,150,000) andproviders.<url>.models.deepseek-flash.context(1,300,000) yield inconsist |compress.modelContextLimit(1,150,000)和providers.<url>.models.deepseek-flash.context(1,300,000)两判定不一致 #5191 owner ruling is untouched).operatorWindowTuned, written besideeffectiveContextLimiton every full-pipeline request (tri-state: a no-model request leaves a prior modeled turn's stamp untouched). The egress fuse sizes the bar atcap × 7.5 B/tok(min 2 MB) WITHOUT the 1M anti-guess floor for such sessions and names the setting in its 413; non-operator sessions keep the floor byte-for-byte (Context Window Overflow Issue Summary: Raw Requests Sent Directly to Upstream Rejected + Local Intercept Cooldown Lockin | 上下文超窗问题汇总:请求裸冲上游被拒 + 本地拦截冷却锁死会话(统一分析入口) #4079 test regexes untouched).dsh-native.ts:effectiveContextWindowhonours the GLOBAL-levelcompress.modelContextLimit(absolute, or "N%" of the cached info window; no info window + percent/garbage → arm disabled, never guessed).resolveContextLimitValuemoved toutil.tsso the host-injected bundle shares the exact resolution without pulling kernel pack machinery into the host process;compress-settings.tsre-exports it for existing importers. Route/model-level overrides deliberately stay proxy-side. Side effect: the proxy'spluginWindowsource now reports the cap, so the whole existing chain (native chain → headroom → stamps) sizes off it in plugin lanes.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-levelmodelContextLimitfallback. Route/model-level compress overrides unchanged (proxy-side only).Behavior changes (old → new)
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 namingcompress.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).x-bili-plugin-context-windowreflect 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.armMeasuredBar/gateMeasuredBar(+ its relay fuse token tier) still use rawresolvedNativeWindow; they need a 2-line rewire tometeringWindow ?? 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).