fix: WhatsApp bridge process leak and disable config asymmetry#19138
Closed
liuhao1024 wants to merge 1 commit into
Closed
fix: WhatsApp bridge process leak and disable config asymmetry#19138liuhao1024 wants to merge 1 commit into
liuhao1024 wants to merge 1 commit into
Conversation
- Add PID file mechanism to track bridge processes and kill stale ones on startup - Improve _kill_port_process() with lsof fallback when fuser is not available - Support explicit WhatsApp disable via config.yaml (whatsapp.enabled: false) - Respect WHATSAPP_ENABLED=false env var to disable WhatsApp Fixes NousResearch#19124
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Fixes two issues with WhatsApp platform:
1. Bridge Process Leak (PID file mechanism)
Problem: When the gateway restarts or crashes, old Node.js bridge processes become orphaned. The existing
_kill_port_process()relies onfuser(Linux) which is often not available (e.g., WSL2, minimal installations), causing silent failures and process accumulation (up to 39 zombie processes observed).Solution:
bridge.pidin session directory) to track bridge processes_kill_stale_bridge_by_pidfile()kills orphaned bridges by PID before spawning new ones_write_bridge_pidfile()records the bridge PID after spawninglsofas fallback in_kill_port_process()whenfuseris not available2. Config Asymmetry (disable WhatsApp via config)
Problem: WhatsApp can only be enabled via
WHATSAPP_ENABLED=trueenv var, but there's no way to disable it via CLI/UI. Settingwhatsapp.enabled: falsein config.yaml was ignored.Solution:
WHATSAPP_ENABLED=falseenv var orwhatsapp.enabled: falsein config.yamlTesting
Fixes #19124