Skip to content

fix(desktop): prefer sips image backend on macOS for OpenClaw process#674

Merged
lefarcen merged 3 commits intomainfrom
fix/image-recognition-sips
Mar 30, 2026
Merged

fix(desktop): prefer sips image backend on macOS for OpenClaw process#674
lefarcen merged 3 commits intomainfrom
fix/image-recognition-sips

Conversation

@anthhub
Copy link
Copy Markdown

@anthhub anthhub commented Mar 30, 2026

What

Set OPENCLAW_IMAGE_BACKEND=sips for the OpenClaw process on macOS, using the system-native sips tool for image processing instead of sharp.

Why

Users across all channels (Discord, Slack, Feishu, WeChat) report "Failed to optimize image" when sending pictures to bots (#424, #429, #385, #569). Root cause: OpenClaw's image optimization depends on sharp (native Node.js addon), which may fail to load in packaged Desktop builds. macOS has a built-in sips tool that can handle the same image operations without native binary dependencies.

How

  • Launchd mode (packaged): Added OPENCLAW_IMAGE_BACKEND=sips to the OpenClaw plist environment in plist-generator.ts
  • Dev/orchestrator mode: Added conditional OPENCLAW_IMAGE_BACKEND=sips injection in openclaw-process.ts spawn env (macOS only via process.platform === "darwin")
  • OpenClaw's existing prefersSips() function reads this env var and routes image processing through /usr/bin/sips instead of sharp

This is the Nexu-side fix. A complementary OpenClaw-side fix adds graceful degradation (loadWebMediaRaw fallback) for non-macOS platforms.

Affected areas

  • Desktop app (Electron shell)
  • Controller (backend / API)

Checklist

  • pnpm typecheck passes
  • pnpm lint passes
  • pnpm test passes
  • pnpm generate-types run (if API routes/schemas changed)
  • No credentials or tokens in code or logs
  • No any types introduced (use unknown with narrowing)

Notes for reviewers

  • Locally verified: image recognition works after this fix (screenshot in [Bug] Image recognition failure #424)
  • Packaged build testing recommended before merging
  • Complementary OpenClaw fix: loadImageFromRef() fallback to loadWebMediaRaw when optimization fails

anthhub added 3 commits March 30, 2026 17:56
OpenClaw's image optimization pipeline depends on sharp (native Node.js
addon). In packaged Desktop builds, sharp's native binaries may fail to
load, causing "Failed to optimize image" errors when users send images
to bots via Discord/Slack/Feishu/WeChat.

Set OPENCLAW_IMAGE_BACKEND=sips for the OpenClaw process on macOS,
using the system-native sips tool instead of sharp. Covers both
launchd mode (plist-generator) and dev/orchestrator mode
(openclaw-process spawn env).

Closes #424
@cloudflare-workers-and-pages
Copy link
Copy Markdown

cloudflare-workers-and-pages Bot commented Mar 30, 2026

Deploying nexu-docs with  Cloudflare Pages  Cloudflare Pages

Latest commit: 03c8844
Status: ✅  Deploy successful!
Preview URL: https://dd15d6f1.nexu-docs.pages.dev
Branch Preview URL: https://fix-image-recognition-sips.nexu-docs.pages.dev

View logs

@lefarcen lefarcen merged commit ad6a10e into main Mar 30, 2026
19 checks passed
@lefarcen lefarcen mentioned this pull request Apr 1, 2026
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.

2 participants