Skip to content

fix(core): preserve tool-result images for AI SDK providers - #42849

Merged
rekram1-node merged 5 commits into
v2from
ai-sdk-multimodal-tests
Aug 16, 2026
Merged

fix(core): preserve tool-result images for AI SDK providers#42849
rekram1-node merged 5 commits into
v2from
ai-sdk-multimodal-tests

Conversation

@opencode-agent

@opencode-agent opencode-agent Bot commented Aug 16, 2026

Copy link
Copy Markdown
Contributor

Summary

  • restore tool-result image fallback directly inside generic AI SDK prompt lowering
  • keep tool text in the tool result while moving image/PDF data into a following user message
  • leave native AI package routes untouched
  • replace broad unit coverage with one mini-E2E regression test

Test shape

The regression test runs an untouched image tool result through:

LLMRequest → OpenCode AI SDK lowering → real @ai-sdk/mistral provider → intercepted request

It asserts the complete Mistral messages payload: the tool result remains a tool message and the image arrives afterward as a native user image_url. The test never calls the fallback directly and makes no provider request.

Validation

  • bun test test/aisdk.test.ts (21 pass)
  • GOMAXPROCS=8 bun typecheck
  • bun x prettier --check packages/core/src/aisdk.ts packages/core/test/aisdk.test.ts
  • git diff --check

Requested by: @rekram1-node (Aiden Cline via Slack)

@opencode-agent opencode-agent Bot changed the title test(core): cover AI SDK multimodal prompts fix(core): restore AI SDK tool media fallback Aug 16, 2026
@opencode-agent opencode-agent Bot changed the title fix(core): restore AI SDK tool media fallback fix(core): preserve tool-result images for AI SDK providers Aug 16, 2026
@rekram1-node
rekram1-node merged commit ca58927 into v2 Aug 16, 2026
10 checks passed
@rekram1-node
rekram1-node deleted the ai-sdk-multimodal-tests branch August 16, 2026 20:20
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant