Skip to content

[PR] fix: verify image spill bytes before advertising restore refs - #7036

Closed
Afloat16 wants to merge 2 commits into
ranxianglei:masterfrom
Afloat16:2026-11-17_verify-image-ref-bytes
Closed

Afloat16 wants to merge 2 commits into
ranxianglei:masterfrom
Afloat16:2026-11-17_verify-image-ref-bytes

Conversation

@Afloat16

Copy link
Copy Markdown
Contributor

Problem

A sole same-size/MIME spill is currently assumed to be the outbound image. After rescaling, its encoded size can coincide with a different original's size, so the archive note sends the model to that other image. Missing sole spills also produce unusable restore refs.

Change

Remove the size-only fast return. Apply the existing readable-byte comparison to every candidate, including a single candidate. Exact matches, multiple entries for one ref, and ambiguity across refs retain their existing semantics. No image identity, storage, configuration or kernel format changes.

Verification

  • Base: 301e1a5459a77d5578206927c8062a58381af642.
  • Seven new regressions: 3 fail / 4 pass on the base.
  • New and existing rescale, image-restore and WebSocket byte-budget suites: 59 passed.
  • The causal integration test creates real red and blue PNGs. A 2400×100 red image resizes to 1600×67, producing exactly the same 609-byte encoded length as the unrelated blue original. The normal rescale → byte-shed stages previously emit the blue image's m22222 in the red image's archive note. With the patch that unverified ref is omitted, the prior correct resize note remains, and reading m11111 still restores the exact red original. Inbound history stays unchanged.
  • Full npm run typecheck, npm run build, and git diff --check: passed.
  • Codex preflight found CLI 0.167.0-alpha.4 and the built artifact; the configured upstream 127.0.0.1:8199 is unreachable. The required real Codex four-phase acceptance remains a pre-merge gate and is not claimed as run.

Related #6089 addresses incomplete spill repair, #3706 byte-budget shedding, and #5754 the archive cap. None verifies the sole candidate's content against the outgoing image.

Fixes #7035

@ranxianglei ranxianglei changed the title fix: verify image spill bytes before advertising restore refs [PR] fix: verify image spill bytes before advertising restore refs Nov 17, 2026
Merge upstream master 6a641f3, including the architecture module-map and schedule-independent ranxianglei#2929 probe fixes.

Preserve the existing PR head and exact contribution patch. Validation of this refreshed head runs in upstream CI; no local test rerun is claimed.
@ranxianglei

Copy link
Copy Markdown
Owner

This fix is included verbatim (original commits and authorship preserved) in the merged batch PR #7074 — the changes are already on master. Closing to avoid a duplicate merge. 该修复已随批量 PR #7074 原样合入 master,为避免重复合并,关闭此 PR。

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Resized images can advertise the ref of a different same-size original

2 participants