Repository navigation
Preserve inbound Anthropic PDF documents - #325833
Merged
Bhavya U (bhavyaus) merged 1 commit intoJul 27, 2026
Merged
Bhavya U (bhavyaus) merged 1 commit into
Bhavya U (bhavyaus) merged 1 commit into
Conversation
Antonio Lujano Luna (AntonioLujanoLuna)
marked this pull request as ready for review
July 14, 2026 17:37
Bhavya U (bhavyaus)
approved these changes
Jul 23, 2026
Bhavya U (bhavyaus)
enabled auto-merge (squash)
July 23, 2026 00:48
roblourens
approved these changes
Jul 23, 2026
Dmitriy Vasyura (dmitrivMS)
approved these changes
Jul 23, 2026
Bhavya U (bhavyaus)
force-pushed
the
fix/anthropic-document-input
branch
from
July 27, 2026 18:22
1902969 to
73ff3c0
Compare
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.
Fixes #325672
Summary
documentblocks when parsing inbound Anthropic-compatible requests.tool_resultcontent.Problem
The
/v1/messagesendpoint parses Anthropic request bodies withanthropicMessagesToRawMessages. That converter handled text, images, thinking blocks, tool calls, and tool results, but it did not handledocumentblocks.As a result, a top-level PDF was omitted before the request reached the selected model. When a PDF was the only user content, the resulting empty user message could also be omitted entirely. Documents nested inside
tool_resultcontent were similarly discarded because only text and image blocks were converted there.Fix
Base64 Anthropic document sources are now converted to the existing Raw document content part, preserving both the base64 data and
application/pdfmedia type. The same conversion is used for top-level message content and tool-result content.The downstream Messages and Responses request builders already support Raw PDF document parts, so no endpoint-specific conversion changes are required. The logging conversion now replaces document data with a placeholder, matching the existing image and tool-result sanitization behavior.
Validation
npm run gulp compile-extensionsnpx tsc --noEmit --project tsconfig.jsoninextensions/copilotnpm run test:unit -- src/extension/byok/common/test/anthropicMessageConverter.spec.tsnpm run test:unit -- src/platform/endpoint/test/node/messagesApi.spec.ts src/platform/endpoint/node/test/responsesApi.spec.tsnpx eslint src/extension/byok/common/anthropicMessageConverter.ts src/extension/byok/common/test/anthropicMessageConverter.spec.tsThe new regression coverage checks top-level PDF documents, documents inside tool results, and logging redaction.