Skip to content

Commit 29ca8e0

Browse files
authored
bridge: hard-rename slack-bridge paths/artifacts with migration shims (phase 3) (#192)
1 parent 85ec3bd commit 29ca8e0

43 files changed

Lines changed: 186 additions & 100 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.c8rc.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"all": false,
33
"include": [
4-
"slack-bridge/security.mjs",
4+
"gateway-bridge/security.mjs",
55
"bin/scan-extensions.mjs"
66
],
77
"exclude": [

.gitignore

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,9 @@
33
*.pem
44
node_modules/
55
# Gateway bridge
6+
gateway-bridge/node_modules/
7+
gateway-bridge/.env
8+
# Legacy compat path (symlink)
69
slack-bridge/node_modules/
710
slack-bridge/.env
811
.pi/

AGENTS.md

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ Baudbot is hardened infrastructure for running always-on AI agents.
55
Use this file for **repo-wide** guidance. For directory-specific rules, use the nearest nested `AGENTS.md`:
66
- [`bin/AGENTS.md`](bin/AGENTS.md)
77
- [`pi/extensions/AGENTS.md`](pi/extensions/AGENTS.md)
8-
- [`slack-bridge/AGENTS.md`](slack-bridge/AGENTS.md)
8+
- [`gateway-bridge/AGENTS.md`](gateway-bridge/AGENTS.md)
99

1010
## How Baudbot works
1111

@@ -16,7 +16,7 @@ Baudbot is a persistent, team-facing coding agent system. It connects to Slack,
1616
```text
1717
Slack
1818
19-
Gateway bridge (slack-bridge dir; broker pull-mode or legacy Socket Mode)
19+
Gateway bridge (gateway-bridge dir; broker pull-mode or legacy Socket Mode)
2020
2121
control-agent (always-on, manages todo/routing/Slack threads)
2222
├── dev-agent(s) — ephemeral coding workers in isolated worktrees
@@ -47,7 +47,8 @@ There are two startup phases with distinct ownership:
4747
- `dev-agent/` — coding worker persona
4848
- `sentry-agent/` — incident triage persona
4949
- `pi/settings.json` — pi agent settings
50-
- `slack-bridge/` — Gateway bridge runtime + security module
50+
- `gateway-bridge/` — Gateway bridge runtime + security module
51+
- `slack-bridge` → symlink to `gateway-bridge/` (legacy compatibility shim)
5152
- `docs/` — architecture/operations/security documentation
5253
- `test/` — vitest wrappers for shell scripts, integration, and legacy Node tests
5354
- `hooks/` — git hooks (security-critical `pre-commit` protecting admin-managed files)

bin/ci/setup-arch.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -96,7 +96,7 @@ echo "=== Installing test dependencies ==="
9696
export PATH="/home/baudbot_agent/opt/node/bin:$PATH"
9797
cd /home/baudbot_admin/baudbot
9898
npm install --ignore-scripts 2>&1 | tail -1
99-
cd slack-bridge && npm install 2>&1 | tail -1
99+
cd gateway-bridge && npm install 2>&1 | tail -1
100100
cd ..
101101

102102
echo "=== Running tests ==="

bin/ci/setup-ubuntu.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -115,7 +115,7 @@ echo "=== Installing test dependencies ==="
115115
export PATH="/home/baudbot_agent/opt/node/bin:$PATH"
116116
cd /home/baudbot_admin/baudbot
117117
npm install --ignore-scripts 2>&1 | tail -1
118-
cd slack-bridge && npm install 2>&1 | tail -1
118+
cd gateway-bridge && npm install 2>&1 | tail -1
119119
cd ..
120120

121121
echo "=== Running tests ==="

bin/ci/smoke-agent-runtime.sh

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,8 @@ readonly AGENT_USER="baudbot_agent"
1515
readonly AGENT_HOME="/home/${AGENT_USER}"
1616
readonly CONTROL_DIR="${AGENT_HOME}/.pi/session-control"
1717
readonly CONTROL_ALIAS="${CONTROL_DIR}/control-agent.alias"
18-
readonly BRIDGE_STATUS_FILE="${AGENT_HOME}/.pi/agent/slack-bridge-supervisor.json"
18+
readonly BRIDGE_STATUS_FILE="${AGENT_HOME}/.pi/agent/gateway-bridge-supervisor.json"
19+
readonly BRIDGE_STATUS_FILE_LEGACY="${AGENT_HOME}/.pi/agent/slack-bridge-supervisor.json"
1920
readonly START_TIMEOUT_SECONDS=60
2021
readonly STABILIZE_SECONDS=20
2122

@@ -143,7 +144,7 @@ main() {
143144
# start.sh. In CI the agent doesn't run long enough for startup-pi.sh
144145
# to execute, so the status file may not exist. Log but don't fail.
145146
log "checking bridge supervisor status file"
146-
if [[ -f "$BRIDGE_STATUS_FILE" ]]; then
147+
if [[ -f "$BRIDGE_STATUS_FILE" ]] || [[ -f "$BRIDGE_STATUS_FILE_LEGACY" ]]; then
147148
log "bridge supervisor status file exists"
148149
else
149150
log "bridge supervisor status file not found (expected — bridge starts inside agent)"

bin/deploy.sh

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -325,12 +325,12 @@ deploy_runtime_asset_entry() {
325325

326326
bb_manifest_for_each RUNTIME_ASSET_MANIFEST deploy_runtime_asset_entry
327327

328-
# Clean up legacy bridge runtime path; bridge now runs from /opt release only.
328+
# Clean up legacy bridge runtime paths; bridge now runs from /opt release only.
329329
if [ "$DRY_RUN" -eq 0 ]; then
330-
as_agent bash -c "rm -rf '$BAUDBOT_HOME/runtime/slack-bridge'"
331-
log "✓ removed legacy runtime/slack-bridge"
330+
as_agent bash -c "rm -rf '$BAUDBOT_HOME/runtime/gateway-bridge' '$BAUDBOT_HOME/runtime/slack-bridge'"
331+
log "✓ removed legacy runtime/gateway-bridge and runtime/slack-bridge"
332332
else
333-
log "would remove: runtime/slack-bridge (legacy path)"
333+
log "would remove: runtime/gateway-bridge and runtime/slack-bridge (legacy paths)"
334334
fi
335335

336336
# ── Memory Seeds ─────────────────────────────────────────────────────────────
@@ -441,7 +441,7 @@ VEOF
441441
echo ' \"source_sha\": \"$GIT_SHA\",'
442442
echo ' \"files\": {'
443443
first=1
444-
for dir in '$BAUDBOT_HOME/.pi/agent/extensions' '$BAUDBOT_HOME/.pi/agent/skills' '/opt/baudbot/current/slack-bridge' '$BAUDBOT_HOME/runtime/bin'; do
444+
for dir in '$BAUDBOT_HOME/.pi/agent/extensions' '$BAUDBOT_HOME/.pi/agent/skills' '/opt/baudbot/current/gateway-bridge' '$BAUDBOT_HOME/runtime/bin'; do
445445
if [ -d \"\$dir\" ]; then
446446
while IFS= read -r f; do
447447
hash=\$(sha256sum \"\$f\" | cut -d' ' -f1)

bin/doctor.sh

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -307,14 +307,17 @@ else
307307
fi
308308
fi
309309

310-
BRIDGE_DIR="$BAUDBOT_CURRENT_LINK/slack-bridge"
310+
BRIDGE_DIR="$BAUDBOT_CURRENT_LINK/gateway-bridge"
311+
BRIDGE_DIR_LEGACY="$BAUDBOT_CURRENT_LINK/slack-bridge"
311312
if [ -d "$BRIDGE_DIR" ] && [ -f "$BRIDGE_DIR/bridge.mjs" ]; then
312313
pass "gateway bridge deployed ($BRIDGE_DIR)"
314+
elif [ -d "$BRIDGE_DIR_LEGACY" ] && [ -f "$BRIDGE_DIR_LEGACY/bridge.mjs" ]; then
315+
pass "gateway bridge deployed via legacy path ($BRIDGE_DIR_LEGACY)"
313316
else
314317
if [ "$IS_ROOT" -ne 1 ] && { [ -d "$BAUDBOT_CURRENT_LINK" ] || [ -e "$BAUDBOT_CURRENT_LINK" ]; }; then
315318
warn "cannot verify gateway bridge files as non-root (run: sudo baudbot doctor)"
316319
else
317-
fail "gateway bridge not deployed (expected: $BRIDGE_DIR; run: sudo baudbot update)"
320+
fail "gateway bridge not deployed (expected: $BRIDGE_DIR or $BRIDGE_DIR_LEGACY; run: sudo baudbot update)"
318321
fi
319322
fi
320323

bin/lib/baudbot-runtime.sh

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -195,15 +195,20 @@ PY
195195

196196
print_bridge_supervisor_status() {
197197
local agent_user="${BAUDBOT_AGENT_USER:-baudbot_agent}"
198-
local status_file="/home/$agent_user/.pi/agent/slack-bridge-supervisor.json"
198+
local status_file="/home/$agent_user/.pi/agent/gateway-bridge-supervisor.json"
199+
local legacy_status_file="/home/$agent_user/.pi/agent/slack-bridge-supervisor.json"
199200
local summary=""
200201
local mode=""
201202
local state=""
202203
local failures=""
203204
local threshold=""
204205

205206
if [ ! -r "$status_file" ]; then
206-
return 0
207+
if [ -r "$legacy_status_file" ]; then
208+
status_file="$legacy_status_file"
209+
else
210+
return 0
211+
fi
207212
fi
208213

209214
summary="$(python3 - "$status_file" <<'PY'

bin/security-audit.sh

Lines changed: 22 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -220,13 +220,17 @@ else
220220
ok "~/.pi/agent/skills/ is a real directory"
221221
fi
222222

223-
BRIDGE_DIR="$BAUDBOT_CURRENT_LINK/slack-bridge"
223+
BRIDGE_DIR="$BAUDBOT_CURRENT_LINK/gateway-bridge"
224+
BRIDGE_DIR_LEGACY="$BAUDBOT_CURRENT_LINK/slack-bridge"
224225
# shellcheck disable=SC2088
225226
if [ -d "$BRIDGE_DIR" ]; then
226227
ok "Release bridge directory exists ($BRIDGE_DIR)"
228+
elif [ -d "$BRIDGE_DIR_LEGACY" ]; then
229+
ok "Release bridge directory exists via legacy path ($BRIDGE_DIR_LEGACY)"
230+
BRIDGE_DIR="$BRIDGE_DIR_LEGACY"
227231
else
228232
finding "WARN" "release bridge directory not found" \
229-
"Expected: $BRIDGE_DIR (run: sudo baudbot update)"
233+
"Expected: $BRIDGE_DIR or $BRIDGE_DIR_LEGACY (run: sudo baudbot update)"
230234
fi
231235

232236
# Check version stamp exists
@@ -252,21 +256,34 @@ if [ -f "$MANIFEST_FILE" ]; then
252256
for critical_file in \
253257
".pi/agent/extensions/tool-guard.ts" \
254258
".pi/agent/extensions/tool-guard.test.mjs" \
255-
"release/slack-bridge/security.mjs" \
256-
"release/slack-bridge/security.test.mjs"; do
259+
"release/gateway-bridge/security.mjs" \
260+
"release/gateway-bridge/security.test.mjs"; do
257261

258262
if [[ "$critical_file" == release/* ]]; then
259263
full_path="$BAUDBOT_CURRENT_LINK/${critical_file#release/}"
260264
else
261265
full_path="$BAUDBOT_HOME/$critical_file"
262266
fi
267+
268+
expected_hash=$(grep "\"$critical_file\"" "$MANIFEST_FILE" 2>/dev/null | sed 's/.*: *"\([^"]*\)".*/\1/' || echo "")
269+
270+
# Legacy compatibility: manifests from older releases used release/slack-bridge/* keys.
271+
if [[ "$critical_file" == "release/gateway-bridge/security.mjs" ]] && [ -z "$expected_hash" ]; then
272+
critical_file="release/slack-bridge/security.mjs"
273+
full_path="$BAUDBOT_CURRENT_LINK/slack-bridge/security.mjs"
274+
expected_hash=$(grep "\"$critical_file\"" "$MANIFEST_FILE" 2>/dev/null | sed 's/.*: *"\([^"]*\)".*/\1/' || echo "")
275+
elif [[ "$critical_file" == "release/gateway-bridge/security.test.mjs" ]] && [ -z "$expected_hash" ]; then
276+
critical_file="release/slack-bridge/security.test.mjs"
277+
full_path="$BAUDBOT_CURRENT_LINK/slack-bridge/security.test.mjs"
278+
expected_hash=$(grep "\"$critical_file\"" "$MANIFEST_FILE" 2>/dev/null | sed 's/.*: *"\([^"]*\)".*/\1/' || echo "")
279+
fi
280+
263281
if [ ! -f "$full_path" ]; then
264282
finding "WARN" "Missing critical file: $critical_file" "Run deploy.sh"
265283
missing=$((missing + 1))
266284
continue
267285
fi
268286

269-
expected_hash=$(grep "\"$critical_file\"" "$MANIFEST_FILE" 2>/dev/null | sed 's/.*: *"\([^"]*\)".*/\1/' || echo "")
270287
if [ -z "$expected_hash" ]; then
271288
finding "WARN" "$critical_file not in manifest" "Run deploy.sh to regenerate"
272289
continue

0 commit comments

Comments
 (0)