Skip to content

fix(opencode): bump @ai-sdk/xai to 3.0.139 so tool-result images reach xAI - #53549

Merged
rekram1-node merged 1 commit into
anomalyco:devfrom
Jaaneek:fix/xai-tool-result-images
Oct 6, 2026
Merged

rekram1-node merged 1 commit into
anomalyco:devfrom
Jaaneek:fix/xai-tool-result-images

Conversation

@Jaaneek

@Jaaneek Jaaneek commented Oct 6, 2026

Copy link
Copy Markdown
Contributor

Issue for this PR

Closes #53548

Type of change

  • Bug fix
  • New feature
  • Refactor / code improvement
  • Documentation

What does this PR do?

When a tool like read returned an image, @ai-sdk/xai 3.0.102 sent xAI only the text "Image read successfully", so the model never saw the image. Version 3.0.139 sends the image itself; this bumps it and moves our existing patch over to the new version.

How did you verify your code works?

A new test that fails on the old version, plus typecheck and lint. I also checked by hand that grok-4.7 now describes the actual image.

Test image (assets/sample.png, read with the prompt "Read assets/sample.png and describe exactly what the image shows, including any text in it.")

test-image

Before

03-before-answer
Wrong answer, "A small solid red square centered on a plain white background. No text or other symbols."; the image has no red and no square.

After

03-after-answer
Correct answer, "A dark navy blue background with the white bold text “PELICAN 739” centered at the top. Below it, a yellow five-pointed star sits on the left and a solid green triangle on the right."

Screenshots / recordings

N/A

Checklist

  • I have tested my changes locally
  • I have not included unrelated changes in this PR
…h xAI

@ai-sdk/xai 3.0.102 flattens function_call_output content to text, so an
image returned by the read tool reached xAI as the bare string
"Image read successfully". 3.0.139 (latest on the ai v6 line) maps
image-data/image-url parts to input_image. Port the local patch
(promptCacheKey, inline PDF input_file, free-form reasoningEffort) to the
new version.
Image types xAI rejects (e.g. GIF) keep the text placeholder.
@github-actions

github-actions Bot commented Oct 6, 2026

Copy link
Copy Markdown
Contributor

The following comment was made by an LLM, it may be inaccurate:

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

2 participants