Agent cannot send local files: Telegram delivery is URL-fetch only #1215

Closed
opened 2026-10-27 13:39:29 +00:00 by sam · 0 comments
Owner

The agent can produce a file on the host -- a log dump, a screenshot, a written archive, a diff -- and has no way to deliver it to the operator. Asked to send a saved transcript, it replied with a "Download the archive" link twice; nothing arrived either time, and it had no signal that anything had failed.

Why video works and files do not

telegramMediaSender.dispatch (internal/channels/telegram/media.go:97) builds every attachment as:

file := &models.InputFileString{Data: att.URL}

InputFileString tells Telegram to FETCH the given URL itself. That works for the existing media path because those attachments are remote-hosted -- MiniMax returns a public URL for a generated video, which is what MultimodalResult.URLs was added for. It cannot work for anything produced locally: a daemon-host path like /home/sam/archive.md is not a URL Telegram can fetch, so the send silently does nothing useful.

The case "document" branch (media.go:124-127) already calls bot.SendDocument, so the routing exists. Only the file SOURCE is wrong.

What is needed

A way for the agent to send a LOCAL file as an attachment -- documents, logs, screenshots, images, any media -- not a link. The go-telegram/bot SDK supports upload via a reader (models.InputFileUpload with an io.Reader) as an alternative to InputFileString; the sender needs to choose between fetch-by-URL and upload-by-reader based on whether the attachment is remote or local.

Explicitly NOT the fix: exposing an external/public URL for local files. That trades a missing feature for a hosting and access-control problem.

Constraints to respect

  • Telegram enforces upload size limits (50 MB for documents via the Bot API at time of writing); exceeding them must produce a clear error to the operator, not a silent drop.
  • The file tools are workspace-confined unless [chat] unrestricted_filesystem = true. Sending must not become a way around whatever confinement is configured -- resolve and check the path under the same policy the read tool applies.
  • A failed send must surface as a failure the agent can see and report. The current defect is not that the agent lied; it is that success and silent non-delivery are indistinguishable to it.

Acceptance Criteria

The agent can send a local file through Telegram and the operator receives it as an attachment; local and remote attachments both work, choosing upload-by-reader or fetch-by-URL as appropriate; a send that fails (too large, unreadable, outside the configured confinement) returns an error the agent surfaces rather than reporting success; existing remote-URL media delivery is unchanged and still covered by tests.

Close reason

send_file tool plus upload-by-reader delivery; commit 9a45fbb


Imported from beads archie-core-absb · GitHub #634 · type feature · priority P2 · created 2026-08-24 · closed 2026-08-24

The agent can produce a file on the host -- a log dump, a screenshot, a written archive, a diff -- and has no way to deliver it to the operator. Asked to send a saved transcript, it replied with a "Download the archive" link twice; nothing arrived either time, and it had no signal that anything had failed. ## Why video works and files do not `telegramMediaSender.dispatch` (internal/channels/telegram/media.go:97) builds every attachment as: file := &models.InputFileString{Data: att.URL} `InputFileString` tells Telegram to FETCH the given URL itself. That works for the existing media path because those attachments are remote-hosted -- MiniMax returns a public URL for a generated video, which is what `MultimodalResult.URLs` was added for. It cannot work for anything produced locally: a daemon-host path like /home/sam/archive.md is not a URL Telegram can fetch, so the send silently does nothing useful. The `case "document"` branch (media.go:124-127) already calls `bot.SendDocument`, so the routing exists. Only the file SOURCE is wrong. ## What is needed A way for the agent to send a LOCAL file as an attachment -- documents, logs, screenshots, images, any media -- not a link. The go-telegram/bot SDK supports upload via a reader (`models.InputFileUpload` with an io.Reader) as an alternative to `InputFileString`; the sender needs to choose between fetch-by-URL and upload-by-reader based on whether the attachment is remote or local. Explicitly NOT the fix: exposing an external/public URL for local files. That trades a missing feature for a hosting and access-control problem. ## Constraints to respect - Telegram enforces upload size limits (50 MB for documents via the Bot API at time of writing); exceeding them must produce a clear error to the operator, not a silent drop. - The file tools are workspace-confined unless `[chat] unrestricted_filesystem = true`. Sending must not become a way around whatever confinement is configured -- resolve and check the path under the same policy the read tool applies. - A failed send must surface as a failure the agent can see and report. The current defect is not that the agent lied; it is that success and silent non-delivery are indistinguishable to it. ## Acceptance Criteria The agent can send a local file through Telegram and the operator receives it as an attachment; local and remote attachments both work, choosing upload-by-reader or fetch-by-URL as appropriate; a send that fails (too large, unreadable, outside the configured confinement) returns an error the agent surfaces rather than reporting success; existing remote-URL media delivery is unchanged and still covered by tests. ### Close reason send_file tool plus upload-by-reader delivery; commit 9a45fbb --- _Imported from beads `archie-core-absb` · GitHub #634 · type feature · priority P2 · created 2026-08-24 · closed 2026-08-24_
sam added the mediumfeature labels 2026-10-27 13:39:29 +00:00
sam self-assigned this 2026-10-27 13:39:29 +00:00
sam closed this issue 2026-10-27 13:39:29 +00:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: sam/archie#1215