Skip to content

[PR] fix: scope Responses summary image notes to each occurrence - #7797

Open
Afloat16 wants to merge 1 commit into
ranxianglei:masterfrom
Afloat16:2026-11-26_scope-responses-image-notes
Open

Afloat16 wants to merge 1 commit into
ranxianglei:masterfrom
Afloat16:2026-11-26_scope-responses-image-notes

Conversation

@Afloat16

Copy link
Copy Markdown
Contributor

⚠️ MODEL-FACING TEXT CHANGE

Existing image notes now describe only the image owned by each split Responses core. Their format is unchanged; false sibling-image descriptions and duplicated recovery refs are removed from preflight summaries and folded-image footers.

Fixes #7796

Problem and change

Responses image cores retain the complete source item as a sidecar. The summary walker interpreted that shared carrier as each core's own images, producing N² notes and advertising unrelated screenshots under each recovery ref. Use the split core's own image metadata, retain one placeholder for a remote image, and keep the existing complete traversal for unsplit carriers and tool outputs.

Verification

  • Base ced22b1d2b0576ac3c6f8169f2ecbe9f3d8f3a45: 5 behavior regressions fail, including a real fold and a loopback HTTP summary request; 14 controls pass.
  • Fixed: 96/96 related tests pass, including image recovery, all 26 existing wire-contract cases and 5 hermetic image E2E cases. No skips or cancellations.
  • Typecheck, build, unused-export/import-graph gates and git diff --check pass.
  • Actual PNG fixtures and codec projections verify distinct/repeated images, remote URLs, unchanged source sidecars and each emitted ref's recovery dimensions.
  • Reproducible helper benchmark (Node 24, 3 warmups, median of 9): a 64-image carrier produces 64 notes/1,727 bytes instead of 4096/110,591; placeholder generation falls from 4.07 ms to 0.37 ms. This measures the summary helper, not total request latency.

Independent standard-dependency CI on source dfac9bbbb2598a0e1dbbbb1b7a025133eb2d9549: all 3 jobs passed. The real-image lane passed 65 related cases, all 26 wire-contract cases and 5 image E2E cases. Ubuntu/Node 24 and Windows/Node 22 each passed 1,678 kernel tests, 275 pi-subagents tests, typecheck, build, thin-install and both static guards. No skips or cancellations in these suites.

The authoritative upstream full suite remains required. Existing full-CI blockers have been independently reproduced on unchanged base ced22b1d: the egress-authority-ladder fault-injection failure (already addressed by PR #7738) and the inc-canonical-pointers / msgid-lane-flow persistence-wait hangs (already addressed by PR #6818). Those separate fixes are not duplicated or folded into this change.

The real Codex four-phase E2E remains a before-merge requirement for this summary-pipeline change and needs an upstream environment with the required credentials. Loopback/hermetic coverage does not replace it. Human merge review applies; no auto-merge is requested.

Describe each split Responses image using its own sidecar instead of
walking the whole shared carrier. This keeps summary placeholders and
folded-image recovery refs aligned and removes the quadratic duplication
of notes for multipart messages.

Keep remote-image placeholders and unsplit/tool-output carriers intact.
Exercise actual codec projections, a committed fold, and the HTTP summary
path against each ref's recovery metadata.
@ranxianglei ranxianglei changed the title fix: scope Responses summary image notes to each occurrence [PR] fix: scope Responses summary image notes to each occurrence Nov 26, 2026
@ranxianglei ranxianglei added bug Something isn't working p2 scope/wiring labels Nov 26, 2026
@ranxianglei

Copy link
Copy Markdown
Owner

🤖 Powered by ework · qwen3.8-27b

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

查重: 不重复 — #7796 is the only open item on this symptom. Nearest neighbors, all closed: #6146/#6147 (Gemini tool-response images), #786/#781 (image placeholders in preflight), #6610/#6612 (note-lookup performance), and #6854 (the per-ref recovery index — the earlier half of this same mechanism family).

标签: bug, p2, scope/wiring, codex (functional defect with a workaround — deterministic noise/cost, not a p1 cache-leak class; fix sits in the host-side request pipeline src/image-note.ts, not the kernel; Codex is the client whose lane exercises the Responses wire and whose E2E is the stated pre-merge gate). Applied to this thread and to the GitHub source issue/PR.

Review — I checked out the PR head (dfac9bbbb) on top of current master ced22b1d (the PR is 1 commit ahead, 0 behind) and verified the claims independently:

  1. Direction (original issue): correct, and it fixes the root cause, not the symptom. The Responses split codec (kernel/src/wire/responses.ts:395) hands every split image core the WHOLE source item as its rawResponsesItem sidecar (shared with all siblings) plus its own imageBase64/imageMediaType. The summary walker messageImages (src/image-note.ts) had no own-image gate, so it walked the shared carrier as each core's own images → N² notes, each recovery ref advertising sibling images that the per-ref recovery index (scoped by [PR] fix: recover each Responses image from its own ref #6854) does not hold. The restore side already carried the identical imagePart === true gate (src/image-restore.ts:132) since [PR] fix: recover each Responses image from its own ref #6854; this PR aligns the summary walker with it.
  2. Regression review: I enumerated every messageImages path — anthropic image blocks, anthropic tool_result, openai chat, google, Responses unsplit user items, Responses tool outputs, split text cores (no rawResponsesItem), and all non-Responses dialects (no rawResponsesItem at all): every one of them falls through to the byte-identical full walk; the gate fires only on split image cores. Verified by the 14 control tests (all pass on the PR head) and by my own base check: on origin/master with the PR's test files, exactly 5 behavior tests fail (4 in the new file + 1 modified e2e) and the failure diffs show the sibling duplication (a core of a 3×5 image also notes [image: png 7x2 · m00002]). The PR's "5 behavior regressions / 14 controls" claim reproduces verbatim.
  3. Code: 7-line gate, why-comments matching the file's style, no new dependencies, no dead code. Two non-blocking observations: (a) the own-image predicate now exists in two walkers (src/image-note.ts:86 vs src/image-restore.ts:132) with different return types (ImageRef vs RestorableImage) — that is the pre-existing two-walker architecture, and mirroring the gate is the minimal consistent fix; (b) restore defaults a missing mediaType to image/png while the summary side leaves it undefined (bare [image] in the degenerate case) — unchanged from the old per-part behavior.
  4. Test validity: the tests have teeth — exact note strings, per-ref recovery dimensions asserted against each emitted note (images[0].width/height == note dims), a real fold path, and a loopback HTTP summary request. I ran them locally on the PR head: 5/5 new + 14/14 modified + 54/54 adjacent image suites + 29/29 wire-contract & preflight-image-budget + 5/5 hermetic image E2E + 10/10 runnable hermetic codex E2E (2 env skips: the overflow test needs a clean directory tree — this sandbox's workdir tree has an AGENTS.md above the hermetic cwd; the docker-attach test needs a running proxy). typecheck, build, git diff --check, unused-exports and test-import-graph gates all clean on the head.
  5. Model-facing text (⚠️ flagged, walked per the consumption chain): the note FORMAT is unchanged ([image: png WxH · mNNNNN]); only the count and the ref→image binding are corrected. The model copies the ref from a note into its next decompress({ imageRef }) call — under the old text it could anchor on a ref that does not hold the advertised image (phantom-image class); under the new text the note's dimensions match what the recovery index actually returns for that ref. Remote images still get a bare [image · mNNNNN] (unchanged — their bytes were never recoverable). No new numbers or refs introduced.
  6. Diff cleanliness: 3 files, every line on-topic (1 source + 2 tests); no whitespace churn, no lockfile/generated artifacts.

CI state (verified live, mirror cache 12:56 UTC): 0 failures on the head so far; the 12:51:57Z run batch shows cancellation/re-queue churn across the e2e lanes (8 cancelled, 20 queued, gate green) — no red signal. Consistent with the PR's own statement, the known full-suite base blockers (egress-authority-ladder fault-injection, inc-canonical-pointers/msgid-lane-flow persistence hangs) reproduce on the unchanged base and are addressed by still-open PRs #7738 and #6818 — so an inherited full-suite red on this head would be base-caused, not PR-caused.

Verdict: the fix is correct, minimal, and well-pinned; no regressions found in the reviewed paths. Mergeable once (a) CI is green on the head (modulo the known inherited base failures above) and (b) the author's stated pre-merge requirement — the real Codex four-phase E2E (ACP_TEST_E2E=1) with upstream credentials — is satisfied (not runnable in this sandbox). Auto-merge is not applicable (model-facing text + preflight/compact path); human merge, as the PR states.


八问(结构化审核)

  1. 是什么问题:Responses 车道的摘要图片占位注释(preflight 摘要输入 + 折叠图片尾注)对每个拆分图片 core 都会遍历共享的完整源 item,导致每个图片 ref 都宣称拥有全部兄弟图片(N² 条注释),注释内容与 [PR] fix: recover each Responses image from its own ref #6854 之后按 ref 划定的恢复索引不一致——虚假广告。
  2. 什么原因导致的:拆分编解码器(kernel/src/wire/responses.ts:395)给每个拆分图片 core 的 sidecar 是完整源 item(与兄弟共享)+ 自己的 imageBase64/imageMediaType;摘要遍历器(src/image-note.ts 的 messageImages)没有"只报自己"的门,把共享载体当成自己的图片遍历。恢复侧(src/image-restore.ts:132)在 [PR] fix: recover each Responses image from its own ref #6854 时已有同样的 imagePart === true 门,摘要侧一直没跟上——同一机制家族的两半,此 PR 补齐了另一半。
  3. 影响范围与严重程度:仅影响 Responses 车道、多 part 用户图片 item(拆成 ≥2 core)的会话。后果:摘要体积膨胀(64 图载体:4096 条注释/110KB → 64 条/1.7KB)、ref→图片 绑定虚假(模型可能锚定一个并不持有该图片的 ref 发起 decompress)、token 浪费。非数据丢失/缓存泄露类 → p2。
  4. 怎么修复的:在 messageImages 加 7 行门,镜像恢复侧:拆分图片 core(imagePart === true)只报自己的 sidecar 图片(内联)或一条裸占位(远程);其余形状(无标记/无 rawResponsesItem)走原封未动的全量遍历。
  5. 是否有回归问题:逐条审过 messageImages 全部路径(anthropic 图块/tool_result、openai、google、Responses 未拆分 item、工具输出、拆分文本 core、其他方言)——全部字节不变(14 条对照测试通过;5 条行为变化全部是预期内的,且在 base 上独立复现)。折叠图片尾注在 手动 compress 仍接受零/负净收益折叠,先改写缓存再提示上下文增长 #2748 净收益门前略变小——方向正确(虚假质量减少,净收益门更不易误拒)。无 fail-fast 变吞错、无阈值/时序/输出格式漂移。
  6. 是否破坏缓存:仅含拆分 Responses 图片 core 的折叠,其摘要字节会变化(修复本身必然如此——旧摘要含虚假注释);其余会话注释字节不变,不影响任何既有缓存前缀。缓存失效/重试/去重/水位策略均未动。
  7. 是否改了设计方向:没有。摘要遍历器与恢复遍历器对齐(同一机制家族,[PR] fix: recover each Responses image from its own ref #6854),无架构/边界/数据流变化。
  8. 是否引入了新的配置:没有。

判定:可合(条件:head 上 CI 绿——已知继承性 base 失败除外;+ 作者声明的真实 Codex 四阶段 E2E 在有凭据的上游环境跑过;人工合并,不适用 auto-merge)。

This branch has not been deployed

No deployments
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 p2 scope/wiring

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Responses summary notes associate each split image with all siblings

2 participants