Skip to content

[Bug]: Telegram inbound file documents lose original filename — saved as UUID #31757

@moonbees01

Description

@moonbees01

Summary

When a Telegram user sends a document file to the OpenClaw bot, the file is saved to media/inbound/ with a UUID-based filename instead of the original filename. The original filename is permanently lost.

Example:

  • User sends: [Annex 1] 2026 Pre-Startup Package Business Plan Template.docx
  • Saved as: file_42---904465df-4ec4-481d-a612-de3ce347cbdf.docx
  • The <file name="..."> tag in the agent's message context also reflects the UUID name, not the original

Steps to Reproduce

  1. Send any document via Telegram (e.g., my-report.pdf, annex-1-business-plan.docx)
  2. Check ~/.openclaw/media/inbound/ — file is saved as file_N---<UUID>.ext
  3. Inspect the message context passed to the agent — <file name="file_N---<UUID>.ext"> also shows UUID, not original filename

Expected Behavior

The original filename provided by the Telegram Bot API (document.file_name field in the update payload) should be preserved — either as the saved filename or exposed as metadata in the message context.

Proposed fix: Use <uuid>_<original_filename>.<ext> format to preserve the original name while avoiding collisions.
Example: 904465df_business-plan-template.docx

Actual Behavior

  • document.file_name from the Telegram Bot API is ignored
  • File is saved with a generic UUID-based name
  • Agent message context also contains the UUID name, making it impossible for the agent to identify files by their original names

Impact

  • Agent cannot identify files semantically — when multiple numbered documents are sent (e.g., Annex 1, Annex 2, Annex 3), the agent has no way to distinguish them without user re-specification
  • Breaks multi-file workflows — sending several attachments at once makes it impossible to match files to their intended purpose
  • User must manually re-specify filenames — adding friction to every file-based task
  • Filename carries semantic meaning in many workflows — e.g., legal documents, numbered annexes, versioned reports

Additional Notes

  • Multiple files sent simultaneously share the same timestamp, making order-based guessing unreliable
  • The Telegram Bot API reliably provides document.file_name — this is a straightforward field that just needs to be wired through
  • Tested on OpenClaw v2026.2.26, macOS, Telegram channel

Environment

  • OpenClaw version: 2026.2.26
  • OS: macOS (arm64)
  • Channel: Telegram

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions