Fix: Aggressively kill all bridge processes on startup#179
Merged
benvinegar merged 1 commit intomainfrom Feb 25, 2026
Merged
Conversation
Prevent port 7890 conflicts by killing ALL bridge processes (not just port holders) during startup-pi.sh cleanup. This fixes the common failure mode where: 1. Control-agent restarts and gets a new session ID 2. Runs startup-pi.sh which kills the tmux session 3. But a bridge process survives (detached/zombied/wrong session tree) 4. Old process holds port 7890, new bridge crash-loops The new cleanup strategy: - Kill tmux session (stops restart loop) - Kill ALL node (broker-)?bridge.mjs processes with SIGTERM - Wait 3s for graceful exit, then SIGKILL stragglers - Final safety check: kill anything still on port 7890 This is more aggressive than the old approach but necessary to prevent orphaned bridge processes after agent restarts.
Greptile SummaryImproved bridge cleanup robustness by switching from port-based to process pattern matching. The new approach kills all bridge processes ( Key improvements:
Confidence Score: 5/5
Important Files Changed
Last reviewed commit: 859e043 |
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.
Problem
The slack-bridge frequently fails to start with EADDRINUSE on port 7890 after control-agent restarts. This happens because:
startup-pi.shkills the tmux session and tries to kill port holdersSolution
Make the cleanup more aggressive:
node (broker-)?bridge\.mjsThis ensures no bridge processes survive across control-agent restarts.
Testing
bridge.mjsandbroker-bridge.mjsImpact