Repository navigation
fix: forward user-uploaded PDFs to Anthropic and Bedrock - #25946
Merged
Merged
Conversation
Bumps coder/fantasy past coder/fantasy#37 (cherry-pick of upstream charmbracelet/fantasy#197) so application/pdf FileParts are emitted as base64 PDF document blocks to Anthropic, and therefore to Bedrock which wraps the Anthropic provider, instead of being silently dropped. The user-uploaded PDF now actually reaches Claude. Add a regression test that drives a fantasy.FilePart through the real Anthropic provider against a chattest.NewAnthropic stub and asserts the outbound request contains a base64 document block. The test was verified to fail on the previous fantasy pin (the request leaves with zero messages and Generate returns EOF) and pass on the new pin. Relates to CODAGT-540
ethanndickson
marked this pull request as ready for review
June 2, 2026 02:43
make lint (misspell) flagged the British spelling in the PDF test's doc comment.
deansheather
approved these changes
Jun 2, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Previously, user-uploaded PDFs were silently dropped by fantasy's Anthropic provider adapter, so Claude (direct or via Bedrock) only saw the user's text and replied as if no document had been attached. Other providers (OpenAI, Gemini, OpenRouter, Vercel) were unaffected.
Bumps
coder/fantasypast coder/fantasy#37 (cherry-pick of upstream charmbracelet/fantasy#197), which emits an Anthropicdocumentcontent block with a base64 PDF source forfantasy.FilePart{MediaType: "application/pdf"}and countsOfDocumentas user-visible so a PDF-only user message is no longer culled as empty.Adds a regression test (
TestModelFromConfig_AnthropicPDFFilePartReachesProvider) that drives afantasy.FilePartthrough the real Anthropic provider against achattest.NewAnthropicstub and asserts the outbound request contains a base64 document block. The test was verified to fail on the previous fantasy pin (the request leaves with zero messages andGeneratereturns EOF) and pass on the new one.Manually verified end-to-end with
./scripts/develop.sh: uploading a PDF to a Claude-backed Coder Agents chat now lets the model read it.Closes CODAGT-540