Bug Description
Gateway response post-processing treats every MEDIA:<path> token as a real attachment directive, even when the token appears inside fenced code blocks, inline code, grep output, or other examples. It also attempts to send non-existent paths, producing noisy Failed to send media: File not found warnings.
Steps to Reproduce
- Send a gateway response that contains a code snippet or test output with a literal
MEDIA:/tmp/missing.png example.
- Let the platform adapter post-process the response.
- Inspect
errors.log / gateway logs.
Expected Behavior
- Literal
MEDIA: examples inside code should remain text.
- Non-existent
MEDIA: paths should not be attempted as attachments.
- Real existing local files referenced by
MEDIA: should still be delivered and removed from text.
Actual Behavior
The adapter attempts delivery for example/missing paths and logs warnings such as:
[Feishu] Failed to send media (.png): Image file not found: /tmp/img.png
Impact
This creates noisy warning/error logs during code review, grep output, or tests that include MEDIA: examples, making real delivery failures harder to spot.
Proposed Fix
Update BasePlatformAdapter.extract_media() to:
- ignore matches inside fenced code blocks and inline code,
- validate that expanded local paths exist before returning them for delivery,
- remove only accepted delivery tags from the outgoing text.
Bug Description
Gateway response post-processing treats every
MEDIA:<path>token as a real attachment directive, even when the token appears inside fenced code blocks, inline code, grep output, or other examples. It also attempts to send non-existent paths, producing noisyFailed to send media: File not foundwarnings.Steps to Reproduce
MEDIA:/tmp/missing.pngexample.errors.log/ gateway logs.Expected Behavior
MEDIA:examples inside code should remain text.MEDIA:paths should not be attempted as attachments.MEDIA:should still be delivered and removed from text.Actual Behavior
The adapter attempts delivery for example/missing paths and logs warnings such as:
Impact
This creates noisy warning/error logs during code review, grep output, or tests that include
MEDIA:examples, making real delivery failures harder to spot.Proposed Fix
Update
BasePlatformAdapter.extract_media()to: