openclaw - ✅(Solved) Fix claude-opus-4-7 — pasted images silently dropped when using direct Anthropic API [1 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#68044Fetched 2026-04-18 05:54:15
View on GitHub
Comments
0
Participants
1
Timeline
2
Reactions
0
Author
Participants
Timeline (top)
cross-referenced ×1referenced ×1

Error Message

When you paste a screenshot into the webchat composer, the image preview appears correctly above the text box. After sending, the image briefly appears in the chat but then disappears. The message reaches the agent as text-only — no image, no error, no indication anything was lost.

Root Cause

Root cause (traced)

Fix Action

Fixed

PR fix notes

PR #68047: fix(gateway): extend image-support name fallback to direct anthropic provider

Description (problem / solution / changelog)

Problem

When using the direct anthropic provider with a newly released Claude model (e.g. claude-opus-4-7), pasted images are silently dropped. The gateway logs confirm:

parseMessageWithAttachments: 1 attachment(s) dropped — model does not support images

The root cause is in resolveGatewayModelSupportsImages: when the model catalog either has no entry or has a stale entry without input: ["image"], the function's name-based fallback only recognises claude-cli as an Anthropic-class provider — not the anthropic provider itself. New models hit return false and the caller drops all attachments.

Fix

Add anthropic alongside claude-cli in the name-based image-support check so that any Claude model name (claude-*, opus, sonnet, haiku) is treated as image-capable regardless of catalog freshness.

The duplicated predicate in the catalog-hit and catalog-miss branches is extracted into a single isAnthropicClaudeByName const to keep the logic DRY.

Changes

  • src/gateway/session-utils.ts — extend name-based fallback to anthropic provider; extract shared predicate
  • src/gateway/session-utils.test.ts — add two tests: catalog-stale and catalog-miss paths for anthropic provider

Testing

All 56 existing + 2 new tests pass:

✓ treats direct anthropic Claude models as image-capable when catalog entry is stale
✓ treats direct anthropic Claude models as image-capable when catalog entry is missing

Closes #68044

Changed files

  • src/gateway/session-utils.test.ts (modified, +27/-0)
  • src/gateway/session-utils.ts (modified, +13/-20)

Code Example

- if (normalizedProvider === "claude-cli" && normalizedCandidates.some(...))
+ if ((normalizedProvider === "anthropic" || normalizedProvider === "claude-cli") && normalizedCandidates.some(...))
RAW_BUFFERClick to expand / collapse

Version: 2026.4.15

Provider/model: anthropic / claude-opus-4-7 (direct API key auth)


What happens

When you paste a screenshot into the webchat composer, the image preview appears correctly above the text box. After sending, the image briefly appears in the chat but then disappears. The message reaches the agent as text-only — no image, no error, no indication anything was lost.

What I expected

The image to be passed to the model, same as it is on claude-sonnet-4-6.

Reproduction

  1. Configure agents.defaults.model.primary as anthropic/claude-opus-4-7
  2. Open webchat, paste a screenshot (Ctrl+V) into the composer
  3. Send — image vanishes from the chat history, agent responds as if no image was sent

Switching to anthropic/claude-sonnet-4-6 resolves it immediately — same setup, same browser, paste works fine.

Root cause (traced)

resolveGatewayModelSupportsImages in session-utils looks up the model in the gateway catalog to check for input: ["image"]. The catalog (populated from the Pi SDK model registry) includes entries for claude-opus-4-5, claude-opus-4-6, claude-sonnet-4-6 etc — but not claude-opus-4-7. When the lookup finds no entry, the function falls through to return false, causing parseMessageWithAttachments to silently drop all attachments.

The log line confirms it: parseMessageWithAttachments: 1 attachment(s) dropped — model does not support images

The claude-cli provider already has a name-based fallback for exactly this scenario. The anthropic provider does not.

Suggested fix

Add anthropic to the name-based fallback alongside claude-cli:

- if (normalizedProvider === "claude-cli" && normalizedCandidates.some(...))
+ if ((normalizedProvider === "anthropic" || normalizedProvider === "claude-cli") && normalizedCandidates.some(...))

And add claude-opus-4-7 to the Pi SDK model catalog with input: ["text", "image"].

extent analysis

TL;DR

Add anthropic to the name-based fallback in the provider check and update the Pi SDK model catalog to include claude-opus-4-7 with image support.

Guidance

  • Verify that the resolveGatewayModelSupportsImages function is correctly checking the model catalog for input: ["image"] support.
  • Update the session-utils code to include anthropic in the name-based fallback, as suggested in the provided diff.
  • Ensure the Pi SDK model catalog is updated to include an entry for claude-opus-4-7 with input: ["text", "image"].
  • Test the changes by reproducing the issue and verifying that images are no longer dropped when sending messages with the claude-opus-4-7 model.

Example

The suggested fix provides a code snippet that demonstrates how to update the provider check:

- if (normalizedProvider === "claude-cli" && normalizedCandidates.some(...))
+ if ((normalizedProvider === "anthropic" || normalizedProvider === "claude-cli") && normalizedCandidates.some(...))

This change allows the anthropic provider to use the name-based fallback when checking for image support.

Notes

The provided fix assumes that the issue is solely due to the missing entry in the Pi SDK model catalog and the lack of a name-based fallback for the anthropic provider. If other factors are contributing to the issue, additional debugging may be necessary.

Recommendation

Apply the suggested workaround by updating the session-utils code and the Pi SDK model catalog, as this should resolve the issue and allow images to be sent correctly with the claude-opus-4-7 model.

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

openclaw - ✅(Solved) Fix claude-opus-4-7 — pasted images silently dropped when using direct Anthropic API [1 pull requests, 1 participants]