Skip to content

[PR] fix: separate SSE framing budget from summary content limit - #3683

Closed
WSXYT wants to merge 2 commits into
ranxianglei:masterfrom
WSXYT:2026-10-18_sse-summary-framing
Closed

WSXYT wants to merge 2 commits into
ranxianglei:masterfrom
WSXYT:2026-10-18_sse-summary-framing

Conversation

@WSXYT

@WSXYT WSXYT commented Oct 18, 2026

Copy link
Copy Markdown
Contributor

(ai: openai/gpt-6.1-sol)

Summary

  • Separate streaming SSE TRANSPORT overhead from the actual summary content budget in ConfiguredSummaryPlan.
  • Preserve existing JSON response caps; streaming uses a bounded8MiB floor instead of the undersized 4*summaryBytes+64KiB formula.
  • Keep executor summary-size enforcement unchanged. No request-content, tool-argument, signed-reasoning, kernel, config-schema, or persistence change.

Evidence and guards

The new framed2000-character/2048-byte summary regression failed on the old producer, then passed with this fix. Negative tests still refuse a wire body above8MiB and a2049-byte actual summary under a2048-byte summary budget. This is not an unbounded reader or a relaxation of summary-size validation.

Local installed repair also processed4 real historical ranges previously failing the response byte budget (about37781 estimated tokens saved). Two other selected ranges hit legitimate target/batch deadlines, accurately returned as partial failure. Private original bodies stayed local, with no diagnostic transcript replay.

Validation on this branch

Base: fresh upstream master1f0397b0. Focused five-file neighborhood:138 tests,137 passed,0 failed,1 Windows-inapplicable POSIX permissions test skipped. Dependency builds/pretypecheck, TypeScript, and build all exit0. The skipped case is not evidence of a pass. Full merge verdict remains remote CI on this pushed head.

Human review requested for the bounded transport allowance; no auto-merge, release, or npm publication requested. Single minimal source change plus three regression tests.

@WSXYT

WSXYT commented Oct 18, 2026

Copy link
Copy Markdown
Contributor Author

(ai: openai/gpt-6.1-sol) Related confirmed defect: #3682. The two post-fix partial-batch failures were target/batch timeouts, not response-byte-budget failures. Those genuine deadlines and the independent Codex-UA classification are not claimed fixed by this narrowly scoped PR.

@ranxianglei ranxianglei changed the title fix: separate SSE framing budget from summary content limit [PR] fix: separate SSE framing budget from summary content limit Oct 18, 2026
@ranxianglei

Copy link
Copy Markdown
Owner

🤖 Powered by ework · qwen3.8-27b

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

查重: 不重复。 用多组关键词(SSE framing / byte budget / external summary / response budget)检索了 open+closed issue 与 PR,无同症状同机制的条目。最近的邻居是 #3659(external-summary 失败诊断分类):同一子系统,但机制不同——它给失败记录补诊断信息,本 PR 修的是 SSE 逐 token 帧开销把 wire 字节顶过响应读取预算、导致流式目标被误拒。不重复。

标签: bug、scope/wiring、p2 —— 缺陷类;位置在对外部摘要 LLM 的出站 HTTP 边界(非 kernel);可用但需特定条件才触发(流式目标 + 非短摘要),故 p2。

审核进行中:已核对 diff 与既有代码——内容上限 maxSummaryBytes 由 executor 在 src/external-summary.ts:212(Buffer.byteLength(result.value,"utf8") > limits.maxSummaryBytes → invalid_summary)独立强制,本 PR 只放宽传输层读取上限、不动内容校验,方向成立。正在本地跑定向测试(tests/external-summary-runtime.test.ts),随后按八问给完整审核结论。

@ranxianglei

Copy link
Copy Markdown
Owner

🤖 Powered by ework · qwen3.8-27b

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

完整审核结论(新 head 970d2b92b,含跟进 commit「test: reject excessive framing…」)。先补一条关系澄清:#3682 是本 PR 的源 issue(同一缺陷的报告→修复),不是并行的竞争修复;建议 PR 正文加一句 Fixes #3682,合并后源 issue 自动关闭。你补充的边界说明(真实超时与 Codex-UA 分类不在本 PR 主张范围)与 diff 一致——diff 确实只动了预算公式与测试,无其他路径。

八问

  1. 是什么问题:外部摘要(external summary)配置了流式(SSE)目标时,合法摘要会被响应读取预算误杀——wire 字节数因 SSE 逐 token 重复帧元数据而膨胀,顶过旧上限后候选报 External summary response exceeds its byte budget 失败([external-summary] SSE framing exhausts HTTP byte budget before valid summary content reaches its limit #3682 有真实环境复现)。
  2. 什么原因导致的:传输层读取上限与内容预算被混进同一个公式(maxSummaryBytes*4+65536)。该公式只为 JSON 转义/元数据留了余量,而 SSE 的 wire 大小随「帧数×信封大小」增长,与内容长度是两条不同的增长曲线——用内容预算当传输上限,必然在流式下失真。
  3. 影响范围与严重程度:仅 external summary 用户中 stream:true 目标 + 非短摘要的组合;触发后该候选失败→failover/降级主模型摘要,不损坏数据、不影响非流式目标。p2。
  4. 怎么修复的:把两个预算在 plan 构造点拆开——JSON 候选保持旧公式不变;流式候选取 max(8MiB, 旧公式) 作为有界传输额度;内容校验仍由 executor 独立按 maxSummaryBytes 强制(src/external-summary.ts:212 → invalid_summary)。疏而非堵:读取守卫原样保留,只是额度不再混算。
  5. 是否有回归问题:逐项过过既有行为——非流式候选预算逐字节不变;executor 内容校验、重试(External summary credential feature entirely unusable + fully opaque failures + no retry | 外部摘要(externalSummary)凭据功能整体不可用 + 失败全程黑箱 + 无重试 #3488)、超时、failover、凭据解析均未触碰;kernel/config schema/persistence/wire/tool 参数/签名推理均未触碰。一处有意行为变更(披露):流式候选读取上限由 320KiB(默认配置)升至 8MiB;连带最坏瞬时内存 = 并发数×8MiB(默认并发 4 → ~32MiB),属可用性优先原则([Bug/Enhancement] Codex 超过 100 MiB 的请求在 ACP 处理前断开:希望返回明确 413 并支持配置字节预算(#2606 后续) #3128)下的有界代价。未发现无意回归。
  6. 是否破坏缓存:不涉及——不动会话状态、前缀缓存、去重键、增量游标。
  7. 是否改了设计方向:机制方向未变,只是把一个决策点拆成两个独立限额。开放的产品问题就一个:8MiB 固定下限。定量核对:默认 maxSummaryBytes=64KiB(≈16–22K token)即使病态的单 token 单帧也只需 ~4–5.5MB < 8MiB,余量充足;但若用户把 maxSummaryBytes 拉到接近上限 1MiB 且上游帧开销大,8MiB 理论上仍可能不够——届时行为是干净失败+failover,不是损坏。建议本次按固定下限合入(简单、覆盖默认场景),是否改为随 maxSummaryBytes 缩放留作后续观察项。
  8. 是否引入新配置:没有——无新 env/config 字段;8MiB 为内建常量(PR 已明确请求人工审这个值)。

验证证据(本地定向,非全量)

  • 新 head 上 tests/external-summary-runtime.test.ts 23/23 通过;tsc --noEmit 干净。
  • 回归测试有牙实测:临时把 src/external-summary-runtime.ts 换回 master 版本跑新增 SSE 三测 → 恰「SSE framing overhead…」一测失败(精确复现旧 producer 行为),另两测通过;随后还原。
  • 跟进 commit 对 test 2 的加强是对的:原版 raw 8MiB+1 不是合法 SSE,断言可能被「解析器拒绝」满足而非「读取守卫拒绝」;新版用合法 SSE(8MiB 注释行 + 合法小摘要)排除了这个混淆,移除读取上限时该测试才会红。
  • 远端 CI:新 head 上 guard/build 类 lane 已绿(14 success / 11 gated-skip),test 分片仍在排队运行,最终全量判定以 CI 为准,绿了我会补一条确认。

判定:代码、测试有效性、修复方向均成立;不满足 §7.4 auto-merge(引入新的默认阈值属产品决策,作者亦明确请求人工审)。待两件事:① 远端 CI 全绿;② owner 对 8MiB 传输额度拍板。二者齐即可合并。

@ranxianglei

Copy link
Copy Markdown
Owner

🤖 Powered by ework · qwen3.8-27b

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

CI 确认:新 head 970d2b92b 远端全量 CI 已跑完——40 个 check run 全部完成,28 success / 12 skipped(均为默认关闭的 gated e2e lane)/ 0 failed,含 ubuntu/windows × node 22/24 的全部 test 分片。

合并前剩余事项(均非代码问题):

  1. owner 对 8MiB 流式传输额度拍板(PR 已请求人工审此值);
  2. 建议正文补一句 Fixes #3682,让源 issue 随合并自动关闭。

审核结论维持上一条八问:代码、测试有效性、修复方向均成立,无回归;二者齐即可合并。

@ranxianglei

Copy link
Copy Markdown
Owner

(ai: zhipuai-lb/glm-5.3)

已并入合并列车 #4551(master 合并,merge commit 保留原作者署名)。本 PR 关单收尾;回滚点为 #4551 单提交 revert。

感谢 @WSXYT 的贡献——你的提交以原作者署名随列车进入 master(merge commit 方式),仓库贡献者列表可见。

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working p2 scope/wiring

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants