Skip to content

fix(gateway): strip markdown wrappers from media paths#23765

Open
LeonSGP43 wants to merge 1 commit into
NousResearch:mainfrom
LeonSGP43:codex/23759-media-bold-path
Open

fix(gateway): strip markdown wrappers from media paths#23765
LeonSGP43 wants to merge 1 commit into
NousResearch:mainfrom
LeonSGP43:codex/23759-media-bold-path

Conversation

@LeonSGP43

Copy link
Copy Markdown
Contributor

What does this PR do?

  • strips markdown emphasis wrappers around MEDIA: paths before gateway adapters resolve files
  • prevents **MEDIA:/tmp/report.docx** from becoming /tmp/report.docx**
  • keeps the cleaned user-visible text from leaking raw emphasis markers after media extraction

Related Issue

Fixes #23759

Type of Change

  • Bug fix (non-breaking change that fixes an issue)
  • New feature (non-breaking change that adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to change)
  • Documentation update
  • Refactor / chore

Changes Made

  • expanded BasePlatformAdapter.extract_media() to tolerate markdown emphasis wrappers around MEDIA: directives
  • strips trailing * / _ markers from extracted paths as a safety net
  • added a regression test covering bold-wrapped media paths

How to Test

  • uv run --frozen pytest -q -o addopts='' tests/gateway/test_platform_base.py tests/gateway/test_send_image_file.py -k 'media'
  • uv run --frozen ruff check gateway/platforms/base.py tests/gateway/test_platform_base.py
  • env -i HOME="$HOME" PATH="$PATH" TERM="${TERM:-xterm-256color}" bash -lc 'cd /Users/leongong/Desktop/LeonProjects/worktrees/hermes-agent/hermes-23759-media-bold-path && uv run --frozen pytest --collect-only -q -o addopts="" tests/gateway/test_platform_base.py tests/gateway/test_send_image_file.py -k media'

Checklist

  • I have linked the related issue (or explained why not)
  • I added or updated tests for the change
  • I ran relevant local verification
  • I kept the scope focused
  • I ran the full repo test suite

For New Skills

  • Not applicable

Screenshots / Logs

  • Not applicable

@alt-glitch alt-glitch added type/bug Something isn't working P2 Medium — degraded but workaround exists comp/gateway Gateway runner, session dispatch, delivery labels May 11, 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 P2 Medium — degraded but workaround exists type/bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Bug] extract_media: Markdown bold ** in MEDIA paths causes file-not-found on all platforms

2 participants