Skip to content

MEDIA extraction regex missing .md extension after ea49b3862 #30186

@virtt

Description

@virtt

What happened

Commit ea49b38 ("tighten MEDIA extraction regex + silent skip on file-not-found") replaced the permissive MEDIA:\S+ regex with an explicit extension allowlist in three places. The .md (Markdown) extension was not included in the allowlist.

Where

  1. gateway/platforms/base.py:2162extract_media() for final agent responses
  2. gateway/run.py:16522_TOOL_MEDIA_RE for tool result history
  3. gateway/run.py:16818 — second _TOOL_MEDIA_RE for streaming history

Impact

Agents can no longer deliver .md files to users via the MEDIA: tag. Only .txt and .csv work from the text/document group. .md was working before the regex tightening.

Suggested fix

Add |md to the extension group alongside txt|csv in all three regex patterns:

- r'txt|csv|apk|ipa))',
+ r'txt|csv|md|apk|ipa))',

Markdown is a standard document format routinely exchanged between agents and users — it belongs in the text/document group.

Metadata

Metadata

Assignees

No one assigned

    Labels

    P3Low — cosmetic, nice to havecomp/gatewayGateway runner, session dispatch, deliveryduplicateThis issue or pull request already existstype/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