Skip to content

[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

Merged
ranxianglei merged 2 commits into
masterfrom
2026-11-08_measured-outbound-doom
Nov 8, 2026

Conversation

@ranxianglei

Copy link
Copy Markdown
Owner

一句话

超窗请求不再裸发上游:三道「转发仲裁闸」改按真实出站体逐字符 token 计量(含 system/tools/参数,CJK 感知),对照真实模型窗口本地 413;另外未压缩大请求纳入 32MiB 成本带准入。修 #5000 #4543 #5885 的「必然 400 的体被转发出去烧钱」与 #5794 的「51.2MiB/轮独占事件循环 → 自重启」。

背景:旧判据量的是投影,不是真实出站体

旧的三道 doom 闸全部用 estimateCoreMessagesUpperBytes(只累加消息核心文本的字节),结构性看不见 system / tools[] / tool_calls[].function.arguments / JSON 信封:

真实体的计量器其实早就存在(estimateRawBodyTokens,#554 侧车道同源尺子:走解析后请求体的全部字符串叶,CJK 感知,保守多计),但只用在元数据记账,没接到任何决策闸上。

改动(按机制)

A+B:三道转发闸按真实出站体计量

D:成本准入补路径

测试

说明与边界

Refs: #5000 #4543 #5885 #5794 #4185 #3146 #1839 #2313 #2490 #1001 #4079 #554 #3128 #496 #1800 #1117

@ranxianglei ranxianglei added the ci:full Run the FULL CI matrix (all e2e lanes + 12-leg test matrix) on this PR label Nov 8, 2026
@ranxianglei

Copy link
Copy Markdown
Owner Author

自评(默认流程,rule 11)

改了什么 / 为什么

自查结论

已知限制(如实)

  1. 任何一轮没有拿到 usage 报告的请求,都会把上下文分母放大 12–20×(nudge 读到 >1000% usage、假 EMERGENCY、基线冻结数分钟) #1839 臂守卫无 e2e:需要「估算过线/实测不过线」分歧,本库估算器与计量器同为 CJK-aware,harness 构造不出;守卫与三个已测档同逻辑 + 最终 fail-fast 兜底。
  2. estimateRawBodyTokens 保守多计(id/role/结构串也算),计量档只用于「拦必然超窗」,方向安全(宁可 413 不漏放);小体不误伤由 134K 适配例钉住。
  3. 计量档只覆盖解析成功的 JSON 体;非 JSON/解析失败走旧字节底线(fail-open 留给量不出来的,与 「BUG」native-intercept 进程级 globalThis.fetch 补丁按 URL 形状接管所有模型流量,无关调用者(如 MemOS)被卷入宿主压缩流程 #1117 语义一致)。
  4. [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 的 modelContextLimit 被忽略 = 独立缺陷,本 PR 不修(窗口解析链问题),另行跟进。

回归面:413 走既有 preflight_compress_failed 通道(handle.ts:2969-3008 包装),retryable:false,记 LocalRefusal;relay 熔断走既有 413 结构化体。无新 env 键、无配置面变化。

@github-actions

github-actions Bot commented Nov 8, 2026 •

Copy link
Copy Markdown
Contributor

📦 Built Package Artifact

Branch: 2026-11-08_measured-outbound-doom (6bc3ec5)

Latest build — install this exact version

npm install -g billion-context@0.0.8613-pr.5932.4e49b7e

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
6bc3ec5 billion-context@0.0.8613-pr.5932.4e49b7e build
d81ea73 billion-context@0.0.8602-pr.5932.236a7c9 build
c901a72 billion-context@0.0.8599-pr.5932.93f6f7c build

Download artifact

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

Install instructions are refreshed on each push.

@ranxianglei

Copy link
Copy Markdown
Owner Author

自评(默认流程,发现的小问题已直接修完;本条为评审记录)

改了什么(4 个机制,4+4 文件)

验证:tsc 干净;既有 89 用例(4 核心套件)+ 15 邻居套件 67 用例全绿(issue3013/2847/3384/3071/5278/preflight-round-budget/3918/4894/fix-arm-headroom-clamp/3846/496/1839-ghost/4205/fix-1001/767)。

自查发现并已处理的小问题

  1. 初版把取证探针闸(billion-context 卡死问题 —— 上报材料 usage获取不到导致上下文估计失误 #2313)也加计量档,用 1×limit 误伤 #2490c 控制例(37,672 计量 vs 20K 窗)——探针的一次 400 是设计内证据回路(模型切换后压缩块跨模型失配,新模型收到 61.3 万 token 全量上下文 #1001),已整段撤回,只留注释说明为什么不动(src/server.ts:4015)。
  2. 4185 新用例注释误写 "MEASURED-DOOM path fires first",实际走最终 fail-fast——已改为准确描述(gate-2 计量档 + 2.1M 才触发 doomed 字节档)。
  3. request-body-budget 原两个顶层并发测试共享模块级槽位计数器互相饿死——已合并为单顺序两阶段用例。

已知限制(如实报告,不修)

行为变化清单:必然超窗且量得出的体 → 本地 413(原先会转发/裸发);量不出的体 → 旧行为不变;未压缩 >32MiB 体 → 占成本准入槽位(原先只有 >5GiB 才占);探针/图片仲裁/小体量直通 → 逐字节不变。

@ranxianglei

Copy link
Copy Markdown
Owner Author

自评(rule 11 默认流程:直接发评审,小问题已在分支上修完)

自查发现并已修(同一 commit c901a72 内)

  1. 探针闸初版加计量档 → 撤掉:先把 billion-context 卡死问题 —— 上报材料 usage获取不到导致上下文估计失误 #2313 取证探针闸也加了计量 413(1×limit),跑测发现 2490c 控制例(37,672 计量 / 20K 窗)被误杀——探针的一次 400 是设计内的证据回路(billion-context 卡死问题 —— 上报材料 usage获取不到导致上下文估计失误 #2313/模型切换后压缩块跨模型失配,新模型收到 61.3 万 token 全量上下文 #1001,拿真实 usage/overflow 证据避免瞎压),不是漏。已整段撤回,保留字节契约 + 注释说明为什么不动(src/server.ts:4015)。
  2. 4185 新用例注释纠错:300K 例的注释原写 "MEASURED-DOOM path fires first",实际该例走 gate-2 计量档([Bug] 新会话(无 usage 基线)preflight 把字符数当 token——折叠其实成功(2263796→1111212)却 fail-fast 502,上游实际只计费 540828 #3146 块),最终 fail-fast 只在 2.1M 例出现——注释已改准确,防止后来人误读。
  3. request-body-budget 测试结构:原两个顶层并发测试共享模块级 2 槽计数器会互相饿死,已合并为单顺序两阶段用例(收件上限阶段 + 32MiB 成本带阶段)。

已知边界(如实报告,不掩盖)

回归面

给合并者的提示

@ranxianglei ranxianglei changed the title 超窗请求不再裸发上游:三道转发闸按真实出站体计量 + 大请求 32MiB 成本带准入 (#5000 #4543 #5885 #5794) [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) Nov 8, 2026
@ranxianglei

Copy link
Copy Markdown
Owner Author

自评(rule 11 默认流程:直接发评审,小问题已在分支上修完)

自查发现并已修(同一 commit c901a72 内)

  1. 探针闸初版加计量档 → 撤掉:先把 billion-context 卡死问题 —— 上报材料 usage获取不到导致上下文估计失误 #2313 取证探针闸也加了计量 413(1×limit),跑测发现 2490c 控制例(37,672 计量 / 20K 窗)被误杀——探针的一次 400 是设计内的证据回路(billion-context 卡死问题 —— 上报材料 usage获取不到导致上下文估计失误 #2313/模型切换后压缩块跨模型失配,新模型收到 61.3 万 token 全量上下文 #1001,拿真实 usage/overflow 证据避免瞎压),不是漏。已整段撤回,保留字节契约 + 注释说明为什么不动(src/server.ts:4015)。
  2. 4185 新用例注释纠错:300K 例的注释原写 "MEASURED-DOOM path fires first",实际该例走 gate-2 计量档([Bug] 新会话(无 usage 基线)preflight 把字符数当 token——折叠其实成功(2263796→1111212)却 fail-fast 502,上游实际只计费 540828 #3146 块),最终 fail-fast 只在 2.1M 例出现——注释已改准确,防止后来人误读。
  3. request-body-budget 测试结构:原两个顶层并发测试共享模块级 2 槽计数器会互相饿死,已合并为单顺序两阶段用例(收件上限阶段 + 32MiB 成本带阶段)。

已知边界(如实报告,不掩盖)

回归面

给合并者的提示

@ranxianglei

Copy link
Copy Markdown
Owner Author

CI 失败修复(d81ea7389)

ci:full 四 lane 全挂同一个测试组合,已定位并修掉,两个失败同一根因、两层:

失败 1 — #3701 e2e: oversized WS frame is shed pre-send…(expected recovery to complete, got ["error"])
根因:#554 计量器 estimateRawBodyTokens 的二进制排除集(data/url/b64_json/file_data)漏了 image_url 键——responses 车道的图片 data-URL 直接挂在这个键上,16 张截图 ≈40MB base64 被当成 ~10M「文本 token」。我新加的出站熔断计量档(对比 1M 窗口下限)于是把本该走「shed → 1009 → 缩小重发」恢复路径的体 413 了。
修:image_url 补进排除集(src/preflight.ts:451),对齐 #554 注释本意「图片体排除、由 imageTokensInParsedBody 单独计费」。这同时修掉了侧车道/元数据记账对 responses 图片的双重计费。

失败 2 — #857 A: …image turn is released by the #496 hatch and recovers to real usage(413 !== 200)
根因:我在压缩后再检闸与 #1839 臂的比较式写的是 raw + imageTokens > 窗口——这个组合正好命中「文本过线、图片单独超窗」的形状,把 #496/#1800 的计费仲裁转发(故意转发、让上游按图片计费裁决、拿真实 usage/overflow 证据)提前 413 掉了。#857 A 就是这个契约的回归钉。
修:判死只比文本量(计量器排除图片后天然 text-only,不再加 imageTokens);图片单独超窗归仲裁域,行为与 master 逐字节一致。

误伤面确认:#5000(84 工具纯文本)/#4543(CJK 纯文本)/#5885(2M 纯文本)全部不含图片,计量档对它们的行为不变(本地 e2e 全绿)。

验证(本地,sanitized env):

等 ci:full 复跑。

@ranxianglei ranxianglei added bug Something isn't working p1 scope/wiring labels Nov 8, 2026
@ranxianglei

Copy link
Copy Markdown
Owner Author

🤖 Powered by ework · qwen3.8-27b

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

[bot] 🏷 中期报告(独立复审进行中,最终八问结论随后补)

查重:不重复——「超窗请求转发闸」主题在 open/closed issue 与 PR 中均无重叠项。
标签:已打 bug / p1 / scope/wiring(p1 理由:含 #5794 事件循环 FATAL 预防与必然超窗体本地拒收的可用性语义)。

独立验证进展(非复述自评):

  1. 在干净 worktree 以 CI parity 环境复现 shard-1 红:全量 374 文件跑出 3296 过 / 2 失败,与 CI 四 lane 只红 shard-1 的模式吻合,根因锁定为两个既有回归钉被本 PR 的新计量档打破:
  2. 两个失败同机制:新增的「实测计量」档把不可靠的窗口基准(被污染的 confirmed limit / shed-重发场景)当成 bar,误杀了专为这些场景设计的既有恢复路径(PR #489 后续: 默认图片计费 b64/4 在像素 tile 计费上游(官方 Anthropic/OpenAI)会硬 502 误杀多模态会话 #496 hatch、[Bug] Jimp is active, but image accumulation still triggers Responses WS 1009; duplicate request size not reduced (v0.1. | [Bug] Jimp 已生效,图片累积仍触发 Responses WS 1009;重复请求未缩小(v0.1.200) #3701 shed-resend)——即「修 A 坏 B」类回归。
  3. 处置方向:在 PR 分支上直接修(收敛计量档的 bar 来源与豁免面),push 后看 CI,再补完整八问 review;CI Control Center: Centralized CI Failure Handling & Status Sync (Comment all CI issues here; do not open new issues) | CI 总控: CI 失败集中处理与状态同步(所有 CI 问题在此评论, 勿开新 issue) #4599 会留一行说明。

@ranxianglei ranxianglei added the dsh label Nov 8, 2026
@ranxianglei

Copy link
Copy Markdown
Owner Author

🤖 Powered by ework · qwen3.8-27b

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

查重: 不重复。镜像 open+closed issue/PR 检索(超窗/转发/413/计量/egress fuse/admission)与 GitHub open-PR 检索(request-body-budget)均无同机制条目。最近邻 #5613(dsh-gate 双档计价 422)是不同闸、不同尺子、不同状态码——互补,非重复。

标签: bug, dsh, scope/wiring, p1(四个源 issue 全在 dsh 车道;#5794 FATAL 自重启属「内存涨到进程死亡」类 → p1)

CI 状态(读镜像缓存 + 本地复现): 30 checks,26 绿(static-gates 全绿),4 红 = test shard "1" × {ubuntu,windows}×{node22,node24}。本地把 shard-1 全量跑完(3364 tests)复现同样 13 个失败。A/B 对照:同一批文件在 origin/master tip(354e21e23a)上跑出同样的 11 个失败 → 这 11 个是继承性 master 红,与本 PR 无关(两树 kernel/、pi-subagents/、package-lock.json 逐字节一致,排除构建漂移;master 领先的 10 个提交全是 docs/dsh-lane 小修,不触碰这些域)。本 PR 新引入 2 个:tests/issue857-image-baseline.test.ts A 用例(AssertionError '413 !== 200',:171)与 tests/issue3701-ws-byte-budget.test.ts e2e(expected recovery to complete, got ["error"],:440)——两者 master 上绿、PR 树上红。继承红按 #4599 政策协调/merge ci-fixes。

回归发现(拦下原因)——两个缺陷,同一根因家族:计量器把图片负载当文本计。

D1(机械缺陷,修法明确): src/preflight.ts:446 NON_TEXT_BODY_KEYS = new Set(["data","url","b64_json","file_data"]) 缺 Responses wire 的 image_url 键。四条标准图片线形:chat-completions image_url.url✓(命中 "url")、anthropic source.data✓、gemini inlineData.data✓、responses input_image.image_url✗(tests/issue857-image-baseline.test.ts:130 正是这个形状)。后果:4.4M 字符的 base64 被 estimateRawBodyTokens 按 ceil(len/4) ≈ 1.1M tok 计入 outboundRawTokens,而闸的判定式又是 outboundRawTokens + imageTokens > bar → 同一份图片被计两次。自评第 2 条「图片 token 单独计入(与原路径一致),不会与计量档双计」对 Responses wire 不成立。

D2(设计缺陷,需作者拍板并留痕): 闸的比较式把估算的图片量(+ imageTokens)纳入硬拒判据,与 #496 forward-once-learn 教义冲突——#857A 场景(毒化基线 fake confirmed 1,072,519 vs 真实窗口 1M + 一张计费 1.1M 的图片回合)旧行为是放行一次 → 真实 usage 回流 → 基线自愈;新行为是永久 413(直到用户手工裁剪)= 把自愈路径变成永久 stuck state,恰好在 #857 修的角落发生可用性回归。注意作者自己的探针闸注释(#2313 不加计量档)陈述的就是同一原则——「一次 400 是设计内证据回路」——但漏掉了 #496-hatch 与 #3701-shed-resend 这两个同类证据回路。选项:(a) 比较式去掉 +imageTokens,只拿文本计量对照窗口,图片超窗交还既有 image-arbitration/hatch 机制——推荐,与 #496「图片算术不进准入闸」一致,且 #5000/#4543 的体质量都在 tools/text 侧,不受影响;(b) 对 #496-hatch 释放路径豁免计量档(探针闸先例同款);(c) 重钉测试接受永久 413——不建议(可用性回归)。仅修 D1 后 #3701 应恢复绿(文本计量 « 1M 下限),#857A 是否仍红取决于 image-reserve 估计值,请作者修后实测两个套件确认。

已核实为真的部分(逐项过过): handle.ts admission.observe 插入点带完整守卫(非 passthrough、protocol 非空、body 非空),压缩路径经 onBytes 已喂过 → 幂等无双重计数;DecodedRequestBusyError 经 decErr catch 重抛 → 外层 catch 出 503 + retry-after:1 + request_body_busy(:442/:454);failFast 包装(:2969-3008)出 preflight_compress_failed 结构化体,retryable:false,413 不带 retry-after(仅 503 带 :30)——正确。typecheck 干净;定向 8 个测试文件 33/33 绿(issue4079/issue4185/request-body-budget/fix-arm-headroom-clamp/issue1839-ghost-denominator/issue2313-probe-forward/issue2490-ledger-floor-doomed-probe/issue496-forward-once-learn);134K 适配例保持 200(headroom 策略与物理窗口没混);探针闸未动且注释到位;admission 阈值 min(收件上限, 32MiB) 单调(运维调低仍生效)、MAX_LARGE_DECODED_REQUESTS=2 未动;尺子同源确认(kernel/src/tokenize.ts:5-13 CJK 1:1 + 其余 ceil(len/4),即 #554 守卫尺子)。

次要披露(非拦下项): 计量器保守多计 role/id/结构串(约 10-15 tok/条 ASCII 折算),马拉松高消息数会话若真实 input 落在 (窗口−overhead, 窗口) 区间,可能在仲裁点触发旧行为会放行且上游本可接受的局部 413。方向安全(宁可 413 不漏放),窄角落,自评已知限制 2 已披露,接受。

行为变更清单:

  • B1(有意): 文本计量超真实窗口的出站体,在三道闸从「转发上游赌一把/字节底线兜底」变为本地 413(preflight_compress_failed,retryable:false)——本 PR 目的。
  • B2(有意): relay 出站熔断新增 token 计量档(原仅字节底线),计量超 fuseWindow(声明窗口与 1M 下限取大)→ 413 egress_window_fuse,发送前拦截。
  • B3(无意回归,必须修): 含图片且图片负载被误计的回合(Responses wire)从「转发(自愈 hatch / shed-resend 恢复)」变为本地 413——D1+D2 所致。
  • B4(有意): 大解码体成本带准入阈值 = min(收件上限, 32MiB)(默认 5GiB 收件下 32MiB 生效)——新增成本约束,自评已披露。

流程缺口: #5885 defect 4(compress.modelContextLimit 被忽略)自评声明另行跟进,但 open+closed 检索未见已立的对应 issue——按交付规则 2 请补立(带来源标记)。


八问:

  1. 是什么问题: 三道转发闸只有粗粒度字节底线/估算档,「实测必然超窗但没过字节底线」的大体(dsh 全量重发宿主尤甚)被裸发上游,换来保证性的 400/413 浪费,甚至事件循环 FATAL 自重启([Bug][dsh][0.1.208] Kill switch / egress fuse only measures message.text: a session with 26,903 messages and only 1.44 M | [Bug][dsh][0.1.208] 判死/egress fuse 只量 message.text:26,903 条消息、core text 仅 1.44 MiB 的会话绕过 fuse 发出 55.2 MiB 请求体,被上游 413 拒收(ModelArts.… #5000/[Bug] CJK payloads slip past the egress byte-floor fuse: a 4.1 MiB outbound was forwarded at 1,121,674 tok into a 1,000,000-token window (0.1.206, plugin lane) #4543/[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/[perf][dsh] 51.2 MiB / 29.6k-msg inbound has no cost admission - DecodedRequestAdmission only sees compressed bodies | 51.2 MiB 入站没有成本准入:admission 只覆盖压缩体 #5794)。
  2. 什么原因导致的: 旧尺子只量 m.text 字节,看不见 tools/system/arguments 的真实线上传输量;字节底线粒度太粗(1M 窗口要 >7.5MB 才拦得住 CJK 体);admission 槽位只在压缩路径喂数据。
  3. 影响范围与严重程度: dsh 车道全量重发宿主 + 任何大 tools/大 CJK 体宿主;修复前严重(浪费转发 + 进程死亡级事故);当前 PR 状态引入 2 处可用性回归(多模态自愈路径被打断),修复 D1/D2 后净收益为正。
  4. 怎么修复的: 给三道闸加「真实出站体计量档」——side request(max_tokens<=200)绕过 preflight 且不检查载荷体积,携带全量历史直转上游导致 400 #554 同源 CJK-aware 尺子量解析后的出站 JSON(parsedBody 优先、JSON.parse 兜底),对照真实模型窗口(relay 用 1M 下限的 fuseWindow)本地 413 fail-fast;旧字节底线保留为解析失败兜底;handle.ts 对未压缩体补 admission.observe(幂等),阈值 min(收件上限, 32MiB)。
  5. 是否有回归问题: 有 2 处 PR 引入(D1 图片键排除缺口 + D2 图片量入硬拒判据),打断 #857A 自愈 hatch 与 [Bug] Jimp is active, but image accumulation still triggers Responses WS 1009; duplicate request size not reduced (v0.1. | [Bug] Jimp 已生效,图片累积仍触发 Responses WS 1009;重复请求未缩小(v0.1.200) #3701 WS shed-resend 两条已钉住的 golden 行为——拦下;另有 11 处 shard-1 失败系继承性 master 红(A/B 证实无关);其余既有行为逐项审过保持(探针闸、134K 适配例、retry-after 语义、admission 幂等、probe billion-context 卡死问题 —— 上报材料 usage获取不到导致上下文估计失误 #2313 证据回路未动)。
  6. 是否破坏缓存: 否。413 是本地拒绝不触发出站字节,不动前缀缓存锚点;计量档不改写任何转发内容;admission 槽位是进程内计数器。
  7. 是否改了设计方向: 无转向——沿用既有 preflight_compress_failed 通道与 413 结构化体,只把「何时拒绝」的判定面从估算扩到实测,与 side request(max_tokens<=200)绕过 preflight 且不检查载荷体积,携带全量历史直转上游导致 400 #554 尺子谱系一致。D2 的 (a)/(b) 选择涉及图片仲裁与计量档的边界划分,需作者定夺留痕。
  8. 是否引入了新的配置: 无新 env/config 键;LARGE_DECODED_ADMISSION_BYTES 是源码常量,运维仍走既有收件上限键。

结论:拦下。 合并条件:① D1——NON_TEXT_BODY_KEYS 补 image_url 并审计四条 wire 线形的全部图片承载键;② D2——图片量入闸语义拍板(推荐 (a) 文本计量对照窗口)并留痕;③ 修后本地跑绿 tests/issue857-image-baseline.test.ts + tests/issue3701-ws-byte-budget.test.ts;④ rebase 当前 master 并按 #4599 处理 11 处继承红;⑤ 补立 #5885-defect-4 跟进 issue。满足后转人工合并(agent 不合并不发布)。

@ranxianglei

Copy link
Copy Markdown
Owner Author

🤖 Powered by ework · qwen3.8-27b

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

第二轮审核:修复 commit d81ea73 已独立验证,两处缺陷均按第一轮建议关闭,CI 全绿。

修复核对(逐行读了 diff,6 files +24/−8)

独立验证证据(非转述作者自测)

  • 修复头 d81ea73 detach 复现:typecheck 干净(首次跑出现 3 个 TS7031 于 tests/zcode-memory-isolation.test.ts——该文件 PR 未触碰、与 master 字节一致,同头立即重跑即干净,判定本地构建产物瞬态抖动,非本 PR 缺陷,如实报备);
  • 定向跑 9 个相关套件(含此前红的两个:issue857-image-baseline、issue3701-ws-byte-budget):68/68 全过;
  • CI 镜像缓存 @d81ea7389:30/30 checks 全绿(failed 0 / pending 0),含此前红的 shard-1 四个 lane。

对第一轮「继承红」表述的一处修正:我在本地对 PR 头与旧 master 头 A/B 出的 11 个 shard-1 失败(fork-lineage/storage-render/nudge-fold/resume-inheritance),在 CI 上并不复现(本次 30/30 全绿,且这 11 个在本地当前 master 头上同样失败)——属本地环境特性,非 master CI 红、更非本 PR 引入。因此无需 merge ci-fixes(#4599 协调无此必要)。

合并前剩余两件事(均非代码缺陷)

  1. rebase 到当前 master:PR 头目前落后 origin/master 29 个提交(今日 docs 集中化、AGENTS slimming、[PR] fix(dsh): dsh lane minor fixes batch #5 — activation & other tool registration + liveness log wording | fix(dsh): dsh 车道小修合集第五辑 —— 激活等工具注册 + 存活日志措辞 #5921/[PR] fix(opencode): opencode lane minor-fixes roundup vol. 6 — log host noise + gate warmup round | fix(opencode): opencode 车道小修合集第六辑 —— 宿主杂音入日志 + gate warmup 回合 #5922 车道小修批次等,多为文档与车道小修,冲突风险低)——按 §7.2 纪律,以活 master 验证后再合。
  2. [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 后续 issue 仍未见立项:compress.modelContextLimit 被窗口解析链忽略是独立缺陷(CHANGELOG 也标注了「另行跟进」)。检索 tracker(modelContextLimit)未见专门条目;最近的 [PR] docs: clarify that top-level modelContextLimit / ACP_MODEL_CONTEXT_LIMIT are a last-resort window fallback (#5908) #5909(缺省 200K 低估自定义 provider 窗口)、[Bug][config] 0.1.212: stale-epoch overlay expands externalSummary with empty provider recipes ("known: none") and disables a valid chain #5912(冒号前缀网关模型 id 解析)、bili resolves the context window from its own registry and ignores the client's user-selected tier (300K / 600K / 1M) #4787(registry 覆盖客户端选档)机制各不同,不能顶替。请按交付规则第 2 条补一个带来源标记的 issue。

标签维持不变(bug/dsh/scope/wiring/p1 仍准确)。


八问(第二轮更新)

  1. 是什么问题:超窗请求(工具参数/CJK/大 base64 体)逃过纯文本估算器被裸发上游,换回 413/静默 400 或无界成本;三道转发闸原先只按估算 token 或粗字节底线判断。
  2. 什么原因导致的:估算器盲点(m.text-only 漏工具/CJK/二进制结构串)+ 字节底线粒度太粗(需 >7.5MB 才触发,CJK 高 token 密度体永远够不着)——计量与真实出站体脱节。
  3. 影响范围与严重程度:p1 级。凡出站体真实 token 超窗而估算未超的请求([Bug][dsh][0.1.208] Kill switch / egress fuse only measures message.text: a session with 26,903 messages and only 1.44 M | [Bug][dsh][0.1.208] 判死/egress fuse 只量 message.text:26,903 条消息、core text 仅 1.44 MiB 的会话绕过 fuse 发出 55.2 MiB 请求体,被上游 413 拒收(ModelArts.… #5000 84 工具 55.2MiB、[Bug] CJK payloads slip past the egress byte-floor fuse: a 4.1 MiB outbound was forwarded at 1,121,674 tok into a 1,000,000-token window (0.1.206, plugin lane) #4543 CJK 4.1MiB、[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 2M 体、[perf][dsh] 51.2 MiB / 29.6k-msg inbound has no cost admission - DecodedRequestAdmission only sees compressed bodies | 51.2 MiB 入站没有成本准入:admission 只覆盖压缩体 #5794 51.2MiB/轮)全部中招;修复后这些流量在本地以 413 preflight_compress_failed(retryable:false)拒绝并记 LocalRefusal,不再裸发。
  4. 怎么修复的:三道闸新增「真实出站体计量档」(parsedBody 优先、JSON.parse 兜底,side request(max_tokens<=200)绕过 preflight 且不检查载荷体积,携带全量历史直转上游导致 400 #554 同源 CJK-aware 尺子,对照真实模型窗口本地 413),旧字节底线保留为解析失败兜底;32MiB 成本带准入(min(收件上限, 32MiB),单调)。第二轮修正:计量排除集补 image_url(消除 responses 线双重计费);判死只比文本量(图片归仲裁域,与 master 行为对齐)。
  5. 是否有回归问题:第一轮发现 2 处(D1 双重计费、D2 误伤 PR #489 后续: 默认图片计费 b64/4 在像素 tile 计费上游(官方 Anthropic/OpenAI)会硬 502 误杀多模态会话 #496/疑似#767后续:图片计价高估会使preflight自动压缩永久失效,同时请求仍被转发 #1800 证据回路)均已修并有回归钉;本轮 68 个定向用例全过 + CI 30/30 全绿;探针闸 billion-context 卡死问题 —— 上报材料 usage获取不到导致上下文估计失误 #2313 刻意不动(一次 400 是设计内证据回路);纯文本形状([Bug][dsh][0.1.208] Kill switch / egress fuse only measures message.text: a session with 26,903 messages and only 1.44 M | [Bug][dsh][0.1.208] 判死/egress fuse 只量 message.text:26,903 条消息、core text 仅 1.44 MiB 的会话绕过 fuse 发出 55.2 MiB 请求体,被上游 413 拒收(ModelArts.… #5000/[Bug] CJK payloads slip past the egress byte-floor fuse: a 4.1 MiB outbound was forwarded at 1,121,674 tok into a 1,000,000-token window (0.1.206, plugin lane) #4543/[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-defect3)行为不变,由既有 e2e 钉住。
  6. 是否破坏缓存:不涉及——未触碰缓存/重试/增量游标/去重键语义;413 走既有 preflight_compress_failed 通道,relay 熔断走既有 413 结构化体。
  7. 是否改了设计方向:无架构转向。一处纠偏值得点名:图片单独超窗不在这两道闸判死,留在计费仲裁转发域(PR #489 后续: 默认图片计费 b64/4 在像素 tile 计费上游(官方 Anthropic/OpenAI)会硬 502 误杀多模态会话 #496 forward-once-learn 教义)——这是把第一版实现拉回设计意图,不是方向变更。
  8. 是否引入了新的配置:无新 env 键、无配置面变化(32MiB 为代码内常量,随收件上限单调取小,运维调低收件上限仍生效)。

判定:可合(代码缺陷清零、CI 全绿)——请人工合并;合并前完成上述两件事:rebase 当前 master 复验、补立 #5885-defect-4 issue。

@ranxianglei

Copy link
Copy Markdown
Owner Author

🤖 Powered by ework · qwen3.8-27b

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

第二轮核验完成:第一轮两个缺陷均已按建议修复,独立复核全绿。

D1(image_url 排除缺口)——已修。 src/preflight.ts:449 把 "image_url" 补进 NON_TEXT_BODY_KEYS,注释逐一列了四线形状(responses 扁平 image_url / chat image_url.url✓url / anthropic source.data✓ / gemini inline_data.data✓),与「审计四线全部图片承载键」的要求一致;另在 tests/side-request-isolation.test.ts 新增钉(estimateRawBodyTokens({image_url:dataURL})===0,直接钉住 responses 形状)。

D2(图片双计硬拒)——已修,采用选项 (a) 文本量比较。 两处闸 src/server.ts:4432 / :4532 改为 outboundRawTokens > bar(去掉 + imageTokens 项),注释写明 #496/#1800/#857 理由;错误消息改为 "TEXT tokens … images billed separately, never doom here";issue4079/issue4185 措辞钉同步更新;CHANGELOG 披露两处变更。与推荐方案逐字对齐:文本过线才判死,图片单独超窗归仲裁域,行为与 master 一致。

独立复核(不依赖自查结论):

更正第一轮记录:我列为「继承性 master 红」的 11 个本地失败,实际上 CI 并不复现(shard-1 四 lane 现已全绿)——它们是本地环境特定失败(在我本地测过的 master 三个谱系树 + PR 两棵树上一致复现,CI runner 不复现)。"与本 PR 无关"的结论不变,但定性从「master 红」更正为「本地环境特定」。

剩余两项(流程项,非代码):

  1. 分支落后当前 master 29 个提交(多为文档集中化 / lane 小修批)——按 §7.2 合并前请 rebase 到最新 master(冲突风险低,以非代码文件为主);
  2. [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(compress.modelContextLimit 被忽略)的跟进 issue 仍未立——我又检索了一遍 tracker,无专门条目(最接近的 [PR] docs: clarify that top-level modelContextLimit / ACP_MODEL_CONTEXT_LIMIT are a last-resort window fallback (#5908) #5909/[Bug][config] 0.1.212: stale-epoch overlay expands externalSummary with empty provider recipes ("known: none") and disables a valid chain #5912/bili resolves the context window from its own registry and ignores the client's user-selected tier (300K / 600K / 1M) #4787 均为不同机制)。请补立并带来源标记。

八问

  1. 是什么问题:超窗请求不再裸发上游;本轮处理的两个新缺陷都是计量档自身引入的(图片字节被当文本计量、图片量参与判死导致误拒)。
  2. 什么原因导致的:D1 = side request(max_tokens<=200)绕过 preflight 且不检查载荷体积,携带全量历史直转上游导致 400 #554 二进制排除集漏掉 responses 线的扁平 image_url 键 → 图片 base64 既当文本计一次又被 imageTokens 再计一次;D2 = 闸的比较式含估算图片量项,「文本过线、图片单独超窗」的体被提前本地 413,抢在 PR #489 后续: 默认图片计费 b64/4 在像素 tile 计费上游(官方 Anthropic/OpenAI)会硬 502 误杀多模态会话 #496/疑似#767后续:图片计价高估会使preflight自动压缩永久失效,同时请求仍被转发 #1800 计费仲裁转发(证据回路)之前。
  3. 影响范围与严重程度:若首提交版本合入,则任何「文本在窗内、图片单独超窗」的带图请求会被误拒(#857A 中毒基线自愈 hatch 与 [Bug] Jimp is active, but image accumulation still triggers Responses WS 1009; duplicate request size not reduced (v0.1. | [Bug] Jimp 已生效,图片累积仍触发 Responses WS 1009;重复请求未缩小(v0.1.200) #3701 shed 重发恢复路径被阻断,会话卡死而非收敛);纯文本请求([Bug][dsh][0.1.208] Kill switch / egress fuse only measures message.text: a session with 26,903 messages and only 1.44 M | [Bug][dsh][0.1.208] 判死/egress fuse 只量 message.text:26,903 条消息、core text 仅 1.44 MiB 的会话绕过 fuse 发出 55.2 MiB 请求体,被上游 413 拒收(ModelArts.… #5000/[Bug] CJK payloads slip past the egress byte-floor fuse: a 4.1 MiB outbound was forwarded at 1,121,674 tok into a 1,000,000-token window (0.1.206, plugin lane) #4543/[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 场景)不受影响。已修复,无残留。
  4. 怎么修复的:计量档排除图片字节(对齐 side request(max_tokens<=200)绕过 preflight 且不检查载荷体积,携带全量历史直转上游导致 400 #554 本意:图片由 imageTokensInParsedBody 单独计费);判死只比文本量,图片单独超窗回归仲裁域。
  5. 是否有回归问题:第一轮指出的两个回归钉([Question] 非白名单上游(如 DeepSeek)图片按 b64/4 估算,实测高估约 100×;且该估算被写回 lastInputTokens 并自愈成 confirmed 窗口,使 #496 逃生门永久失效 #857 A、[Bug] Jimp is active, but image accumulation still triggers Responses WS 1009; duplicate request size not reduced (v0.1. | [Bug] Jimp 已生效,图片累积仍触发 Responses WS 1009;重复请求未缩小(v0.1.200) #3701 e2e)转绿;定向 9 套件 68/68;CI 30/30;未发现新回归。
  6. 是否破坏缓存:否(转发闸本地判定,不动账本/缓存/重试策略)。
  7. 是否改了设计方向:否——计量档机制方向不变,仅修正比较口径(text-only)与排除集完整性。
  8. 是否引入新配置:否。

判定:可合(代码缺陷已解决、CI 全绿;rebase 最新 master 后由人工合并;#5885-defect-4 跟进 issue 请并行补立)。

@ranxianglei

Copy link
Copy Markdown
Owner Author

🤖 Powered by ework · qwen3.8-27b

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

第二轮审核:修复 commit d81ea73 已独立验证,两处缺陷按第一轮建议关闭,ci:full 复跑全绿。

修复核对(逐行读了 c901a72→d81ea73897 的 diff,6 files +24/−8,与第一轮 D1/D2 建议一一对应)

独立验证证据(非转述自测)

  • 修复头 detach 复现:typecheck 干净;定向跑 9 个相关套件(含此前红的两个:issue857-image-baseline、issue3701-ws-byte-budget)65/65 全过。透明备注:本地首跑 typecheck 曾在 tests/zcode-memory-isolation.test.ts 冒出 3 个瞬态 TS7031(该文件本 PR 未触碰、与 master 字节一致),同头立即重跑即干净、master 亦干净——判定本地环境抖动,非本 PR 缺陷。
  • CI 镜像缓存 @d81ea7389:30/30 checks 全绿(failed 0 / pending 0),含此前红的 shard-1 四个 lane。你留言里「等 ci:full 复跑」——结果已出:绿。

对第一轮「继承红」表述的一处更正:第一轮我在本地 A/B 出的 11 个 shard-1 失败(fork-lineage/storage-render golden/nudge-fold/resume-inheritance),今日在 master 最新头(028f870656)重跑仍 11/19 红,但 CI 上从未出现(本次全绿)→ 属本地沙箱环境特性,不是 master CI 红,更不是本 PR 引入。结论不变:与本 PR 无关;也无需 merge ci-fixes。

合并前剩余两件事(均非代码缺陷)

  1. rebase 到当前 master:PR 头目前落后 origin/master 29 个提交(今日 docs 集中化、AGENTS slimming、[PR] fix(dsh): dsh lane minor fixes batch #5 — activation & other tool registration + liveness log wording | fix(dsh): dsh 车道小修合集第五辑 —— 激活等工具注册 + 存活日志措辞 #5921/[PR] fix(opencode): opencode lane minor-fixes roundup vol. 6 — log host noise + gate warmup round | fix(opencode): opencode 车道小修合集第六辑 —— 宿主杂音入日志 + gate warmup 回合 #5922 车道小修批次等,多为文档与小修,冲突风险低)——按 §7.2 纪律以活 master 复验后再合。
  2. [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 后续 issue 仍未见立项:compress.modelContextLimit 被窗口解析链忽略是独立缺陷(CHANGELOG 也标注「另行跟进」)。我检索 tracker(modelContextLimit)未见专门条目;最近的 [PR] docs: clarify that top-level modelContextLimit / ACP_MODEL_CONTEXT_LIMIT are a last-resort window fallback (#5908) #5909(缺省 200K 低估)、[Bug][config] 0.1.212: stale-epoch overlay expands externalSummary with empty provider recipes ("known: none") and disables a valid chain #5912(冒号前缀网关模型 id)、bili resolves the context window from its own registry and ignores the client's user-selected tier (300K / 600K / 1M) #4787(registry 覆盖客户端选档)机制各不同,不能顶替。请按交付规则第 2 条补一个带来源标记的 issue。

标签维持不变(bug/dsh/scope/wiring/p1 仍准确)。


八问(第二轮更新)

  1. 是什么问题:超窗请求(工具参数/CJK/大 base64 体)逃过纯文本估算器被裸发上游,换回 413/静默 400 或无界成本;三道转发闸原先只按估算 token 或粗字节底线判断。
  2. 什么原因导致的:估算器盲点(m.text-only 漏工具/CJK/二进制结构串)+ 字节底线粒度太粗(需 >7.5MB 才触发,CJK 高 token 密度体永远够不着)——计量与真实出站体脱节。
  3. 影响范围与严重程度:p1 级。凡出站体真实 token 超窗而估算未超的请求([Bug][dsh][0.1.208] Kill switch / egress fuse only measures message.text: a session with 26,903 messages and only 1.44 M | [Bug][dsh][0.1.208] 判死/egress fuse 只量 message.text:26,903 条消息、core text 仅 1.44 MiB 的会话绕过 fuse 发出 55.2 MiB 请求体,被上游 413 拒收(ModelArts.… #5000 84 工具 55.2MiB、[Bug] CJK payloads slip past the egress byte-floor fuse: a 4.1 MiB outbound was forwarded at 1,121,674 tok into a 1,000,000-token window (0.1.206, plugin lane) #4543 CJK 4.1MiB、[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 2M 体、[perf][dsh] 51.2 MiB / 29.6k-msg inbound has no cost admission - DecodedRequestAdmission only sees compressed bodies | 51.2 MiB 入站没有成本准入:admission 只覆盖压缩体 #5794 51.2MiB/轮)全部中招;修复后这些流量在本地以 413 preflight_compress_failed(retryable:false)拒绝并记 LocalRefusal,不再裸发。
  4. 怎么修复的:三道闸新增「真实出站体计量档」(parsedBody 优先、JSON.parse 兜底,side request(max_tokens<=200)绕过 preflight 且不检查载荷体积,携带全量历史直转上游导致 400 #554 同源 CJK-aware 尺子,对照真实模型窗口本地 413),旧字节底线保留为解析失败兜底;32MiB 成本带准入(min(收件上限, 32MiB),单调)。第二轮修正:计量排除集补 image_url(消除 responses 线双重计费);判死只比文本量(图片归仲裁域)。
  5. 是否有回归问题:第一轮发现 2 处(D1 双重计费、D2 误伤 PR #489 后续: 默认图片计费 b64/4 在像素 tile 计费上游(官方 Anthropic/OpenAI)会硬 502 误杀多模态会话 #496/疑似#767后续:图片计价高估会使preflight自动压缩永久失效,同时请求仍被转发 #1800 证据回路)均已修并有回归钉(新增单测 pin + 既有 #857A/[Bug] Jimp is active, but image accumulation still triggers Responses WS 1009; duplicate request size not reduced (v0.1. | [Bug] Jimp 已生效,图片累积仍触发 Responses WS 1009;重复请求未缩小(v0.1.200) #3701 e2e 恢复绿);本轮定向 65/65 + CI 30/30 全绿;探针闸 billion-context 卡死问题 —— 上报材料 usage获取不到导致上下文估计失误 #2313 刻意不动(一次 400 是设计内证据回路);纯文本形状([Bug][dsh][0.1.208] Kill switch / egress fuse only measures message.text: a session with 26,903 messages and only 1.44 M | [Bug][dsh][0.1.208] 判死/egress fuse 只量 message.text:26,903 条消息、core text 仅 1.44 MiB 的会话绕过 fuse 发出 55.2 MiB 请求体,被上游 413 拒收(ModelArts.… #5000/[Bug] CJK payloads slip past the egress byte-floor fuse: a 4.1 MiB outbound was forwarded at 1,121,674 tok into a 1,000,000-token window (0.1.206, plugin lane) #4543/[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-defect3)行为不变,由既有 e2e 钉住。
  6. 是否破坏缓存:不涉及——未触碰缓存/重试/增量游标/去重键语义;413 走既有 preflight_compress_failed 通道,relay 熔断走既有 413 结构化体。
  7. 是否改了设计方向:无架构转向。一处纠偏值得点名:图片单独超窗不在这两道闸判死,留在计费仲裁转发域(PR #489 后续: 默认图片计费 b64/4 在像素 tile 计费上游(官方 Anthropic/OpenAI)会硬 502 误杀多模态会话 #496 forward-once-learn 教义)——这是把第一版实现拉回设计意图,不是方向变更。
  8. 是否引入了新的配置:无新 env 键、无配置面变化(32MiB 为代码内常量,随收件上限单调取小,运维调低收件上限仍生效)。

判定:可合(代码缺陷清零、CI 全绿)——请人工合并;合并前完成上述两件事:rebase 当前 master 复验、补立 #5885-defect-4 issue。

@ranxianglei

Copy link
Copy Markdown
Owner Author

🤖 Powered by ework · qwen3.8-27b

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

(补注:上面两条评论——「第二轮审核」与「第二轮核验完成」——是同一轮审核结论的两次投递,前一条发出后我补读了修复代码的精确行号又重新组织了一遍,属误发重复。两条结论一致(判定:可合;剩余事项:rebase 最新 master、补立 #5885-defect-4 issue),以较新的那条为准即可。)

@ranxianglei

Copy link
Copy Markdown
Owner Author

🤖 Powered by ework · qwen3.8-27b

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

说明:本条与上一条(09:10Z)是同一轮第二轮审核的两份独立结论(两个并行会话各自核验后各发了一条),结论完全一致——可合,剩余事项同为两件事:① rebase 当前 master 复验;② 补立 #5885-defect-4 跟进 issue。以任一条为准即可,无需重复处理。

CI 四 lane 全挂两个 e2e,同一根因两层:
1) estimateRawBodyTokens 的排除集漏了 image_url(responses 车道图片的 data-URL
   直接挂在这个键上)——40MB 截图体被当成 ~10M「文本 token」,我的出站熔断
   计量档把 #3701 的 WS shed+重发体 413 了;侧车道/元数据记账也双重计费。
   补进 NON_TEXT_BODY_KEYS,对齐 #554 注释本意(图片由 imageTokensInParsedBody 单独计)。
2) 压缩后再检闸与 #1839 臂的比较式 raw + imageTokens > 窗口 正好杀死了
   #496/#1800 的「文本过线、图片单独超窗 → 转发计费仲裁」契约(#857 A 回归)。
   判死只比文本量(计量器排除图片后天然 text-only),图片超窗归仲裁域。

tests: side-request-isolation 加 image_url 排除钉;两个实测档 e2e 的措辞钉
跟着新消息(TEXT tokens)更新。本地 244 用例全绿(857/3701/496/图片 173 +
核心 22 + 邻居 55)。
@ranxianglei
ranxianglei force-pushed the 2026-11-08_measured-outbound-doom branch from d81ea73 to 6bc3ec5 Compare November 8, 2026 09:28
@ranxianglei

Copy link
Copy Markdown
Owner Author

按 owner 要求以活 master(3ac3e95c0,含 #5917 first-byte-budget / #5922 opencode 小修 / #5936 docs nav)复验后 rebase:干净无冲突(#5917 只动上游 summary 调用的 first-byte 预算与 watchdog/preflight 日志,与本 PR 的计量档/熔断/准入不交叠)。本地 sanitized 回归:核心 6 套件(4079/4185/admission/857/3701/496)28/28 + doom 邻居 14 套件 66/66 + tsc 干净。新 tip:6bc3ec58f。等 ci:full。

@ranxianglei

Copy link
Copy Markdown
Owner Author

🤖 Powered by ework · qwen3.8-27b

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

第三轮核验:rebase 独立验证通过,两项合并前条件已全部满足。

rebase 完整性(不依赖自查,独立复核)

第二轮剩余事项销账

CI 状态:ci:full @6bc3ec58f8 运行中(30 checks,failed 0,pending 20——截至读取时刻无任何红项)。全绿后本 PR 即达「可合」终态。


八问(第三轮更新)

  1. 是什么问题:超窗请求不再裸发上游——三道转发闸按真实出站体计量 + 大请求 32MiB 成本带准入;本轮仅验证 rebase 后的合入就绪度。
  2. 什么原因导致的:旧判式只量消息核心文本字节,看不见 system/tools/arguments 的真实上传量;字节底线粒度太粗拦不住 CJK 高密度体。(沿用第一、二轮结论,未变。)
  3. 影响范围与严重程度:p1 级场景([Bug][dsh][0.1.208] Kill switch / egress fuse only measures message.text: a session with 26,903 messages and only 1.44 M | [Bug][dsh][0.1.208] 判死/egress fuse 只量 message.text:26,903 条消息、core text 仅 1.44 MiB 的会话绕过 fuse 发出 55.2 MiB 请求体,被上游 413 拒收(ModelArts.… #5000/[Bug] CJK payloads slip past the egress byte-floor fuse: a 4.1 MiB outbound was forwarded at 1,121,674 tok into a 1,000,000-token window (0.1.206, plugin lane) #4543/[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/[perf][dsh] 51.2 MiB / 29.6k-msg inbound has no cost admission - DecodedRequestAdmission only sees compressed bodies | 51.2 MiB 入站没有成本准入:admission 只覆盖压缩体 #5794)修复后在本地以 413 preflight_compress_failed 拒绝,不再裸发烧钱或拖死事件循环;rebase 未改变任何行为面。
  4. 怎么修复的:三闸计量档(side request(max_tokens<=200)绕过 preflight 且不检查载荷体积,携带全量历史直转上游导致 400 #554 同源 CJK-aware 尺子对照真实窗口)+ 32MiB 准入;图片排除出文本计量、判死只比文本量(PR #489 后续: 默认图片计费 b64/4 在像素 tile 计费上游(官方 Anthropic/OpenAI)会硬 502 误杀多模态会话 #496/疑似#767后续:图片计价高估会使preflight自动压缩永久失效,同时请求仍被转发 #1800 仲裁域保留)。rebase 后代码补丁经 range-diff 确认与原样一致。
  5. 是否有回归问题:两轮发现的全部缺陷已修并钉住;本轮 range-diff + 关键行抽查 + 48/48 定向复跑未发现新回归;与 [PR] Upstream hang on compressed summary no longer silent: added first-byte budget + watchdog/preflight logging (#5904) | 压缩摘要上游卡死不再静默:新增首字节预算+看门狗/预检日志(#5904) #5917(first-byte budget)的交叠判定为无(该提交只动上游 summary 调用的 first-byte 预算与日志路径,不碰计量档/熔断/准入)。
  6. 是否破坏缓存:否(转发闸本地判定,不动账本/缓存/重试策略)。
  7. 是否改了设计方向:否。
  8. 是否引入新配置:否(32MiB 为源码常量,随收件上限单调取小)。

判定:可合——两项合并前条件(rebase 活 master、补立 #5885-defect-4 issue)均已满足并经独立验证;ci:full @6bc3ec58f8 转绿后请人工合并(agent 不合并、不发布)。

@ranxianglei

Copy link
Copy Markdown
Owner Author

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

Heads-up from the #5937 fix (PR #5944): once that lands, this PR's measured-token bars need a 2-line rewire to honour an explicit session-level compress.modelContextLimit — armMeasuredBar / gateMeasuredBar (and the relay fuse token tier) currently use raw resolvedNativeWindow, while preflightCompressIfNeeded will then expose meteringWindow = operator cap > raw native > undefined. Suggested: rebase onto master after #5944 merges and switch those bars to meteringWindow ?? limit. Filed here rather than as a separate issue since it's the same mechanism family (metering bars ignoring the operator cap).

@ranxianglei

Copy link
Copy Markdown
Owner Author

🤖 Powered by ework · qwen3.8-27b

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

Heads-up received and independently verified — the claim is accurate, and my inspection refines the estimate slightly in your favor:

Verification

  • Claimed gap confirmed at our tip: armMeasuredBar (src/server.ts:4431) and gateMeasuredBar (src/server.ts:4531) are both resolvedNativeWindow > 0 ? resolvedNativeWindow : limit — raw native window, no operator-cap tier.
  • On PR [PR] fix: session-level compress.modelContextLimit now sizes every window consumer (#5937) #5944's head (fetched refs/pull/5944/head b6a90ab), meteringWindow is computed at src/server.ts:4459 (operator cap > raw native > undefined) inside the same function scope as both bars, so the suggested swap to meteringWindow ?? limit is mechanically clean and preserves today's behavior byte-for-byte for every session WITHOUT an explicit cap (cap absent → falls through to raw native, then limit).
  • The relay fuse token tier needs zero extra lines. Our token tier (src/server/relay.ts:744 fuseRawTokens > fuseWindow) consumes the SAME fuseWindow const that [PR] fix: session-level compress.modelContextLimit now sizes every window consumer (#5937) #5944 rewrites to be provenance-aware (operatorDeclared ? declaredWindow : max(declaredWindow, 1M), driven by the operatorWindowTuned metadata stamp). After the merge, our tier inherits operator-cap awareness automatically through that shared const. The entire seam is therefore exactly the two bar expressions, as you said.
  • Two small TEXTUAL conflict zones to union semantically during the rebase (both trivial): the server.ts neighborhood (your meteringWindow/nativeFitAfterClamp block sits adjacent to our two gate hunks) and the relay.ts fuseWindow line itself (your rewrite vs our token-tier insertion right below it).

Current state

Sequencing recommendation (owner decides)


八问(第四轮更新)

  1. 是什么问题:本 PR(超窗请求按真实出站体计量 + 32MiB 准入)与 [PR] fix: session-level compress.modelContextLimit now sizes every window consumer (#5937) #5944(会话级 compress.modelContextLimit 恢复消费)之间的接线缝——两道计量闸的判据目前用 raw native window,需改为 meteringWindow ?? limit。本轮为合并顺序决策请求。
  2. 什么原因导致的:两 PR 各自独立取窗;本 PR 立项时 meteringWindow 尚不存在([PR] fix: session-level compress.modelContextLimit now sizes every window consumer (#5937) #5944 未合),判式只能落在当时可用的 resolvedNativeWindow 上——属跨 PR 时序缝,非设计缺陷。
  3. 影响范围与严重程度:仅「显式配置了 compress.modelContextLimit 且出站体介于 cap 与原始窗口之间」的会话——修复缝之前这类体的计量闸按原始窗口判(与今天 master 行为逐字节一致,非回归);无显式配置的会话零影响。
  4. 怎么修复的:[PR] fix: session-level compress.modelContextLimit now sizes every window consumer (#5937) #5944 合入后,本分支一次 rebase 内完成两处判据改写(src/server.ts:4431/:4531 → meteringWindow ?? limit);relay 熔断 token 档经共享 fuseWindow 常量自动继承来源感知窗口,零改动。已独立核验 [PR] fix: session-level compress.modelContextLimit now sizes every window consumer (#5937) #5944 head 上 meteringWindow 与两闸同函数作用域,改法机械可行。
  5. 是否有回归问题:无显式 cap 时新判据退化为原值(raw native → limit 兜底链不变),行为逐字节保持;两处文本冲突区(server.ts 闸邻域、relay.ts fuseWindow 行)rebase 时语义并集解决,定向套件复跑验证。
  6. 是否破坏缓存:否(纯判据取值变更,不动缓存/重试/账本)。
  7. 是否改了设计方向:否——把本 PR 的计量档接进既有窗口优先级轴(上游证据 > operator cap > registry/native > 顶层 fallback)。
  8. 是否引入新配置:否。

判定:代码面全部就绪(ci:full 30/30 绿、rebase 坐活 master、#5939 跟进 issue 已立且修复 PR #5944 在途);剩唯一事项是合并顺序拍板——推荐 Option A(#5944 先合,本 PR rebase 时吸收 2 行改写后合入,不开第三个 PR)。owner 拍板后我立即执行对应动作。

@ranxianglei
ranxianglei merged commit fe963d7 into master Nov 8, 2026
64 checks passed
@github-actions

github-actions Bot commented Nov 8, 2026

Copy link
Copy Markdown
Contributor

📦 Merged Build Published

This merge to master was published as 0.0.1088-master.fe963d7 (rolling master tag).

npm install -g billion-context@0.0.1088-master.fe963d7  # this exact build
npm install -g billion-context@master  # always the newest merged build

npm view billion-context@master prints the current version at any time.

Louie0806 added a commit to Louie0806/billion-context that referenced this pull request Nov 8, 2026
…ess fuse

Upstream delta 3ac3e95..fe963d7 (10 files, 3 commits):
- 2e02110 fix: oversized requests are no longer forwarded blind — three forwarding
  gates meter the ACTUAL outbound body and a 32 MiB cost band gates admission
  (ranxianglei#5000 ranxianglei#4543 ranxianglei#5885 ranxianglei#5794)
- 6bc3ec5 fix: the meter also counts the responses lane image_url keys; the doom
  check compares text volume only (CI regression ranxianglei#3701/ranxianglei#857)
- fe963d7 Merge pull request ranxianglei#5932

The only overlapping file is src/server/relay.ts, and the two sides touch different regions: upstream adds measuredOutboundTokens() to the
forwardCaptured egress fuse (line 743), the lane keeps its non-streaming compact
egress on pipePluginJson (line 2097). Both verified present after the auto-merge.

kernel stayed at 0.0.187 and was rebuilt before measuring. Lane anchors intact:
src/server/relay.ts:2097 still calls `pipePluginJson(toClient, res, undefined,
prepared.protocol, ...)`, src/storage/mysql.ts:77 still exports MYSQL_SCHEMA_VERSION,
symbols unchanged (stripDriftResidue 6, isDraftDump 6, containsRenderTagText 21,
mayStartDegenerateRenderTag 6, DRIFT_BARE_MISMATCH 3, DRAFT_CLOSE_TAIL 3).

Gates: tsc 0, four guards 0, gen-config-docs fixed point.
Tests: issue5175 58/0, tag-echo 79/0, issue2190 32/0, golden-storage-render 5/0,
storage-engine-proofs 12/0, native-compact-terminal 1/0, issue4666 2/0, plus the four
upstream suites touched by this delta: issue4079-egress-window-fuse 4/0,
issue4185-identified-fresh-forward 5/0, request-body-budget 4/0,
side-request-isolation 34/0.
This was referenced Nov 8, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working ci:full Run the FULL CI matrix (all e2e lanes + 12-leg test matrix) on this PR dsh p1 scope/wiring

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant