feat: replace baudbot attach with baudbot debug#168
Merged
Conversation
The old `attach` command spawned a new pi instance connected to the control-agent's control socket. This didn't actually attach to the running session — it created a duplicate agent, causing confusion (two control-agents responding, bridge routing conflicts, etc.). Replace with `baudbot debug` which launches the debug-agent skill: a dedicated observability tool with a live dashboard showing control-agent activity, health metrics, and system state. Key differences: - No longer pretends to "attach" — clearly a separate debug tool - Includes live dashboard (debug-dashboard.ts extension) - Has --session-control so it can send_to_session to running agents - Auto-detects model from API keys (uses mid-tier: sonnet/gpt-4.1) - Supports --model override - Unsets PKG_EXECPATH to avoid varlock poisoning in child processes - Requires root (sudo baudbot debug) like other admin commands Removed: - cmd_attach and all attach-related helpers (pause_before_attach, etc.) - --pi/--tmux mode flags (no longer applicable)
Greptile SummaryReplaces the broken Key Changes:
Technical Review:
Confidence Score: 4/5
Important Files Changed
Flowchart%%{init: {'theme': 'neutral'}}%%
flowchart TD
A[User runs: sudo baudbot debug] --> B{--model specified?}
B -->|Yes| C[Use specified model]
B -->|No| D[Read ~/.config/.env]
D --> E{BAUDBOT_MODEL set?}
E -->|Yes| C
E -->|No| F{ANTHROPIC_API_KEY set?}
F -->|Yes| G[Use claude-sonnet-4-5]
F -->|No| H{OPENAI_API_KEY set?}
H -->|Yes| I[Use gpt-4.1]
H -->|No| J{GEMINI_API_KEY set?}
J -->|Yes| K[Use gemini-3-flash-preview]
J -->|No| L[Error: No API key found]
C --> M{Skill dir exists?}
G --> M
I --> M
K --> M
M -->|Yes| N[Launch debug-agent pi session]
M -->|No| O[Error: Run baudbot deploy]
N --> P[Dashboard shows health metrics]
P --> Q[User can send_to_session]
Q --> R[Ctrl+C exits cleanly]
Last reviewed commit: b5854e6 |
- Update baudbot.test.sh: rename attach tests to debug (matches cmd rename) - Update test mock runtime stubs: cmd_attach → cmd_debug - heartbeat.ts: remove unused 'resolve' import, isNaN → Number.isNaN, remove useless continue, remove unused catch binding - heartbeat.test.mjs: remove unused imports (fs, path, os, beforeEach, afterEach) and unused helpers (setup, teardown, writeFile, and DEFAULT_INTERVAL_MS/MIN_INTERVAL_MS constants) - bin/baudbot: suppress shellcheck SC2034 for YELLOW (used by config.sh) - baudbot-runtime.sh: add MODEL input validation as defense-in-depth
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.
Summary
The old
baudbot attachcommand was fundamentally broken — it spawned a new pi instance connected to the control-agent's control socket instead of actually attaching to the running session. This created a duplicate agent, causing:Changes
Replace
baudbot attachwithbaudbot debug, which launches the debug-agent skill — a dedicated observability tool.What
baudbot debugdoes:--session-controlso you cansend_to_sessionto query running agentsCtrl+Cexits cleanly without affecting the control-agentUsage:
Model auto-detection:
Reads API keys from
~/.config/.envand picks a mid-tier model:ANTHROPIC_API_KEY→anthropic/claude-sonnet-4-5OPENAI_API_KEY→openai/gpt-4.1GEMINI_API_KEY→google/gemini-3-flash-previewBAUDBOT_MODELoverride takes priorityRemoved:
cmd_attach,pause_before_attach,--pi/--tmuxmode flagsTechnical notes:
PKG_EXECPATHbefore launching to avoid varlock poisoningsudo) — consistent with other admin commands~/.pi/agent/skills/debug-agent→/opt/baudbot/current/pi/skills/debug-agentTesting
bin/test.sh: 13/15 pass (2 pre-existing failures on main: heartbeat, memory)