[Feature Request] Implement port conflict detection and dynamic port allocation for multiple Claude Code sessions
Bug Description
not necessarily a bug - but if i run claude codes in different terminals they tend to compete for the same ports. Often times claude code will defualt to having settings that cause it to run backend on a specific port instead of taking the next available. Then when two terminals are trying to use the same port they kill each others process and restart.
It's another Claude Code session (PID 96770) that keeps spawning bun run dev for emr-zapier. I need to kill the root shell command
so it stops respawning.
⏺ Bash(kill -9 25837 25839 25840 25841 25842 25843 25844 25845 25846 2>/dev/null; sleep 2; pgrep -f "emr-zapier" > /dev/null && echo
"STILL ALIVE" || echo "All dead")
⎿ All dead
⏺ Now quickly grab port 3001 before it comes back.
⏺ Bash(lsof -i :3001 -t 2>/dev/null | xargs kill -9 2>/dev/null; sleep 1; nohup bun run ws-server.ts > /tmp/ws-server.log 2>&1 &
disown && echo "ws-server PID: $!" &&…)
⎿ ws-server PID:
Twilio WebSocket + API Server
instead of realizing this was going to be an infite loop and having the context the other terminal would do the same thing it wanted to compete to grab the port as soon as possible
Environment Info
- Platform: darwin
- Terminal: iTerm.app
- Version: 2.1.41
- Feedback ID: a80a0892-28be-46bc-8117-148d37e51985
This issue has 3 comments on GitHub. Read the full discussion on GitHub ↗