openclaw - ✅(Solved) Fix [Bug] WebChat/Control-UI image and file attachments not working [2 pull requests, 1 participants]

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…
GitHub stats
openclaw/openclaw#60644Fetched 2026-04-08 02:48:50
View on GitHub
Comments
0
Participants
1
Timeline
0
Reactions
2
Author
Participants

PR fix notes

PR #63783: fix(webchat): preserve image attachments for text-only models

Description (problem / solution / changelog)

Summary

  • Problem: When the primary model (e.g. GLM-4.7) does not support image input, image attachments from webchat/Control UI are silently dropped. Users receive no feedback and cannot analyze images even when agents.defaults.imageModel is configured with a vision-capable model.
  • Why it matters: This makes webchat appear broken for image uploads on any non-vision primary model, regardless of imageModel configuration.
  • What changed: Instead of discarding attachments when supportsImages=false, parseMessageWithAttachments now saves images to the media store and injects media://inbound/... references into the message text. This allows the image tool (which uses imageModel) to analyze them via the standard media:// resolution path.
  • What did NOT change: The behavior for vision-capable primary models is unchanged. The supportsImages gate itself is unchanged. No changes to detectAndLoadPromptImages or the agent runner.

Change Type

  • Bug fix

Scope

  • Gateway / orchestration

Linked Issue

  • Closes #60644
  • Related #61103
  • This PR fixes a bug

Root Cause

  • Root cause: parseMessageWithAttachments in chat-attachments.ts treats supportsImages=false as a signal to silently discard all image data. The design assumes that if the primary model can't see images, there's no value in preserving them.
  • Missing detection / guardrail: No consideration for the case where agents.defaults.imageModel provides a separate vision-capable model. The image tool can process media:// references regardless of the primary model's capabilities.
  • Contributing context: The original code comment explicitly warns against leaking media:// markers to text-only models, but these markers are opaque strings that don't cause issues — they're resolved by the image tool, not the primary model.

Regression Test Plan

  • Unit test
  • Target test: src/gateway/chat-attachments.test.ts — new describe("parseMessageWithAttachments with supportsImages=false") block
  • Scenario: When supportsImages=false, images should be saved to disk with media:// refs injected into message text, not dropped. Non-images should be skipped. Empty attachments should return empty.
  • Why this is the smallest reliable guardrail: The test directly exercises the changed code path (supportsImages=false branch) and verifies the contract (media refs injected, images array empty, offloadedRefs populated).

User-visible / Behavior Changes

  • Users on text-only primary models (e.g. GLM-4.7) with a vision-capable imageModel configured can now successfully upload and analyze images in webchat/Control UI.
  • Previously: images were silently dropped with a log warning attachment(s) dropped — model does not support images.
  • Now: images are saved and a media:// reference appears in the message, allowing the image tool to process them.

Diagram

Before:
[webchat image] → [chat.send] → supportsImages=false → DROP all attachments → user sees nothing

After:
[webchat image] → [chat.send] → supportsImages=false → save to disk → inject media:// ref in message
  → [agent receives message with media:// ref] → [image tool reads file via media://] → [imageModel analyzes] → response

Security Impact

  • New permissions/capabilities? No
  • Secrets/tokens handling changed? No
  • New/changed network calls? No
  • Command/tool execution surface changed? No
  • Data access scope changed? No — images are saved to the same media/inbound directory that was already used for large image offloading.

Repro + Verification

Environment

  • OS: macOS (ARM)
  • Runtime: Node.js 25.8.1
  • Model/provider: zai/glm-4.7 (primary, text-only), zai/glm-4.6v (imageModel)
  • Integration/channel: webchat / Control UI

Steps

  1. Configure a text-only primary model (e.g. glm-4.7) and a vision imageModel (e.g. glm-4.6v)
  2. Open OpenClaw Control UI (webchat)
  3. Take a screenshot and paste into the chat input
  4. Send the message with "analyze this image"

Expected

The agent receives the message with a [media attached: media://inbound/<id>] reference and can use the image tool to analyze it.

Actual (before fix)

Gateway log shows: parseMessageWithAttachments: 1 attachment(s) dropped — model does not support images. The agent receives the text message only, with no indication an image was attached.

Evidence

  • Failing test/log before + passing after
    • Before: attachment(s) dropped — model does not support images in gateway.err.log
    • After: attachment(s) saved for text-only model in gateway.log, agent successfully analyzes image

Human Verification

  • Verified scenarios:
    • Pasted screenshot in webchat → agent received media:// ref → image tool analyzed successfully
    • Multiple consecutive image uploads → all processed correctly
    • Non-image attachment → correctly skipped
  • Edge cases checked: empty message with image, large image (>100KB)
  • What I did not verify: ACP bridge clients (the persistChatSendImages function returns early for ACP clients, which is existing behavior)

Review Conversations

  • I replied to or resolved every bot review conversation I addressed in this PR.
  • I left unresolved only the conversations that still need reviewer or maintainer judgment.

Compatibility / Migration

  • Backward compatible? Yes
  • Config/env changes? No
  • Migration needed? No

Risks and Mitigations

  • Risk: Additional disk I/O for text-only models — images are now saved even when the primary model can't use them.
    • Mitigation: This matches the existing behavior for large images (>2MB offload threshold). The media store has existing cleanup mechanisms. For models that support images, the code path is unchanged.

Changed files

  • PR_DESCRIPTION.md (added, +113/-0)
  • src/gateway/chat-attachments.test.ts (modified, +72/-0)
  • src/gateway/chat-attachments.ts (modified, +92/-14)

PR #67184: fix(chat): support non-image attachments in webchat file upload

Description (problem / solution / changelog)

Summary

Fix Issue #60644: WebChat/Control-UI file upload only supports images.

Problem

  • CHAT_ATTACHMENT_ACCEPT only accepts image/*
  • isSupportedChatAttachmentMimeType() only validates image/* types
  • Users cannot upload PDF, video, audio or text files

Solution

  • Expand CHAT_ATTACHMENT_ACCEPT to include video/*, audio/*, application/pdf, text/*, application/json
  • Update isSupportedChatAttachmentMimeType() to validate all supported types

Testing

  • Upload PDF document via webchat
  • Upload video file via webchat
  • Upload audio file via webchat
  • Existing image upload still works

Fixes #60644

Changed files

  • ui/src/ui/chat/attachment-support.ts (modified, +12/-2)
RAW_BUFFERClick to expand / collapse

Bug Description

WebChat and Control-UI do not support image/file attachments. When users upload or paste images, the gateway never receives the attachment.

Steps to Reproduce

  1. Open OpenClaw Control-UI or WebChat
  2. Attempt to attach/paste an image in the chat input
  3. The image appears in the composer UI (preview shows correctly)
  4. Send the message
  5. Agent reply treats the message as if no image was attached

Expected Behavior

Agent should receive the image and be able to analyze it.

Actual Behavior

  • UI attachment flow exists (preview shows correctly)
  • No network request is made to upload the image
  • Gateway never receives the attachment
  • Agent replies as if the image was never sent

Additional Findings

  • Affects both WebChat and OpenClaw Desktop
  • Feishu channel works correctly for images
  • Known related issues: #49518, #53271, #36440

Environment

  • OpenClaw version: 2026.4.1
  • Channel: webchat, desktop app
  • OS: Windows

extent analysis

TL;DR

The issue can be addressed by modifying the attachment upload logic to send the image files to the gateway.

Guidance

  • Investigate the difference in attachment handling between Feishu channel and WebChat/OpenClaw Desktop to identify the root cause.
  • Verify that the image upload request is being triggered when a user attempts to send an image attachment in WebChat or OpenClaw Control-UI.
  • Check the network requests made during the attachment upload process to ensure that the image file is being sent to the gateway.
  • Review the related issues (#49518, #53271, #36440) to see if they provide any insight into the problem.

Example

No code snippet can be provided without more information about the implementation details.

Notes

The issue seems to be specific to WebChat and OpenClaw Desktop, as the Feishu channel works correctly. The fact that the UI attachment flow exists and the preview shows correctly suggests that the issue lies in the upload logic.

Recommendation

Apply a workaround to modify the attachment upload logic to send image files to the gateway, as the root cause of the issue is likely related to this process.

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…

Still need to ship something?

×6

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

Back to top recommendations

TRENDING