Skip to content

Gateway MEDIA tags do not recognize markdown attachments #31560

@evgyur

Description

@evgyur

Bug description

Gateway responses can include MEDIA:/path/file.md to send a generated markdown file as a native platform attachment. Today the shared BasePlatformAdapter.extract_media() regex does not recognize .md files, so the media tag is not extracted and no file is sent.

This creates a misleading user experience: the assistant may say "here is the file" while the gateway only sends the surrounding text and silently drops the intended attachment.

The same extractor also misses .html / .htm document paths even though those are useful text-ish report artifacts, and it is case-sensitive for document extensions.

Steps to reproduce

from gateway.platforms.base import BasePlatformAdapter

media, cleaned = BasePlatformAdapter.extract_media("Here is the file:\nMEDIA:/tmp/report.md")
print(media)

Actual behavior

[]

No media tuple is returned, so downstream gateway dispatch never calls the native document send path for the file.

Expected behavior

[("/tmp/report.md", False)]

The MEDIA: tag should be stripped from user-visible text and the file should be routed to the platform attachment/document sender.

Impact

  • Generated markdown handoffs/reports are not delivered as attachments.
  • The assistant can claim a file was attached even though the platform receives only text.
  • Uppercase extensions like .MD are also missed.

Proposed fix

  • Add md, html, and htm to the shared MEDIA: extractor allowlist.
  • Make the extractor case-insensitive.
  • Add focused regression tests for .md, .MD, .html, and .htm.

Metadata

Metadata

Assignees

No one assigned

    Labels

    P2Medium — degraded but workaround existscomp/gatewayGateway runner, session dispatch, deliverytype/bugSomething isn't working

    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