Repository navigation
[PR] fix: refuse provably over-window payloads at the send path — final window gate (#4079 PR①) - #4098
Closed
ranxianglei wants to merge 1 commit into
Closed
[PR] fix: refuse provably over-window payloads at the send path — final window gate (#4079 PR①)#4098ranxianglei wants to merge 1 commit into
ranxianglei wants to merge 1 commit into
Conversation
…sed locally #4079 fix-plan step 1 (PR①): extend the doomed-probe byte math (window×7.5 / absolute 2MB, #2490/#3146) from the two preflight escape branches to the forward() send funnel. Preflight judges on the calibrated ESTIMATE scale, so a systematically underestimated payload (dense content, wire-switch bloat #3872) or one that never triggered preflight (quiet baseline + sudden client-side growth) passed every local check and arrived at upstream as a guaranteed-reject multi-MB body (400/413). The gate prices the FINAL outbound core text in UTF-8 bytes — bytes/7.5 is a LOWER bound on token count, so exceeding the window at the lower bound means no tokenizer can fit it: honest local 413 (stage "send-window-guard") + LocalRefusalRecord for the scope, zero upstream calls. - initial send only: #1195 refold resends re-run preflight (incl. its own doomed check) against the upstream-STATED window further down - excluded lanes: passthrough (no declared window), side requests (#1110), Buffer bodies, GET/HEAD - deliberately does NOT arm the dead-end cooldown marker: deterministic byte math with zero upstream cost — re-evaluating on retry is free, a cooldown would only add lockout latency (#4079 Q3) - DOOMED_PROBE_* consts moved to preflight.ts (one source for all three doom sites); LocalRefusalRecord helpers extracted to src/local-refusal.ts (shared by server.ts and relay.ts) Addresses #4079 (hub fix-plan step 1). Implements #3872 option B (send-side final gate); #3872 option A (reconcile-triggered fold) stays open there.
Contributor
📦 Built Package ArtifactBranch: Option A — Install this exact build (recommended)npm install -g billion-context@0.0.4885-pr.4098.4c3d8daThis exact version is immutable and reproducible. The rolling Option B — Download artifact
tar xzf billion-context-pr4098.tgz
npm install -g packageInstall instructions are refreshed on each push. |
This was referenced Oct 21, 2026
Owner
Author
(ai: vllm-qwen/qwen3.8-27b) 关闭本 PR:与已并入 master 的 #4090 重复(同症状、同机制、同根因),按先来后到保留先到者。 本 PR 昨晚开出时做了出站查重但未命中 #4090——它的标题措辞是「egress window fuse」,与我的检索词不匹配;教训:出站查重要按失败签名/机制匹配,不能只按标题措辞。两者做的是同一件事:在最终发送点用同一套 doomed-probe 字节数学( #4090 胜出的三点:
本分支的机械重构(DOOMED 常量移入 preflight.ts、local-refusal 模块抽取)依附于闸门本身,闸门被吸收后无独立价值,不拆出单独立项。关闭。 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
(ai: vllm-qwen/qwen3.8-27b)
What & why
#4079 统一分析 fix-plan step 1 / PR①(发送侧最后一道窗口护栏),同时落地 #3872 option B(option A「换 wire 触发强制折叠」仍留在 #3872 讨论)。
Preflight 用校准后的估算尺判窗。两条路让超窗请求逃过所有本地检查、裸冲到上游被拒:
本 PR 在
forward()发送漏斗加一道字节数学兜底:把 preflight 两个逃生分支里已有的 doomed-probe 数学(max(2MB, window×7.5)字节,#2490/#3146)扩展到最终出站路径。机制(为什么零误伤)
estimateCoreMessagesUpperBytes,processed||original);bytes/7.5是 token 数的下界(7.5 = 线上观测到的最稀疏 bytes/token,Output clamp starves DSH compression despite ample actual context #2122/dsh压缩与bili压缩冲突 #2490)。下界都超过窗口 ⇒ 没有任何 tokenizer 能把它塞进窗口 ⇒ 拒绝在构造上就是对的,不是启发式;error.stage="send-window-guard",消息带 Context Window Overflow Issue Summary: Raw Requests Sent Directly to Upstream Rejected + Local Intercept Cooldown Lockin | 上下文超窗问题汇总:请求裸冲上游被拒 + 本地拦截冷却锁死会话(统一分析入口) #4079)+ 记LocalRefusalRecord(scope=origin+model+window,[Bug][preflight] Local 413 is forgotten when the baseline becomes an estimate, reopening oversized probes #3846)+ 零上游调用;行为变更披露(旧值→新值)
max(2MB, window×7.5)且 preflight 已放行(估算尺低估或触发缺失)的请求stage=send-window-guard,零上游调用,消息可读error.stage="send-window-guard"(既有stage="forward"5GiB cap 不变)误伤面:ASCII 为主的载荷在 preflight 阶段就会被先拦(est=bytes/4 > 1.875×window 时门必亮),所以门的增量价值集中在多字节密集内容与触发缺失路径——正是 #3872/#3900 的形状。
结构改动(机械抽取,行为不变)
DOOMED_PROBE_*常量从 server.ts 移到 preflight.ts(三处 doomed 调用点单一来源);LocalRefusalRecord三件套抽到新模块src/local-refusal.ts(server.ts 与 relay.ts 共用,避免 relay→server 循环依赖)。验证
tests/issue4079-send-side-window-guard.test.ts5/5(正负双向,Test Blind Spot Retrospective: Reinforcing Negative Assertion Discipline, Tightening Fake Upstream Strictness, Thin Inst | 测试盲区复盘:补反向断言纪律、假上游严格化、薄安装冒烟、形态矩阵与生命周期覆盖 #3617 门禁纪律:超限拒+零上游调用+记录 / 阈值下放+无记录 / passthrough 不变 / side 不变 / 无窗口戳不变);Addresses #4079(hub fix-plan step 1)· Implements #3872 option B · 查重: 无(open+closed 均无发送侧窗口护栏在途 PR/issue)