← Back to PRs

#19303: Fix WhatsApp internal error leakage + cron.run timeout defaults

by koala73 open 2026-02-17 17:09 View on GitHub →
channel: whatsapp-web agents size: M
## 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