Skip to content

fix(gateway): allow [[as_document]] glued directly to MEDIA path - #67727

Closed
euisuh wants to merge 1 commit into
NousResearch:mainfrom
euisuh:pr/63632-media-directive
Closed

fix(gateway): allow [[as_document]] glued directly to MEDIA path#67727
euisuh wants to merge 1 commit into
NousResearch:mainfrom
euisuh:pr/63632-media-directive

Conversation

@euisuh

@euisuh euisuh commented Jul 19, 2026

Copy link
Copy Markdown

What does this PR do?

Allows a recognized MEDIA: path to be followed immediately by [[as_document]]. The cleanup/extraction matcher previously rejected [ as a post-extension delimiter, so the media tag was left in text and no attachment was extracted.

The strict media-tag matcher remains unchanged; [ is accepted only after an already-recognized media extension.

Related Issue

Fixes #63632

Type of Change

  • 🐛 Bug fix (non-breaking change that fixes an issue)
  • ✅ Tests (adding or improving test coverage)

Changes Made

  • Add [ to the known-extension delimiter lookahead in gateway/platforms/base.py.
  • Add a regression covering extraction and exact cleanup of a glued [[as_document]] directive.

How to Test

  1. Run scripts/run_tests.sh tests/gateway/test_platform_base.py -q.
  2. Confirm all 193 tests pass.
  3. The new regression verifies MEDIA:/tmp/report.xlsx[[as_document]] extracts /tmp/report.xlsx and cleans the surrounding text exactly.

Checklist

Code

  • I've read the Contributing Guide
  • My commit message follows Conventional Commits
  • I searched for existing PRs to make sure this isn't a duplicate
  • My PR contains only changes related to this fix
  • I've run the entire repository test suite (targeted suite: 193 passed)
  • I've added tests for my changes
  • I've tested on macOS

Documentation & Housekeeping

  • Documentation update: N/A
  • Config example update: N/A
  • Architecture/workflow docs update: N/A
  • Cross-platform impact considered; regex behavior is platform-independent
  • Tool descriptions/schemas update: N/A

Co-Authored-By: OpenAI Codex <noreply@openai.com>
@alt-glitch alt-glitch added type/bug Something isn't working comp/gateway Gateway runner, session dispatch, delivery P2 Medium — degraded but workaround exists sweeper:risk-message-delivery Sweeper risk: may drop, duplicate, misroute, or suppress messages duplicate This issue or pull request already exists labels Jul 19, 2026
@alt-glitch

Copy link
Copy Markdown
Collaborator

This was generated by AI during triage.

Duplicate of #63644: both PRs implement the same focused MEDIA cleanup-regex delimiter change for glued [[as_document]] directives.

@euisuh

euisuh commented Jul 19, 2026

Copy link
Copy Markdown
Author

Closing as a duplicate of #63644, which already implements the same cleanup-regex delimiter fix and has green CI. I missed it during initial issue triage.

@euisuh euisuh closed this Jul 19, 2026
@euisuh euisuh changed the title fix(gateway): parse glued media document directives fix(gateway): allow [[as_document]] glued directly to MEDIA path Jul 19, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

comp/gateway Gateway runner, session dispatch, delivery duplicate This issue or pull request already exists P2 Medium — degraded but workaround exists sweeper:risk-message-delivery Sweeper risk: may drop, duplicate, misroute, or suppress messages type/bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

MEDIA_TAG_CLEANUP_RE fails to match when [[as_document]] is glued directly to the path — file silently not delivered

2 participants