Skip to content

fix(opencode): preserve V1 tool attachment filenames - #46160

Open
opencode-agent[bot] wants to merge 1 commit into
devfrom
bedrock-data-46004
Open

fix(opencode): preserve V1 tool attachment filenames#46160
opencode-agent[bot] wants to merge 1 commit into
devfrom
bedrock-data-46004

Conversation

@opencode-agent

Copy link
Copy Markdown
Contributor

Summary

Fix V1 tool attachment serialization for Responses providers, including Bedrock Mantle.

V1 emits attachments as legacy AI SDK media parts. The SDK converts those to file-data without retaining a filename, so a PDF tool result reaches Responses as filename: "data". Replaying that attachment on later turns keeps sending the same extensionless filename, even when the latest tool only returns text.

  • Emit explicit image-data and file-data parts.
  • Preserve file attachment names and use attachment.pdf for unnamed PDFs, including existing session history.
  • Add request-serialization regressions for Bedrock Mantle and OpenAI Responses: plain text, images, named/unnamed PDFs, and a PDF replayed before a subsequent glob result.

Scoped to the V1 serializer; no V2, provider-routing, dependency, or storage changes.

Validation

  • Confirmed the six PDF regression cases fail before the fix and pass afterward; the four text/image controls pass in both cases.
  • bun test test/session/message-v2.test.ts test/provider/transform.test.ts test/provider/amazon-bedrock.test.ts test/session/llm-native.test.ts --timeout 30000 — 511 pass.
  • bun typecheck — passed in packages/opencode.
  • Prettier and git diff --check — passed.
  • Local differential SDK serialization checks preserve existing payloads for Anthropic images/PDFs, Bedrock Converse images, Gemini images/PDFs, and xAI images.

Request serialization was tested with intercepted transports, not live provider calls.

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

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