fix: include file body in get_file_contents text content - #3234
Open
Bruce-Yii wants to merge 1 commit into
Open
Conversation
For text files the tool returned the body only inside the EmbeddedResource while TextContent carried just the SHA line, so client surfaces that drop embedded resources (e.g. Claude voice mode) left the model with no file content. Carry the body in TextContent as well; resource, order and schema unchanged. Binary, large-file, empty-file and symlink-metadata paths untouched. Fixes github#3189
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 join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Summary
Text-file responses from
get_file_contentsnow carry the file body in theTextContentas well as in the embedded resource, so client surfaces that drop embedded resources still expose the file to the model.Why
Fixes #3189. In Claude voice mode the same
get_file_contentscall returned only[non-text content: resource]plus thesuccessfully downloaded text file (SHA: …)line, while text mode worked — the body lived exclusively inside theEmbeddedResource.What changed
pkg/github/repositories.go: in the text-file branch ofGetFileContents, append the file body to the text message (SHA line + blank line + body). Embedded resource, content order/length, and tool schema are unchanged.pkg/github/repositories_text_content_test.go: regression test assertingContent[0](TextContent) contains the body andContent[1](resource) still carries it.MCP impact
Prompts tested (tool changes only)
TextContent; resource-unwrapping clients see it in both places.Security / limits
ResourceLink.Tool renaming
Lint & tests
golangci-lint run ./pkg/github/(repo config, Go 1.25.12 toolchain): 0 issues;go vetclean;git diff --checkcleanTest_GetFileContents*(incl. symlink, IFC, field-filtering) pass. Fullpkg/githubsuite shows only the pre-existing Windows-checkout failureTestAssignCopilotToIssueWithIntent, which fails identically on clean main.