Skip to content

fix(media): preserve converted images with HEIC filenames - #142263

Merged
steipete merged 1 commit into
mainfrom
codex/qa3-03-media-text-20260908
Sep 8, 2026
Merged

steipete merged 1 commit into
mainfrom
codex/qa3-03-media-text-20260908

Conversation

@steipete

@steipete steipete commented Sep 8, 2026

Copy link
Copy Markdown
Contributor
Additional instructions

This is a same-repository branch; maintainers can update it directly.

What Problem This Solves

Fixes an issue where users sending or viewing an already-converted PNG, JPEG, or WebP image would get unnecessary recompression when its original filename still ended in .heic or .heif. Even images already within the byte and dimension limits could lose their original bytes and metadata; an opaque PNG could also become a larger, lossy JPEG.

Why This Change Was Made

Remove the obsolete HEIC filename veto and its private argument plumbing. The existing detected-format, byte-budget, and dimension checks remain the authority for preserving supported originals. Genuine HEIC data still goes through conversion, including when its filename has a different suffix.

This deletes 18 production lines without adding another normalization path. The media documentation now describes retained HEIC filenames.

User Impact

Already-supported images keep their original quality, metadata, and bytes under stale camera filenames. Genuine HEIC conversion, image limits, transparency handling, and GIF behavior are preserved.

Evidence

The real public loadWebMedia flow was exercised before and after the change using synthetic PNG/JPEG files and a genuine HEIC file produced by macOS sips, with isolated state and temporary files:

Actual bytes and filename Before After
444-byte PNG, .heic or .heif Re-encoded as a 4,191-byte JPEG Exact original 444-byte PNG
3,288-byte JPEG, .heic or .heif Re-encoded as a different 2,573-byte JPEG Exact original 3,288-byte JPEG
1,907-byte genuine HEIC, .heic or .png Converted to JPEG Converted to the same 3,195-byte JPEG

The eight-case public-loader proof had four preservation failures before the deletion and zero afterward. The genuine-HEIC output hashes match before and after. No live channel send is claimed.

The existing original-format/EXIF/limit regression matrix was extended through the public loader: six stale-name cases failed on the original implementation while three normal-name controls passed. All 126 media-loader and image-adapter tests now pass. The complete changed-file gate, production and core-test type checks, typed lint, formatting, and docs indexing pass. Independent review explicitly run at P2 is scoped-clean, with the invocation and unchanged source hashes retained.

@clawsweeper

clawsweeper Bot commented Sep 8, 2026 •

Copy link
Copy Markdown
Contributor

🦞👀
ClawSweeper picked this up.

Pull request received. I will update this pull request when review starts.

ClawSweeper review complete

ClawSweeper finished reviewing this revision. The review result is being finalized.

View the workflow run.

@openclaw-barnacle openclaw-barnacle Bot added docs Improvements or additions to documentation size: XS maintainer Maintainer-authored PR labels Sep 8, 2026
@steipete
steipete marked this pull request as ready for review September 8, 2026 15:18
@clawsweeper clawsweeper Bot added P2 Normal backlog priority with limited blast radius. proof: sufficient ClawSweeper judged the real behavior proof convincing. rating: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. status: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR. labels Sep 8, 2026
@clawsweeper

clawsweeper Bot commented Sep 8, 2026

Copy link
Copy Markdown
Contributor

Codex review: needs maintainer review before merge. Reviewed September 8, 2026, 11:24 AM ET / 15:24 UTC.

ClawSweeper review

What this changes

Preserves acceptable PNG, JPEG, and WebP images with stale HEIC filenames, expands public-loader regression coverage, and documents the behavior.

Merge readiness

✅ Ready for maintainer review

This remains a useful, focused fix: pinned main and the latest release still reject preservation solely because of stale HEIC filenames. No blocking correctness or security findings were identified, and the supplied public-loader evidence supports the repair.

Priority: P2
Reviewed head: 5cecdc911640a121a3bf22288ee4f2bba5ad75f6

Review scores

Measure Result What it means
Overall readiness 🐚 platinum hermit (4/6) A narrow owner-level repair with meaningful regression coverage and relevant before/after loader evidence.
Proof confidence 🐚 platinum hermit (4/6) Sufficient (live_output): The captured macOS public-loader results directly exercise the changed preservation owner: stale-name PNG/JPEG inputs keep exact bytes after the fix, while genuine HEIC conversion remains unchanged; channel delivery is outside the claimed proof.
Patch quality 🐚 platinum hermit (4/6) No actionable review findings were identified.

Verification

Check Result Evidence
Real behavior Verified Sufficient (live_output): The captured macOS public-loader results directly exercise the changed preservation owner: stale-name PNG/JPEG inputs keep exact bytes after the fix, while genuine HEIC conversion remains unchanged; channel delivery is outside the claimed proof.
Evidence reviewed 7 items Introduced change and merge result: The independently inspected merge-base delta removes the private filename veto and its argument plumbing. The verified test-merge comparison against its main parent contains the same production change, without removing unrelated main-branch work.
Current main still needs the fix: Pinned main retains isHeicSource in the preservation predicate after actual-format validation; a stale .heic or .heif filename therefore forces otherwise acceptable images through encoding.
Latest release comparison: The supplied latest release, v2026.9.3, also contains the HEIC filename regular expression, helper, and preservation veto.
Findings None None.
Security None None.

How this fits together

OpenClaw’s shared media loader reads local files or remote media and prepares image bytes for downstream consumers. It detects the actual format and checks image limits before preserving originals or converting them.

flowchart TD
  A[Local file or remote media] --> B[Shared media loader]
  B --> C[Detect actual image format]
  C --> D{Supported format within limits?}
  D -->|Yes| E[Preserve original bytes and filename]
  D -->|No| F[Convert or resize image]
  E --> G[Downstream media consumer]
  F --> G
Loading

Before merge

None.

Agent review details

Security

None.

PR surface

Source -18, Tests +15, Docs 0. Total -3 across 3 files.

View PR surface stats
Area Files Added Removed Net
Source 1 1 19 -18
Tests 1 19 4 +15
Docs 1 1 1 0
Config 0 0 0 0
Generated 0 0 0 0
Other 0 0 0 0
Total 3 21 24 -3

Review metrics

None.

Technical review

Best possible solution:

Keep actual image format and existing byte/dimension limits authoritative, preserving accepted originals regardless of stale camera filename extensions.

Do we have a high-confidence way to reproduce the issue?

Yes: current-main source forces an in-limit PNG/JPEG/WebP named .heic or .heif through encoding. The supplied before/after loader observations corroborate that path; this review did not execute it.

Is this the best way to solve the issue?

Yes: deleting the obsolete private veto restores the existing preservation contract without adding a competing normalization path or changing public API signatures.

AGENTS.md: found and applied where relevant.

Codex review notes: model internal, reasoning medium; reviewed against b429ad36d3a9.

Labels

Label changes:

  • add P2: Repairs unnecessary image recompression and metadata loss for a bounded stale-filename case.
  • add proof: sufficient: Contributor real behavior proof is sufficient. The captured macOS public-loader results directly exercise the changed preservation owner: stale-name PNG/JPEG inputs keep exact bytes after the fix, while genuine HEIC conversion remains unchanged; channel delivery is outside the claimed proof.
  • add rating: 🐚 platinum hermit: Overall readiness is 🐚 platinum hermit; proof is 🐚 platinum hermit and patch quality is 🐚 platinum hermit.
  • add status: 👀 ready for maintainer look: ClawSweeper has no concrete contributor-facing blocker left for this PR. Sufficient (live_output): The captured macOS public-loader results directly exercise the changed preservation owner: stale-name PNG/JPEG inputs keep exact bytes after the fix, while genuine HEIC conversion remains unchanged; channel delivery is outside the claimed proof.

Label justifications:

  • P2: Repairs unnecessary image recompression and metadata loss for a bounded stale-filename case.
  • rating: 🐚 platinum hermit: Overall readiness is 🐚 platinum hermit; proof is 🐚 platinum hermit and patch quality is 🐚 platinum hermit.
  • status: 👀 ready for maintainer look: ClawSweeper has no concrete contributor-facing blocker left for this PR. Sufficient (live_output): The captured macOS public-loader results directly exercise the changed preservation owner: stale-name PNG/JPEG inputs keep exact bytes after the fix, while genuine HEIC conversion remains unchanged; channel delivery is outside the claimed proof.
  • proof: sufficient: Contributor real behavior proof is sufficient. The captured macOS public-loader results directly exercise the changed preservation owner: stale-name PNG/JPEG inputs keep exact bytes after the fix, while genuine HEIC conversion remains unchanged; channel delivery is outside the claimed proof.

Evidence

What I checked:

  • Introduced change and merge result: The independently inspected merge-base delta removes the private filename veto and its argument plumbing. The verified test-merge comparison against its main parent contains the same production change, without removing unrelated main-branch work. (src/media/web-media.ts:754, 69e4d90b7ced)
  • Current main still needs the fix: Pinned main retains isHeicSource in the preservation predicate after actual-format validation; a stale .heic or .heif filename therefore forces otherwise acceptable images through encoding. (src/media/web-media.ts:791, b429ad36d3a9)
  • Latest release comparison: The supplied latest release, v2026.9.3, also contains the HEIC filename regular expression, helper, and preservation veto. (src/media/web-media.ts:791, 1391f7cd2d40)
  • Preserved safety and format boundaries: The remaining predicate requires a supported detected format, compatible declared MIME, acceptable byte length, and acceptable dimensions. The loader still performs local access checks and MIME detection before optimization; genuine HEIC is outside the preservation allowlist. (src/media/web-media.ts:759, 5cecdc911640)
  • Behavioral regression coverage: The existing matrix now covers three actual formats with normal, HEIC, and HEIF extensions through both the public loader and optimizer, with and without hard dimension limits. It checks original bytes, MIME, filename, and rotated JPEG metadata. Tests were inspected, not executed during this read-only review. (src/media/web-media.test.ts:488, 5cecdc911640)
  • Supplied real-loader observations: The captured PR body reports an isolated macOS before/after run through loadWebMedia: stale-name PNG and JPEG inputs retain their exact original bytes after the fix, while genuine sips-produced HEIC converts to the same JPEG before and after. Eight cases went from four preservation failures to zero. This supports the loader boundary; no live channel delivery was claimed. (5cecdc911640)

Likely related people:

  • unknown: The claimed source-line change could not be verified from bounded local history. (role: source history unknown; confidence: low)

Rating scale

Score Internal tier Crab rank Meaning
6/6 S 🦀 challenger crab Exceptional readiness
5/6 A 🦞 diamond lobster Very strong readiness
4/6 B 🐚 platinum hermit Good normal PR; ordinary maintainer review
3/6 C 🦐 gold shrimp Useful, but confidence is limited
2/6 D 🦪 silver shellfish Proof or implementation needs work
1/6 F 🧂 unranked krab Not merge-ready
N/A NA 🌊 off-meta tidepool Rating does not apply

Overall follows the weaker of proof and patch quality.
Shiny media proof means a screenshot, video, or linked artifact directly shows the changed behavior. Runtime, network, CSP, and security claims still need visible diagnostics.

Workflow

  • ClawSweeper keeps one durable marker-backed review comment per issue or PR.
  • Re-runs edit this comment so the latest verdict, findings, and automation markers stay together instead of adding duplicate bot comments.
  • A fresh review can be triggered by eligible @clawsweeper re-review comments, exact-item GitHub events, scheduled/background review runs, or manual workflow dispatch.
  • PR/issue authors and users with repository write access can comment @clawsweeper re-review or @clawsweeper re-run on an open PR or issue to request a fresh review only.
  • Maintainers can also comment @clawsweeper review to request a fresh review only.
  • Fresh-review commands do not start repair, autofix, rebase, CI repair, or automerge.
  • Maintainer-only repair and merge flows require explicit commands such as @clawsweeper autofix, @clawsweeper automerge, @clawsweeper fix ci, or @clawsweeper address review.
  • Maintainers can comment @clawsweeper explain to ask for more context, or @clawsweeper stop to stop active automation.

@steipete
steipete merged commit 96d85fd into main Sep 8, 2026
374 of 377 checks passed
@steipete
steipete deleted the codex/qa3-03-media-text-20260908 branch September 8, 2026 15:59
@steipete

steipete commented Sep 8, 2026

Copy link
Copy Markdown
Contributor Author

Merged via squash.

vincentkoc added a commit that referenced this pull request Sep 8, 2026
* commit '04869ae4899ad0524c3287759798362b0d62fef8': (677 commits)
  fix(release): pin Kova census refresh (#142104)
  fix: doctor read-only database inspections time out on large agent databases (#142179)
  docs: align v2026.9.3 framing with release announcement (#142307)
  fix(ui): discover models when default-model pickers open (#142105)
  fix(ci): keep Docker upgrade seed baseline older than target (#142273)
  refactor(tests): reuse named OAuth credential fixtures (#142272)
  fix(ci): keep mobile release helpers out of source checks (#142115)
  chore(ui): refresh control ui locales (#142147)
  fix(active-memory): explain why recall was skipped (#138658)
  fix(media): preserve converted images with HEIC filenames (#142263)
  docs: add v2026.9.3 release notes (#142277)
  fix(ui): retire picker focus listeners together (#142258)
  fix(ui): keep menu hover colors consistent across themes (#142243)
  fix(release): keep changelog credits within verified history (#142261)
  fix: keep tool-finalizer placeholders private in message-only groups (#138645)
  perf(tui): carry prepared URL membership through rendering (#142262)
  test(ui): await activity cache imports before teardown (#142282)
  fix(qa): align auth and Workshop proofs with runtime contracts (#142280)
  feat(xai): use one curated catalog and concrete setup default (#142136)
  refactor(outbound): reuse prepared sendability facts (#142252)
  ...
github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Sep 9, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

docs Improvements or additions to documentation maintainer Maintainer-authored PR P2 Normal backlog priority with limited blast radius. proof: sufficient ClawSweeper judged the real behavior proof convincing. rating: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. size: XS status: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant