#19303: Fix WhatsApp internal error leakage + cron.run timeout defaults
channel: whatsapp-web
agents
size: M
Cluster:
WhatsApp Enhancements and Fixes
## Summary
Fix reliability/UX issues that caused noisy internal errors to leak into WhatsApp chats and misleading cron timeout alerts.
## Changes
### WhatsApp web auto-reply (deliverWebReply)
- Strip internal tool/log banner lines from outbound WhatsApp text (e.g. `⚠️ 🛠️ Exec: ...`, `Command exited with code ...`).
- Skip clearly invalid `mediaUrl` placeholders (e.g. `image`, `document`, pasted instructions).
- Accept `~/...` and plain relative paths like `image.png` / `images/foo.jpg` (regression guard per review).
- If media send fails, do not append "⚠️ Media failed" warnings to the chat. Fall back to intended text only.
### Cron tool
- Increase default gateway timeout for `cron.run` and `cron.runs` to **180s** (other actions remain 60s) to avoid spurious `gateway timeout after 60000ms` alerts.
## Tests
- Added unit tests for WhatsApp reply sanitization, placeholder media handling, and accepting plain relative paths.
- Added unit tests for cron tool timeout defaults.
<!-- greptile_comment -->
<h3>Greptile Summary</h3>
Prevented WhatsApp internal error leakage by filtering tool banners and command exit messages from outbound text, improved media URL validation to skip invalid placeholders while accepting relative paths, removed user-facing error warnings when media fails, and increased default cron.run/runs gateway timeout to 180s to avoid spurious timeout alerts.
- Stripped internal tool banners (`⚠️ 🛠️ Exec:`, `Command exited with code`) from WhatsApp replies
- Enhanced media URL validation to reject placeholders (`image`, `document`) while accepting `~/`, plain relative paths (`image.png`, `images/foo.jpg`)
- Removed "⚠️ Media failed" warnings from user chats when media send fails
- Raised default gateway timeout for `cron.run` and `cron.runs` actions from 60s to 180s
- Added comprehensive unit tests for sanitization, media validation, and timeout defaults
<h3>Confidence Score: 5/5</h3>
- This PR is safe to merge with minimal risk
- Changes are well-scoped, defensive in nature, and backed by comprehensive unit tests. The WhatsApp sanitization prevents error leakage without affecting legitimate messages, media validation prevents crashes from invalid inputs, and cron timeout adjustment addresses a real operational pain point without introducing breaking changes.
- No files require special attention
<sub>Last reviewed commit: 7812d45</sub>
<!-- greptile_other_comments_section -->
<!-- /greptile_comment -->
Most Similar PRs
#10196: fix(whatsapp): sanitize raw mention IDs in outbound messages
by koala73 · 2026-02-06
81.4%
#8052: fix(whatsapp): strip leading whitespace from outbound messages
by FelixFoster · 2026-02-03
80.9%
#9606: fix: pass fileName to WhatsApp document messages
by AytuncYildizli · 2026-02-05
79.2%
#22290: Fix WhatsApp reply quoted-media audio transcription resolution
by apollo-ex · 2026-02-21
78.8%
#7395: fix(whatsapp): strip markdown bold/italic from URLs before sending
by lailoo · 2026-02-02
78.6%
#21893: fix(web): enforce sendPolicy on WhatsApp auto-reply delivery path
by hydro13 · 2026-02-20
77.6%
#4390: fix(whatsapp): allow media from allowlisted groups without groupAllow…
by Sarang19114 · 2026-01-30
77.2%
#9727: fix(whatsapp): retry reconnect loop on initial connection failure
by luizlf · 2026-02-05
77.1%
#23148: fix: forward mediaLocalRoots in whatsapp plugin sendMedia
by MunemHashmi · 2026-02-22
77.0%
#18970: Fix #18937: Don't leak API errors to user channel
by jwchmodx · 2026-02-17
76.8%