Skip to content

[PR] fix(responses): preserve compression-block parts across rebuilds - #4770

Closed
ReineLan wants to merge 9 commits into
ranxianglei:masterfrom
ReineLan:2026-10-26_responses-image-rebuild
Closed

ReineLan wants to merge 9 commits into
ranxianglei:masterfrom
ReineLan:2026-10-26_responses-image-rebuild

Conversation

@ReineLan

@ReineLan ReineLan commented Oct 25, 2026 •

Copy link
Copy Markdown
Contributor

(ai: openai/gpt-6)

A partial compression block can resurrect the first image instead of its surviving second image; reminted cores can also expand each image back into the whole original multipart carrier. Bind projected user cores to exact source parts and rebuild their current layout before full or projection-based encoding. Preserve caption metadata, image detail, source order and summary position. Complete unchanged carriers remain verbatim.

The regression exercises real blocks through full/short/full raw resends, genuinely new identical uploads, SessionStore cold loading, byte-exact archived-image retrieval and another resend. It also checks 1/2/12/17/26-part remint cases, partial survivors, adjacent carriers and identical pixels with different detail. All original PR tests are retained. The repair changes host projection/encoding; raw-kernel codec defect pins and kernel instance-identity policy are unchanged. Refs #4767.

Validation on head 54ae0fd, synchronized with upstream e4cc685: typecheck, build and 45 targeted cases pass, zero skips. Earlier integrated synthetic real-client/provider checks retained the memory code and image conclusion after compression. Full CI and original production-session recovery remain unverified.

The current diff contains only the host module and two test files. No kernel/configuration/version change. Existing contribution history is preserved with additive commits.

@ranxianglei ranxianglei changed the title fix: preserve single-carrier multipart runs in Responses full encoding [PR] fix: preserve single-carrier multipart runs in Responses full encoding Oct 25, 2026
@ranxianglei

Copy link
Copy Markdown
Owner

🤖 Powered by ework · qwen3.8-27b

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

查重: 不重复。本 PR 是 #4767(多图重建时每个幸存 core 重发全部 N 张图)的 host-scoped 子任务;当前没有其它 open PR 触碰同一 producer 路径(src/responses-tool-output.ts / full-encoding wrapper + tool-image patching)。kernel 侧修复(remint 后的 projection-insertion、partial survivor 的 original-part binding、多 source 重建)按 PR 正文所述仍留在 #4767 等 owner 批准,不在本 PR 范围。相关但不同:#4150、#4429、#4153/#4156。

标签: bug, codex, p1, scope/wiring(+已有 pr)——缺陷修复、wire 接线面;事故由 Codex 车道报告;p1 按 owner 2026-10-19 修订(缓存泄露类:26×26 图片重发 = 上下文失控增长,实测 6.2 MiB→69.8 MiB 单帧)。

审核进行中:外部贡献者 PR,按规范走独立全量审查(自己读 diff、既有行为回归清点、测试有效性),结论将以结构化八问跟进。

@ranxianglei ranxianglei added bug Something isn't working codex p1 scope/wiring labels Oct 25, 2026
@ranxianglei

Copy link
Copy Markdown
Owner

🤖 Powered by ework · qwen3.8-27b

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

PR 审核结论(独立审核,非复述 issue)

方向关(①):打到了本条产线的根因。#4767 的 N×N 图片重复有两个宿主侧产线:全量编码路径(无 projection 时走 coreToResponsesWithToolImages)与 kernel projection-insertion 分支。本 PR 修的是前者——宿主把同一载体拆出的连续 user cores 逐个喂给单核 codec,而 kernel 的单核分支没有来源归属信息、只能整载体重发。修法是把调用粒度从「每核一次」改成「同一载体的整段 run 一次」,命中 kernel 已有的 fullCover→逐字原文路径。这是宿主层调用粒度缺陷,不是 kernel codec 缺陷,归层正确。保留项诚实:多源相邻 run 维持旧编码(kernel 尚不能区分相邻不同源 item,批量会丢后续图片),有负向回归控制钉住;kernel 侧三条未决(projection-insertion、partial retention 后的原 part 绑定、多源重建)留在 #4767 等 owner 批准——PR 明确不关父 issue,边界干净。

回归关(②)——diff 触碰路径(src/responses-tool-output.ts 的 coreToResponsesWithToolImages)承担的既有行为逐项清点:

既有行为 结论
单核 user(display text 匹配 raw) 保持:长度 1 的 run 进 kernel 同一条 verbatim 分支
多源相邻 user cores 保持:size>1 门控仍走逐核旧编码(限制有意保留)
渲染摘要载体重音(#1999/#4166) 保持:仍在 codec 前 systemToUser,flush 前后显式隔离,顺序不变
工具图重建(#3400 rescale 豁免) 保持:rebuildToolImages 逻辑零改动,仍在其前后 flush
客户端原生 mid system/developer(#4166 逐字) 保持:不进 user-run 分支,仍走单核 codec 的 raw sidecar 路径
patchResponsesInputWithToolImages(projection 补丁路径) 未触碰
nudge/注入类合成 user core 邻接 split-carrier run 的边缘 核实不可达:nudge-inject 节点只 stamp state/effects 不追加消息;continuation nudge 走独立 retry body;#3400 读图回填载体自带 rawResponsesItem 且跟在 tool 消息后。即便命中,合并产物也是合法 wire 且跨轮确定性稳定

高危模式逐项:无 fail-fast 变吞错、无阈值/时序漂移、无意外输出格式变化。

⚠️ 行为变更披露(Deliverables 第 4 条):单一载体的 multipart user run,出站形状从「N 个 singleton item(每个都重发全部图片)」变为「1 个逐字原文 item」。内容字节等价(verbatim 原文),且跨轮确定、对前缀缓存更友好;这正是修复目标,不是漂移。

代码关(③):命名达意(run/sources/flush),无死代码,注释讲为什么并带 #4767 出处,风格与仓库一致,无新依赖,函数短小。外部提交从严清单全项通过。

测试关(④):6 个新测试全部 deepEqual 带牙——断言精确 wire item 含 annotations/detail 字段,覆盖 1/2/26 图、双适配器文本协议、工具图边界两侧、相同图实例、空历史+普通邻居、摘要载体隔离;负向控制(相邻异源载体不得丢后续图片)满足 #3617 双向门禁纪律。独立复跑:responses-tool-images + issue3400-image-rescale + issue564-responses-ordering + responses-empty-messages + responses-plugin-dev-position 51/51 通过;typecheck、生产构建、git diff --check 在 head affc3fbb 全绿。全量回归以 CI 为准。

diff 整洁度(⑤):2 文件 +103/−3,每一行都与本 PR 目的相关,无跑题/空白噪声。


结构化八问

  1. 是什么问题:含多图的用户消息被压缩拆成多个核后,宿主 Responses 全量编码路径逐核调用 codec,每个核都把整个原始载体重发一遍——26 张图变 676 张,文本 part 元数据顺带丢失。
  2. 什么原因导致的:宿主包装器按「每核一次」调单核 codec;kernel 单核分支没有来源归属信息,无法知道该核对应原文哪个 part,只能退化整载体重发。是宿主调用粒度问题,kernel 批量路径(fullCover→逐字原文)本来就正确,只是没被用到。
  3. 影响范围与严重程度:Codex 车道(Responses 协议)、会话含多图用户 item 且请求走全量编码路径时触发;p1 级——现场事故 6.2 MiB→69.8 MiB 帧 + HTTP 1009 断连([Bug][Responses] Multi-image rebuild duplicates the original carrier and misbinds partial survivors #4767)。注意:另一条产线(kernel projection-insertion)合并本 PR 后仍存在,而 [Bug][Responses] Multi-image rebuild duplicates the original carrier and misbinds partial survivors #4767 分析指出主 relay 通常带 projection,即生产常见路径可能要到 kernel 侧修复落地才完全消除 N×N。
  4. 怎么修复的:宿主包装器改为累积同一载体的连续 user cores 成一段 run,sources.size===1 时整体批喂 codec(命中 kernel 既有 verbatim 路径);多源 run 维持旧编码避免真丢图;摘要/工具图/非 user 核各自 flush 隔离,其余路径字节不变。
  5. 是否有回归问题:无。上表六项既有行为全部保持,唯一变更即第 4 条披露的有意去重;合成消息邻接边缘经核实不可达。
  6. 是否破坏缓存:否。去重让同一图片从 N 份变 1 份,wire 更稳、前缀缓存更友好;ref/id 分配不变(codec 内部未动)。
  7. 是否改了设计方向:否。宿主层限定,kernel/ 零改动,无配置面/env 新增;kernel 侧残留继续在 [Bug][Responses] Multi-image rebuild duplicates the original carrier and misbinds partial survivors #4767 跟踪。
  8. 是否引入了新的配置:否。

判定

审查通过,可合入——两个前置条件:(a) pushed head affc3fbb 的 CI 转绿(回帖时 pending,暂无失败);(b) owner 确认范围取舍——本 PR 只消除两条产线之一,建议先合(严格改进、爆炸半径小、单独可审、解锁全量编码车道),kernel projection-insertion 修复在 #4767 下另行推进,两者不互相阻塞。wire 变更,最终合入按惯例留人工 review 把关。

CI 若红,按 #4599 协调流程处理(master 红则 merge ci-fixes,自红则自修),结果回本帖同步。

@ranxianglei

Copy link
Copy Markdown
Owner

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

Review verdict: mergeable as a scoped partial fix (full structured review in #4767).

Verified independently on head affc3fb:

  • Regression reasoning over existing behaviors: systemToUser pre-scan equivalence (src/util.ts:617-628 is an element-wise map), mid-system non-summary path unchanged, pure-text split runs (sources.size===0) take the original legacy path, merged-shape single-core runs stay byte-identical (verbatim cond1), tool-image/acp_summary boundaries pinned by your new tests. No semantic drift found.
  • Targeted suites locally: tests/responses-tool-images.test.ts + responses-empty-messages + fix-781-summary-images + fold-images-archive + image-restore → 47/47 pass. Full-suite verdict remains CI's.

One finding to make explicit (already noted in the issue thread): the batching gate sources.size === 1 falls back to legacy per-message encoding whenever ANY adjacent user item shares the run — including the issue's own repro shape (independent opening user message before the carrier). Measured at affc3fb: that shape still emits 1600 images for a 40-image carrier. Your test matrix covers single-item bodies only, so CI stays green while the residual persists. This is documented and intentional (ambiguous multi-source runs left to the approved kernel work) — just consider expanding the one-line "ambiguous multi-source runs retain legacy encoding" into an explicit residual statement so the gap is discoverable from the PR body alone.

Also tracked separately: #4775 — the #4150 kernel fix (d9110fb) + judge-pin flip (533eb91) are stranded on branch 2026-10-21_issue4150-responses-image-drop and never landed in master or any release tag; the kernel work for #4767 should absorb them (the pin flip MUST travel with any codec behavior change or the master judge goes red).

@ranxianglei

Copy link
Copy Markdown
Owner

🤖 Powered by ework · qwen3.8-27b

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

Cross-check complete — the adjacent-shape residual is confirmed, independently reproduced at head affc3fbb74.

独立实测(合成夹具,与测试套件同构,无模型调用):

机制核对:sources 以整段连续 user run 内的 rawResponsesItem 对象身份计数,任何外来 user 核都会把 size 推到 >1 → 逐核 singleton 编码。保守门控本身是对的——kernel 的 partial-cover 路径按序消费第一个载体的图片部件,混合源 run 若强行批量会丢后续载体图片,负向控制测试钉的正是这一点。

对我此前结论的范围修正:「解锁全量编码车道」说大了。合并后去重仅覆盖「载体拆核独占一个单一来源 user run」的场景;run 中有任何相邻独立 user 项(含父 issue 自身的复现形态)维持合并前的 N×N 行为,直到 #4767 下获批的 kernel 源所有权工作落地。其余判定不变:零回归(fallback 路径与合并前字节一致)、生效处严格改进 → 仍作为范围受限的部分修复可合(人工合入)。

建议补进 PR 正文的显式残余声明(供作者粘贴,使缺口不读线程也可发现):

Residual (host-side, tracked under #4767): the batch gate keys on single-source runs. When any independent user item is adjacent to the carrier's split cores (e.g. an opening user message before the carrier — the #4767 repro shape), the run falls back to legacy per-core encoding and the N×N re-emission persists (measured at affc3fb: a 26-image carrier next to a plain user message still emits 676 images). Closing this requires kernel source-ownership exposure for split text cores; batching mixed-source runs host-side would lose later carriers' images.

#4775:已知悉——#4150 搁浅修复 + judge pin 翻转归属 #4767 的 kernel 决策(pin 翻转必须随任何 codec 行为变更走,否则 master judge 红);对本宿主侧 PR 无影响,此处不再另立项。

八问增量(相对上轮结论)

  1. 是什么问题:无新缺陷——确认的是本 PR 修复面的已知残余边界。
  2. 什么原因:批量门控刻意保守(仅限单一来源 run);混合源 run 缺 kernel 源所有权信息。
  3. 影响范围与严重程度:不变——残余形态在 kernel 工作落地前维持 p1 暴露;已修复面不受影响。
  4. 怎么修复的:本轮无代码改动;上方给出可直接粘贴的 PR 正文措辞。
  5. 是否有回归:本轮未引入(diff 未变);既有逐项清点结论继续有效。
  6. 是否破坏缓存:不涉及。
  7. 是否改了设计方向:否;残余收口仍走 [Bug][Responses] Multi-image rebuild duplicates the original carrier and misbinds partial survivors #4767 的 kernel 工作。
  8. 是否引入新配置:否。

判定维持:可合(人工合入),范围受限的部分修复;最终可合性仍以 pushed head CI 转绿 + owner 知悉上述范围边界为准。

@ranxianglei

Copy link
Copy Markdown
Owner

🤖 Powered by ework · qwen3.8-27b

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

CI 状态同步(第 3 轮):head affc3fbb 的 CI 出了判定——3 个分片红(test (windows-latest, 22, 3/4/5)),经逐测试名核对为继承性失败,不是本 PR 代码问题:

红分片 失败测试(逐名核对自 job log) 归属(#4599 在册簇)
w22s5 storage-render golden ×4(chat/anthropic/responses/google) 簇②(f590da9 engineLane,golden 未重录)
w22s4 storage-engine-proofs:full-mode restart ×4 + rollback contract + corrupt index.db #2771;plugin-fork「HTTP fork revision…」 簇①③(380ef4d restamp)+ A 族
w22s3 orphan-freeze cold load;web-blogfeed default probing;runLaunch opencode-inline 簇③④⑤

14 条失败全部落在 master bb7c24972 自身同 base 的在册红簇签名内;本 PR diff(src/responses-tool-output.ts + tests/responses-tool-images.test.ts)与这些失败文件(storage/persist/golden/blogfeed/launcher/plugin-fork)零交集,responses/image 相关套件在绿分片全过。

已处置:按 #4599 协调流程 merge origin/ci-fixes(tip 1fa93735d)进作者 fork 分支 0XCocoa:2026-10-26_responses-image-rebuild,零冲突、本 PR 两个文件未被合并触碰,本地 typecheck 绿,新 head e4a33ddf1,CI 重跑中。已在 #4599 留一行记录。

预期残留:opencode-inline(在册簇⑤,断言需平台分支、语义对齐待 owner 裁决)可能在重跑后仍单独红——若出现,按 #4599 先例归口该 issue,不构成对本 PR 的 blocker。

审核结论不变(见上轮八问):可合入的范围受限部分修复——wire 变更按惯例留人工 review 把关;残余边界(相邻独立 user item 的 N×N 保留至 kernel 源所有权工作落地)建议作者把上轮给出的 Residual 段落补进 PR 正文。等重跑转绿即满足 CI 前置条件。

ci-check and others added 5 commits October 26, 2026 10:15
Retain exact source-part ownership when surviving cores are reminted or split by a summary. Cover partial folds, raw resends, short-view recovery, genuinely new identical images, cold loading, and byte-exact archived-image retrieval.
@ReineLan ReineLan changed the title [PR] fix: preserve single-carrier multipart runs in Responses full encoding fix(responses): preserve compression-block parts across rebuilds Oct 27, 2026
@ranxianglei ranxianglei changed the title fix(responses): preserve compression-block parts across rebuilds [PR] fix(responses): preserve compression-block parts across rebuilds Oct 27, 2026
@ranxianglei

Copy link
Copy Markdown
Owner

(ai: vllm-qwen/qwen3.8-27b) Synced master into this branch (merge commit cbf9a3c, clean — no conflicts); branch is up to date with master and mergeable again, CI is running on the new head.

@ranxianglei

Copy link
Copy Markdown
Owner

(ai: vllm-qwen/qwen3.8-27b) Second update-branch sync: master (now at 44067a5) merged in cleanly with no conflicts — master touched none of this PR's files since the last sync. New head 48946f5 pushed; branch is up to date with master and mergeable again, CI running on the new head.

@ranxianglei

Copy link
Copy Markdown
Owner

Landed via batch PR #6464 (merged) — closing as superseded.

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

Labels

bug Something isn't working codex p1 scope/wiring

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants