Fall back to path-only mention for binary files in the agent panel (#61279)
## Summary
- Dragging a binary file (docx, xlsx, pdf, etc.) into the agent panel's
message editor inserted a mention link, then asynchronously tried to
load its content as a text buffer. That failed with "Binary files are
not supported", which surfaced an error toast **and** deleted the
mention text that had already been inserted.
- `confirm_mention_for_file` now catches that specific failure and falls
back to `Mention::Link` (a path-only reference, same as directory
mentions already use), instead of failing the whole mention and
reverting the edit.
## Test plan
- [ ] Drag a `.docx` or `.xlsx` file into the agent panel chat input —
the file path mention should stay inserted with no error toast.
- [ ] Drag a regular text file in — content mention still works as
before (unaffected code path).
Release Notes:
- Fixed dragging a binary file (docx, xlsx, pdf, etc.) into the agent
panel deleting the inserted reference and showing a "Binary files are
not supported" error
---------
Co-authored-by: Claude Fable 5 <noreply@anthropic.com>
Co-authored-by: Cole Miller <cole@zed.dev>
7f96e13d7bserenNan committed on 7/26/2026, 7:46:19 PM· committed by GitHubparentafd1723