-
Notifications
You must be signed in to change notification settings - Fork 12.9k
fix: stage inbound attachments that expose only a url (Discord)#2752
Open
jsigwart wants to merge 1 commit into
Open
fix: stage inbound attachments that expose only a url (Discord) #2752jsigwart wants to merge 1 commit into
jsigwart wants to merge 1 commit into
Conversation
The chat-sdk bridge only downloaded attachment bytes via `att.fetchData()`. The Discord adapter never sets `fetchData` — it exposes a public CDN `url` instead — and the bridge discarded `url` entirely. So Discord attachments reached the host with neither bytes nor a link: `extractAttachmentFiles` skips any entry without `data`, nothing was staged to the session inbox, and the agent saw a bare `[file: name]` it could not read. This hits both pasted text (Discord auto-converts long paste to message.txt) and images (nanocoai#2426). Fix: extract the enrichment into `enrichAttachments`, preserve `url` on every entry, and when there is no `fetchData` but a `url`, download from the url so the bytes stage to the inbox like any other attachment. `url` remains as a last-resort fallback if the download fails. Supersedes the partial fix in nanocoai#2427 (which preserved `url` but never fetched the bytes, so url-only adapters still produced no readable file). Closes nanocoai#2426. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@jsigwart
jsigwart
requested review from
gabi-simons and
gavrielc
as code owners
June 12, 2026 17:33
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.
What
Inbound Discord attachments — both pasted text (which Discord auto-converts to
message.txt) and images — never reach the agent in a readable form. The agent sees a bare[file: message.txt]/[image: foo.png]with no bytes and no path.Why
The chat-sdk bridge downloaded attachment bytes only via
att.fetchData(). The Discord adapter never setsfetchData— it exposes a public CDNurlinstead — and the bridge discardedurlentirely when serializing. So Discord attachments arrived with neitherdatanorurl. Downstream,extractAttachmentFilesskips any entry withoutdata, so nothing is staged to the session inbox and the formatter emits a path-less placeholder.How it works
enrichAttachments().urlon the serialized entry.fetchDatabut does have aurl, download from the url so the bytes stage to the inbox exactly like afetchDataattachment.urlstays on the entry as a last-resort fallback if the download fails.This is consistent with the existing behavior for
fetchDataadapters (Slack et al.), which already eagerly download + base64 attachment bytes on the host.How it was tested
enrichAttachments: url-only download,fetchDatapreferred overurl, url preserved + nodataon download failure, and metadata-only when neither is present.tscclean; full bridge test suite green (24 tests).Relationship to existing PRs
Supersedes #2427, which preserved
urlbut never fetched the bytes — so url-only adapters still produced no readable file (text attachments in particular still failed).Closes #2426.