Skip to content

fix: add resilient media processing fallbacks#83568

Merged
steipete merged 1 commit into
mainfrom
fix/media-sharp-fallbacks
May 18, 2026
Merged

fix: add resilient media processing fallbacks#83568
steipete merged 1 commit into
mainfrom
fix/media-sharp-fallbacks

Conversation

@steipete

Copy link
Copy Markdown
Contributor

Summary

  • centralize image/audio/video media helpers behind media-services
  • add Sharp-first image backend chain with sips, Windows native imaging, ImageMagick, GraphicsMagick, and ffmpeg fallbacks
  • preserve media size/dimension safety when processors are unavailable and move speech CAF transcode into core media services

Verification

  • pnpm -s tsgo:core
  • pnpm -s tsgo:core:test
  • node scripts/run-vitest.mjs src/media/image-ops.input-guard.test.ts src/media/web-media.test.ts src/agents/tool-images.test.ts extensions/browser/src/browser/screenshot.test.ts extensions/imessage/src/monitor/media-staging.test.ts extensions/speech-core/src/tts.test.ts src/media/audio-transcode.test.ts src/infra/resolve-system-bin.test.ts
  • node scripts/run-vitest.mjs src/media-understanding/apply.test.ts src/media/web-media.test.ts extensions/browser/src/browser/screenshot.test.ts src/agents/tool-images.test.ts --run
  • git diff --check
  • .agents/skills/autoreview/scripts/autoreview --mode local
  • Blacksmith Testbox-through-Crabbox tbx_01krx76481tanrjxxh4360yrhf: focused media fallback shard, 58 passed / 1 skipped

Real behavior proof

Behavior addressed: Fixes #83401 by installing Sharp with the root package and routing image/media processing through a central Sharp-first service with OS/tool fallbacks.
Real environment tested: local macOS checkout; Linux Blacksmith Testbox-through-Crabbox tbx_01krx76481tanrjxxh4360yrhf; earlier direct AWS Windows proof for backend chain before final centralization.
Exact steps or command run after this patch: pnpm -s tsgo:core && pnpm -s tsgo:core:test && node scripts/run-vitest.mjs ... && git diff --check; node scripts/crabbox-wrapper.mjs run --provider blacksmith-testbox ... node scripts/run-vitest.mjs ...
Evidence after fix: local focused proof passed 134 tests across 9 files plus 108 tests across the media-understanding/browser/tool-image subset; remote Linux Testbox run passed 58 tests with 1 skipped and exit 0.
Observed result after fix: compliant under-cap non-HEIC images can pass through when image processors are unavailable, resize-required images fail closed when processors are unavailable, fallback backends are tried centrally, and media call sites use the shared service.
What was not tested: full suite; latest native Windows Crabbox rerun was blocked by Windows sync/transport before command execution, so Windows-specific latest patch coverage is via unit tests plus earlier backend-chain proof.

@openclaw-barnacle openclaw-barnacle Bot added channel: imessage Channel integration: imessage gateway Gateway runtime cli CLI command changes agents Agent runtime and tooling labels May 18, 2026
@github-actions github-actions Bot added the dependencies-changed PR changes dependency-related files label May 18, 2026
@github-actions

Copy link
Copy Markdown
Contributor

Dependency Changes Detected

This PR changes dependency-related files. Maintainers should confirm these changes are intentional.

Changed files:

  • package.json
  • pnpm-lock.yaml

Maintainer follow-up:

  • Review whether the dependency changes are intentional.
  • Inspect resolved package deltas when lockfile or workspace dependency policy changes are present.
  • Run pnpm deps:changes:report -- --base-ref origin/main --markdown /tmp/dependency-changes.md --json /tmp/dependency-changes.json locally for detailed release-style evidence.

@openclaw-barnacle openclaw-barnacle Bot added size: XL maintainer Maintainer-authored PR labels May 18, 2026
@clawsweeper

clawsweeper Bot commented May 18, 2026

Copy link
Copy Markdown
Contributor

ClawSweeper status: review started.

I am starting a fresh review of this pull request: fix: add resilient media processing fallbacks This is item 1/1 in the current shard. Shard 0/1.

This placeholder means the worker is alive and reading the current context. I will edit this same comment with the actual review when the claws are done clicking.

Crustacean status: shell secured, claws on keyboard, evidence pebbles being sorted.

@steipete steipete force-pushed the fix/media-sharp-fallbacks branch from 0c475a6 to fc5096b Compare May 18, 2026 10:58
@steipete steipete merged commit 57c952f into main May 18, 2026
94 of 98 checks passed
@steipete steipete deleted the fix/media-sharp-fallbacks branch May 18, 2026 10:59

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 0c475a6e68

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

return {
buffer: await convert(canonicalPath, params.maxBytes),
buffer: converted.buffer,
contentType: "image/jpeg",

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P1 Badge Preserve original MIME unless HEIC was actually converted

When deps.convertHeicToJpeg is not provided, this code takes loadWebMedia(...) output and always sets contentType to image/jpeg. That is unsafe because loadWebMedia can return the original bytes without conversion (for example when HEIC is not classified as an image by MIME sniffing), so downstream receives non-JPEG data mislabeled as JPEG. In that path, consumers that trust contentType can fail to decode or process corrupted attachments.

Useful? React with 👍 / 👎.

galiniliev pushed a commit to galiniliev/openclaw that referenced this pull request May 20, 2026
SebTardif pushed a commit to SebTardif/openclaw that referenced this pull request May 24, 2026
SebTardif pushed a commit to SebTardif/openclaw that referenced this pull request May 24, 2026
SebTardif pushed a commit to SebTardif/openclaw that referenced this pull request May 24, 2026
github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request May 24, 2026
galiniliev pushed a commit to galiniliev/openclaw that referenced this pull request May 25, 2026
SebTardif pushed a commit to SebTardif/openclaw that referenced this pull request May 26, 2026
SebTardif pushed a commit to SebTardif/openclaw that referenced this pull request May 26, 2026
SebTardif pushed a commit to SebTardif/openclaw that referenced this pull request May 26, 2026
jameslcowan pushed a commit to jameslcowan/openclaw that referenced this pull request Jun 2, 2026
SYU8384 pushed a commit to SYU8384/openclaw that referenced this pull request Jun 3, 2026
sablehead pushed a commit to sablehead/openclaw that referenced this pull request Jun 10, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

agents Agent runtime and tooling channel: imessage Channel integration: imessage cli CLI command changes dependencies-changed PR changes dependency-related files gateway Gateway runtime maintainer Maintainer-authored PR size: XL

Projects

None yet

Development

Successfully merging this pull request may close these issues.

fix(packaging): sharp missing from optionalDependencies — image attachment processing fails on fresh install

1 participant