openclaw - ✅(Solved) Fix [Bug]: Web UI 粘贴图片结果为空消息 [1 pull requests]

Official PRs (…)
ON THIS PAGE

Recommended Tools

×6

Utilities matched from this issue’s tags and category — try them while you read without losing context.

GitHub issue graph ai analysis

Paste a GitHub issue URL. We fetch that issue, discover linked issues from bodies/comments/timeline, collect linked pull requests, and produce a structured English report.

The report is written in English Markdown for sharing and archival.

Helpful · Quick feedback

Loading…

Root Cause


Fix Action

Fixed

PR fix notes

PR #69474: fix(gateway): restore webchat pure-image turn handling (#69358)

Description (problem / solution / changelog)

Summary

Fixes #69358 Fixes #69415 Fixes #69427

get-reply-run.ts now checks baseBodyForPrompt.trim() (which includes the inbound-context prefix) instead of baseBodyFinal.trim() for the empty-turn gate, and falls back to the plain "[User sent media without caption]" placeholder only when the entire prompt body is empty. This restores pure-image webchat turns that were bailing out with "I didn't receive any text in your message. Please resend or add a caption." (English) / "不可发送空消息" (localized same payload).

Root Cause

  1. Webchat images arrive through replyOptions.images and — by explicit project design — do not stamp sessionCtx.MediaPath (see src/gateway/server-methods/chat.directive-tags.test.ts:1697-1698, which asserts ctx.MediaPath stays undefined on dispatch).
  2. Commit eb10803691 ("fix(prompt): keep inbound chat ids out of system prefix") tightened the reply-run empty-turn gate from baseBodyForPrompt.trim() to baseBodyFinal.trim().length > 0 (i.e. the strict user body, prefix excluded).
  3. The same commit also changed effectiveBaseBody so the "[User sent media without caption]" placeholder is always appended on top of inboundUserContext when there is no user body, instead of being used only as a last-resort fallback.
  4. For a pure-image webchat turn: hasUserBody === false (no caption), hasMediaAttachment === false (no ctx.MediaPath) → the gate returns the empty-message payload and the image never reaches the vision model. When a caption is present, the placeholder text leaks into the Control UI user bubble on top of the Sender-metadata prefix.

All three issues are the same regression, reported from different angles:

  • #69358 — pure-image Control UI send returns the empty-message error payload.
  • #69415 — same behavior reported against the Web UI (localized message text).
  • #69427 — screenshot/image upload broken after upgrading from 2026.4.5 → 2026.4.15 (the release that shipped eb10803691).

The Fix

Revert the three src/auto-reply/reply/get-reply-run.ts hunks introduced by eb10803691 back to the stable 2026.4.5 behavior:

  • gate: baseBodyTrimmed = baseBodyForPrompt.trim() so the normal webchat inbound-context prefix keeps the run alive;
  • effectiveBaseBody = baseBodyTrimmed ? baseBodyForPrompt : "[User sent media without caption]" so the placeholder is only used when there is truly nothing else, never appended on top of a non-empty prefix.

Also drops the media-only regression added by eb10803691 for the metadata-only-prefix bail-out — it encoded exactly the behavior this PR reverts.

Testing

This fix addresses the case where pure-image webchat (Control UI) sends were showing:

  • agent reply "I didn't receive any text in your message. Please resend or add a caption." / "不可发送空消息" instead of a vision-model response;
  • placeholder text [User sent media without caption] in the Control UI user bubble on top of the Sender-metadata prefix when a caption was supplied.

Verified locally:

  • pnpm check:changed --staged — scoped typecheck + lint + guards + tests pass
  • pnpm tsgo — core prod typecheck green
  • pnpm test src/auto-reply/reply/get-reply-run.media-only.test.ts — 26/26 pass
  • Manual repro in the Control UI (webchat): pure image + no caption → agent describes the image, user bubble renders the uploaded image.

Checklist

  • Code changes are minimal and targeted (revert of three hunks in a single file + obsolete test removal)
  • Fix addresses the root cause identified in #69358 / #69415 / #69427
  • Commit message references the issue number

Changed files

  • CHANGELOG.md (modified, +1/-0)
  • src/auto-reply/reply/get-reply-run.media-only.test.ts (modified, +43/-0)
  • src/auto-reply/reply/get-reply-run.ts (modified, +4/-6)
RAW_BUFFERClick to expand / collapse

Bug type

Behavior bug (incorrect output/state without crash)

Beta release blocker

No

Summary


📝 Issue 摘要

标题:Web UI 粘贴图片结果为空消息

核心问题

  • 粘贴图片后预览正常
  • 点击发送后消息为空
  • 图片附件没有正确传输

根因分析: 代码中使用了 非标准的图片格式(Anthropic Claude 格式),但后端可能期望 OpenAI 标准格式

当前代码(有问题)应该是(标准)
type: "image"type: "image_url"
source: {type: "base64", ...}image_url: {url: "..."}

Steps to reproduce


📝 Issue 摘要

标题:Web UI 粘贴图片结果为空消息

核心问题

  • 粘贴图片后预览正常
  • 点击发送后消息为空
  • 图片附件没有正确传输

根因分析: 代码中使用了 非标准的图片格式(Anthropic Claude 格式),但后端可能期望 OpenAI 标准格式

当前代码(有问题)应该是(标准)
type: "image"type: "image_url"
source: {type: "base64", ...}image_url: {url: "..."}

Expected behavior

正常能够从web ui页面发送图片给到本地

Actual behavior

发送图片,agent返回提示:不可发送空消息。

OpenClaw version

4.12

Operating system

mac os5.3

Install method

No response

Model

mini mac

Provider / routing chain

openclaw -> cloudflare-ai-gateway -> minimax

Additional provider/model setup details

No response

Logs, screenshots, and evidence

Impact and severity

No response

Additional information

No response

extent analysis

TL;DR

Update the image format in the code to match the OpenAI standard format, specifically changing type: "image" to type: "image_url" and source: {type: "base64", ...} to image_url: {url: "..."}.

Guidance

  • Verify that the issue is indeed caused by the non-standard image format by checking the logs for any error messages related to image processing.
  • Update the code to use the standard OpenAI image format, as shown in the provided table.
  • Test the updated code to ensure that images are sent correctly and the agent no longer returns an error message.
  • If issues persist, check the cloudflare-ai-gateway and minimax configurations to ensure they are compatible with the updated image format.

Example

// Before
const imageData = {
  type: "image",
  source: {
    type: "base64",
    data: "...",
  },
};

// After
const imageData = {
  type: "image_url",
  image_url: {
    url: "...",
  },
};

Notes

The provided information suggests that the issue is related to the image format, but without more details about the specific error messages or logs, it's difficult to provide a more specific solution. Additionally, the OpenClaw version and operating system may also be relevant to the issue.

Recommendation

Apply workaround: Update the image format in the code to match the OpenAI standard format, as this is the most likely cause of the issue and a straightforward fix.

Vote matrix · Quick signals

Works
Did the solution work? Tap to confirm.
Easy Fix
Was it a quick fix?
Time Saver
Did it save you time?
Blocking
Was it severely blocking?
Common Issue
Are others likely hitting this too?
Flaky / Intermittent
Is it intermittent?
Verified / Reproducible
Can you reproduce it reliably?
Loading…

FAQ

Expected behavior

正常能够从web ui页面发送图片给到本地

Still need to ship something?

×6

Another batch ranked right after the header list — different links, same matching logic.

Back to top recommendations

TRENDING

openclaw - ✅(Solved) Fix [Bug]: Web UI 粘贴图片结果为空消息 [1 pull requests]