Skip to content

fix(whatsapp): preserve text document attachments#27214

Open
EvolvingSoftwareAgent wants to merge 2 commits into
NousResearch:mainfrom
EvolvingSoftwareAgent:fix/whatsapp-html-attachments
Open

fix(whatsapp): preserve text document attachments#27214
EvolvingSoftwareAgent wants to merge 2 commits into
NousResearch:mainfrom
EvolvingSoftwareAgent:fix/whatsapp-html-attachments

Conversation

@EvolvingSoftwareAgent

@EvolvingSoftwareAgent EvolvingSoftwareAgent commented May 17, 2026

Copy link
Copy Markdown

Summary

Fixes WhatsApp text-document attachment handling end-to-end so generated or received .html, .md, and .markdown files are delivered and processed as native documents instead of falling through to generic/octet-stream, plain text, or omitted-media paths.

What changed

  • Adds text/html / .html / .htm and markdown document coverage (.md, .markdown) to the shared document MIME/extraction paths.
  • Expands MEDIA: extraction and bare local path detection so paths like MEDIA:/tmp/article.md, /tmp/article.markdown, and /tmp/report.html are recognized and routed as native attachments.
  • Updates the WhatsApp bridge MIME table used by /send-media so outbound markdown documents are sent with mimetype: text/markdown.
  • Wires send_message WhatsApp media delivery through the local bridge /send-media endpoint, including document captions and multiple attachments, instead of silently omitting MEDIA: files.
  • Preserves inbound document MIME metadata from the bridge (mediaMimeTypes) so Python sees HTML documents as text/html even when fallback extension inference would be lossy.
  • Ensures inbound documents without a filename get an extension inferred from their MIME type, so text/html still caches as .html and can be text-injected for the agent.
  • Adds regression coverage for HTML/markdown MEDIA: tags, bare local HTML/markdown attachment paths, shared MIME mappings, WhatsApp bridge markdown MIME entries, WhatsApp inbound HTML documents, and send_message WhatsApp media routing.

Validation

  • node --check scripts/whatsapp-bridge/bridge.js
  • git diff --check
  • scripts/run_tests.sh tests/gateway/test_media_extraction.py tests/gateway/test_whatsapp_connect.py::TestHtmlDocumentAttachments tests/tools/test_send_message_tool.py::TestSendToPlatformWhatsapp — wrapper only selected test_media_extraction.py for this nodeid-shaped command; 11 passed, 0 failed
  • scripts/run_tests.sh tests/gateway/test_whatsapp_connect.py tests/tools/test_send_message_tool.py — 151 passed, 0 failed

No gateway or WhatsApp bridge restart was performed in Sebastian's live environment; the code is updated in the PR branch only and will take effect after an explicit later restart/deploy.

Refresh status

  • Updated the existing PR branch with the markdown/send_message follow-up requested from live WhatsApp debugging.
  • Current head: f3abeafbb.
  • Mergeability/check status should be read from the latest GitHub API response because editing this body can temporarily reset GitHub's mergeability calculation.
  • Notes: PR now covers both the original HTML attachment fix and the discovered .md / .markdown WhatsApp attachment path, including the active MEDIA: extractor and send_message tool path.
  • Test plan:
    • node --check scripts/whatsapp-bridge/bridge.js
    • git diff --check
    • scripts/run_tests.sh tests/gateway/test_media_extraction.py tests/gateway/test_whatsapp_connect.py::TestHtmlDocumentAttachments tests/tools/test_send_message_tool.py::TestSendToPlatformWhatsapp — 11 passed, 0 failed for selected file
    • scripts/run_tests.sh tests/gateway/test_whatsapp_connect.py tests/tools/test_send_message_tool.py — 151 passed, 0 failed

@alt-glitch alt-glitch added type/bug Something isn't working P2 Medium — degraded but workaround exists platform/whatsapp WhatsApp Business adapter comp/gateway Gateway runner, session dispatch, delivery labels May 17, 2026
@cardtest15-coder

This comment was marked as spam.

@EvolvingSoftwareAgent EvolvingSoftwareAgent force-pushed the fix/whatsapp-html-attachments branch from 00fefb2 to 4128fea Compare May 27, 2026 09:09
@EvolvingSoftwareAgent EvolvingSoftwareAgent changed the title fix(whatsapp): preserve HTML document attachments fix(whatsapp): preserve text document attachments May 27, 2026
@EvolvingSoftwareAgent EvolvingSoftwareAgent force-pushed the fix/whatsapp-html-attachments branch from f3abeaf to 7e7831b Compare June 2, 2026 08:58
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 platform/whatsapp WhatsApp Business adapter type/bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants