Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

fix: stage inbound attachments that expose only a url (Discord)#2752

Open
jsigwart wants to merge 1 commit into
nanocoai:main from
jsigwart:fix/inbound-url-attachments
Open

fix: stage inbound attachments that expose only a url (Discord) #2752
jsigwart wants to merge 1 commit into
nanocoai:main from
jsigwart:fix/inbound-url-attachments

Conversation

@jsigwart

@jsigwart jsigwart commented Jun 12, 2026

Copy link
Copy Markdown

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 sets fetchData — it exposes a public CDN url instead — and the bridge discarded url entirely when serializing. So Discord attachments arrived with neither data nor url. Downstream, extractAttachmentFiles skips any entry without data, so nothing is staged to the session inbox and the formatter emits a path-less placeholder.

How it works

  • Extract the inbound enrichment into enrichAttachments().
  • Always preserve url on the serialized entry.
  • When an attachment has no fetchData but does have a url, download from the url so the bytes stage to the inbox exactly like a fetchData attachment. url stays on the entry as a last-resort fallback if the download fails.

This is consistent with the existing behavior for fetchData adapters (Slack et al.), which already eagerly download + base64 attachment bytes on the host.

How it was tested

  • New unit tests for enrichAttachments: url-only download, fetchData preferred over url, url preserved + no data on download failure, and metadata-only when neither is present.
  • tsc clean; full bridge test suite green (24 tests).

Relationship to existing PRs

Supersedes #2427, which preserved url but never fetched the bytes — so url-only adapters still produced no readable file (text attachments in particular still failed).

Closes #2426.

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>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Reviewers

@gavrielc gavrielc Awaiting requested review from gavrielc gavrielc is a code owner

@gabi-simons gabi-simons Awaiting requested review from gabi-simons gabi-simons is a code owner

Assignees

No one assigned

Labels

None yet

Projects

None yet

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

LLM cant see the image in discord

1 participant

AltStyle によって変換されたページ (->オリジナル) /