Chat Agent bugfix to treat workspace file references and attachments separately#2717
Draft
GeorgeNgMsft wants to merge 5 commits into
Draft
Chat Agent bugfix to treat workspace file references and attachments separately#2717GeorgeNgMsft wants to merge 5 commits into
GeorgeNgMsft wants to merge 5 commits into
Conversation
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.
Fix chat agent crash on highlighted editor files
Problem
When a user highlights lines in an editor (no upload) and asks a question, the
dispatcher's
[Editor context]carries the workspace-relative file path, and theLLM puts it into
chat.generateResponse.relatedFiles. The chat agent assumedevery related file was an uploaded attachment staged under the session's
user_files/, joined the name there, andsessionStorage.readthrew ENOENT —failing the entire response. It also tried to embed every related file as an
image and only handled Windows path separators.
Fix
rehydrateImageAttachmentsintypechat-utils(used byboth
chatanddispatcher/search, replacing two near-identical copies). Itgates on image MIME before any storage read, so a highlighted
.ymlisskipped with zero I/O — no read, no crash. Missing image uploads are caught and
skipped. Also fixes a latent doubled-
image/data-URL bug and makes theuser_fileslookup portable viapath.join(the old\..\user_files\onlyresolved on Windows).
relatedFileToEntity): uploaded images →["file","image","data"]; other references →["file"](was hardcoded toimage for everything).
relatedFilescomment so the model only listsuploaded attachment names, not editor/workspace files.