fix: replace subshell bridge supervisor with tmux session#158
Merged
benvinegar merged 2 commits intomainfrom Feb 24, 2026
Merged
fix: replace subshell bridge supervisor with tmux session#158benvinegar merged 2 commits intomainfrom
benvinegar merged 2 commits intomainfrom
Conversation
The bridge ran as a subshell (`( ... ) &`) child of start.sh or startup-cleanup.sh. When pi was restarted independently, the bridge died with no recovery. The subshell also kept the script's process group alive, causing startup-cleanup.sh to hang. Replace with a `slack-bridge` tmux session with a built-in restart loop — same pattern as sentry-agent, which has been stable. Changes: - Subshell supervisor → tmux session with 5s restart loop - PID-file cleanup → `lsof -ti :7890 | xargs kill -9` (catches orphaned processes the PID file missed) - Kill existing slack-bridge tmux session before creating a new one - Remove bridge-restart-policy.sh dependency (no longer needed) - Script completes immediately (tmux detaches, no hang)
Greptile SummaryReplaces the subshell-based Slack bridge supervisor with a tmux session pattern (matching Major changes:
Issues found:
Confidence Score: 3/5
Important Files Changed
Sequence DiagramsequenceDiagram
participant S as startup-cleanup.sh
participant P as Port 7890
participant T as tmux session
participant B as slack-bridge
Note over S,P: Old approach: subshell supervisor
S->>P: Check PID file, kill old supervisor
S->>S: Start subshell background
S->>S: Track supervisor PID in file
Note over S: Script hangs if called from pi
Note over S,B: New approach: tmux session
S->>P: lsof -ti :7890 and kill -9
S->>T: tmux kill-session if exists
S->>T: tmux new-session -d detached
loop Restart loop in tmux
T->>B: varlock run -- node bridge.mjs
B-->>T: exit with code
T->>T: sleep 5 seconds
end
Note over S: Script returns immediately
Note over T,B: Bridge restarts automatically
Last reviewed commit: c1110d5 |
| echo "Starting slack-bridge ($BRIDGE_SCRIPT) via tmux..." | ||
| tmux new-session -d -s "$BRIDGE_TMUX_SESSION" "\ | ||
| unset PKG_EXECPATH; \ | ||
| export PATH=\$HOME/.varlock/bin:\$HOME/opt/node-v22.14.0-linux-x64/bin:\$PATH; \ |
There was a problem hiding this comment.
Hardcoded node path $HOME/opt/node-v22.14.0-linux-x64/bin differs from start.sh which uses bb_resolve_runtime_node_bin_dir to dynamically locate node.
This will break if:
- Node version is upgraded
BAUDBOT_RUNTIME_NODE_BIN_DIRoverride is set- Installation uses
~/opt/node/binsymlink pattern
Suggested change
| export PATH=\$HOME/.varlock/bin:\$HOME/opt/node-v22.14.0-linux-x64/bin:\$PATH; \ | |
| export PATH=\$HOME/.varlock/bin:\$HOME/opt/node/bin:\$PATH; \ |
Or source runtime-node.sh and use bb_resolve_runtime_node_bin_dir to match start.sh behavior.
Prompt To Fix With AI
This is a comment left during a code review.
Path: pi/skills/control-agent/startup-cleanup.sh
Line: 128
Comment:
Hardcoded node path `$HOME/opt/node-v22.14.0-linux-x64/bin` differs from `start.sh` which uses `bb_resolve_runtime_node_bin_dir` to dynamically locate node.
This will break if:
- Node version is upgraded
- `BAUDBOT_RUNTIME_NODE_BIN_DIR` override is set
- Installation uses `~/opt/node/bin` symlink pattern
```suggestion
export PATH=\$HOME/.varlock/bin:\$HOME/opt/node/bin:\$PATH; \
```
Or source `runtime-node.sh` and use `bb_resolve_runtime_node_bin_dir` to match `start.sh` behavior.
How can I resolve this? If you propose a fix, please make it concise.Use ~/opt/node/bin with fallback to versioned glob. Fixes the runtime-node-paths drift check in CI.
Collaborator
Author
|
Fixed in 4ec7393 — node path is now resolved dynamically (~/opt/node/bin with fallback to versioned glob). Good catch from the drift check. |
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 ran as a subshell (
( ... ) &) child ofstartup-cleanup.sh. Three issues:start.sh), the bridge subshell dies with no recoverystartup-cleanup.shnever returns when called from pi's bash toolFix
Replace the subshell supervisor with a
slack-bridgetmux session — same pattern assentry-agent, which has been rock solid.( ... ) &lsof -ti :7890 | xargs kill -9replaces PID-file tracking — kills whatever is on the port, guaranteedtmux kill-sessioncleans up any existing bridge session before starting freshtmux new-session -ddetaches, no hangAlso removes the
bridge-restart-policy.shdependency — the tmux restart loop is simpler and sufficient.Testing
main)