-
Notifications
You must be signed in to change notification settings - Fork 17
ops: remove bridge tmux guidance, keep tmux for agent sessions #140
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from 2 commits
a8bc265
b1c8ced
0692c67
342626d
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -83,16 +83,35 @@ fi | |
|
|
||
| if [ -n "$BRIDGE_SCRIPT" ]; then | ||
| RELEASE_BRIDGE="/opt/baudbot/current/slack-bridge" | ||
| tmux kill-session -t slack-bridge 2>/dev/null || true | ||
| echo "Starting Slack bridge ($BRIDGE_SCRIPT)..." | ||
| tmux new-session -d -s slack-bridge \ | ||
| "export PATH=$HOME/.varlock/bin:$HOME/opt/node-v22.14.0-linux-x64/bin:\$PATH && \ | ||
| cd $RELEASE_BRIDGE && \ | ||
| while true; do \ | ||
| varlock run --path ~/.config/ -- node $BRIDGE_SCRIPT; \ | ||
| echo '⚠️ Bridge exited (\$?), restarting in 5s...'; \ | ||
| sleep 5; \ | ||
| done" | ||
| BRIDGE_LOG_DIR="$HOME/.pi/agent/logs" | ||
| BRIDGE_LOG_FILE="$BRIDGE_LOG_DIR/slack-bridge.log" | ||
| BRIDGE_PID_FILE="$HOME/.pi/agent/slack-bridge.pid" | ||
|
|
||
| mkdir -p "$BRIDGE_LOG_DIR" | ||
|
|
||
| # Stop any previous bridge process tracked by pid file. | ||
| if [ -f "$BRIDGE_PID_FILE" ]; then | ||
| old_pid="$(cat "$BRIDGE_PID_FILE" 2>/dev/null || true)" | ||
| if [ -n "$old_pid" ] && kill -0 "$old_pid" 2>/dev/null; then | ||
| kill "$old_pid" 2>/dev/null || true | ||
| sleep 1 | ||
| kill -9 "$old_pid" 2>/dev/null || true | ||
| fi | ||
| rm -f "$BRIDGE_PID_FILE" | ||
| fi | ||
|
|
||
| echo "Starting Slack bridge ($BRIDGE_SCRIPT)... logs: $BRIDGE_LOG_FILE" | ||
| ( | ||
| export PATH="$HOME/.varlock/bin:$HOME/opt/node-v22.14.0-linux-x64/bin:$PATH" | ||
| cd "$RELEASE_BRIDGE" | ||
| while true; do | ||
| varlock run --path ~/.config/ -- node "$BRIDGE_SCRIPT" >>"$BRIDGE_LOG_FILE" 2>&1 | ||
| echo "[$(date -Is)] ⚠️ Bridge exited ($?), restarting in 5s..." >>"$BRIDGE_LOG_FILE" | ||
| sleep 5 | ||
| done | ||
| ) & | ||
| echo $! > "$BRIDGE_PID_FILE" | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The PID file stores the subshell PID, not the actual Node process. When the bridge exits and the Prompt To Fix With AIThis is a comment left during a code review.
Path: start.sh
Line: 113
Comment:
The PID file stores the subshell PID, not the actual Node process. When the bridge exits and the `while true` loop restarts it, the PID file becomes stale, pointing to the subshell wrapping the loop rather than tracking each new Node process instance.
How can I resolve this? If you propose a fix, please make it concise.
Member
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Good callout. In this case the PID file is intentionally storing the supervisor subshell PID (the restart loop), not the child node PID. That PID remains stable across child restarts and is the one we need to kill to stop bridge supervision. I added an inline clarification comment next to the PID write so this intent is explicit. Responded by pi-coding-agent using openai/gpt-5. |
||
| chmod 600 "$BRIDGE_PID_FILE" | ||
| fi | ||
|
|
||
| # Set session name (read by auto-name.ts extension) | ||
|
|
||
Uh oh!
There was an error while loading. Please reload this page.