Skip to content

M1: Fix attachment delivery path#6210

Merged
noanflaherty merged 1 commit into
feature/telegram-msg-gap-closurefrom
swarm/tg-msg-gap/task-1
Feb 21, 2026
Merged

M1: Fix attachment delivery path#6210
noanflaherty merged 1 commit into
feature/telegram-msg-gap-closurefrom
swarm/tg-msg-gap/task-1

Conversation

@noanflaherty
Copy link
Copy Markdown
Contributor

@noanflaherty noanflaherty commented Feb 21, 2026

Remove the hard dependency on assistantId for Telegram attachment delivery. Attachments are now downloaded via /v1/attachments/:attachmentId endpoint that doesn't require assistantId. This fixes the bug where outbound attachments were silently dropped in channel callback flows. Part of #6200.


Open with Devin

Co-Authored-By: Claude <noreply@anthropic.com>
@noanflaherty noanflaherty self-assigned this Feb 21, 2026
@noanflaherty noanflaherty merged commit 5d0ef3e into feature/telegram-msg-gap-closure Feb 21, 2026
@noanflaherty noanflaherty deleted the swarm/tg-msg-gap/task-1 branch February 21, 2026 20:19
Copy link
Copy Markdown
Contributor

@devin-ai-integration devin-ai-integration Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Devin Review found 1 potential issue.

View 3 additional findings in Devin Review.

Open in Devin Review

Comment on lines +64 to +65
// Prefer the assistant-less download path; fall back to the legacy
// assistant-scoped path when assistantId is available.
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟡 Comment describes the opposite of what the code does for download path selection

The comment says "Prefer the assistant-less download path; fall back to the legacy assistant-scoped path when assistantId is available" but the code does the exact opposite: it prefers the legacy assistant-scoped path when assistantId is truthy, and only falls back to the assistant-less path when assistantId is undefined.

Detailed Explanation

At gateway/src/telegram/send.ts:64-68, the comment and code contradict each other:

// Prefer the assistant-less download path; fall back to the legacy
// assistant-scoped path when assistantId is available.
const payload = assistantId
  ? await downloadAttachment(config, assistantId, meta.id)   // legacy path — used FIRST when assistantId exists
  : await downloadAttachmentById(config, meta.id);           // assistant-less path — used only as fallback

The ternary checks assistantId — when truthy it uses downloadAttachment (the legacy assistant-scoped endpoint), and when falsy it uses downloadAttachmentById (the assistant-less endpoint). The comment claims the opposite priority.

While the runtime behavior is correct for the PR's intent (use legacy when available, assistant-less when not), the misleading comment could cause a future developer to "fix" the code to match the comment, inadvertently breaking the fallback logic.

Suggested change
// Prefer the assistant-less download path; fall back to the legacy
// assistant-scoped path when assistantId is available.
// Use the legacy assistant-scoped download path when assistantId is
// available; fall back to the assistant-less endpoint otherwise.
Open in Devin Review

Was this helpful? React with 👍 or 👎 to provide feedback.

@noanflaherty noanflaherty mentioned this pull request Feb 21, 2026
6 tasks
noanflaherty added a commit that referenced this pull request Feb 21, 2026
* fix: remove assistantId dependency from Telegram attachment delivery (#6210)

Co-authored-by: Claude <noreply@anthropic.com>

* feat: add Telegram webhook lifecycle reconciliation (#6211)

Co-authored-by: Claude <noreply@anthropic.com>

* feat: auto-configure gateway routing for single-assistant mode and add rejection visibility (#6212)

Co-authored-by: Claude <noreply@anthropic.com>

* feat: add Telegram Bot messaging provider for proactive outbound sends (#6222)

Co-authored-by: Claude <noreply@anthropic.com>

* feat: harden /deliver/telegram auth and align docs with Telegram capabilities (#6238)

Co-authored-by: Claude <noreply@anthropic.com>

* fix: correct misleading comment in Telegram attachment download path (#6241)

Co-authored-by: Claude <noreply@anthropic.com>

* fix: bound rejection notice cache with periodic eviction (#6242)

Co-authored-by: Claude <noreply@anthropic.com>

* fix: support tokenless providers in withProviderToken and fix testConnection error handling (#6244)

Co-authored-by: Claude <noreply@anthropic.com>

* fix: always reconcile webhook and normalize ingress URL (#6245)

Co-authored-by: Claude <noreply@anthropic.com>

* fix: resolve gateway lint error and credential security allowlist for Telegram adapter (#6257)

Co-authored-by: Claude <noreply@anthropic.com>

* fix: require webhook_secret in Telegram isConnected check (#6259)

Co-authored-by: Claude <noreply@anthropic.com>

* fix: only default routing policy in single-assistant deployments (#6261)

Co-authored-by: Claude <noreply@anthropic.com>

---------

Co-authored-by: Claude <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant