-
Notifications
You must be signed in to change notification settings - Fork 196
heartbeat.sh uses GNU sed syntax that fails on macOS #425
Description
Bug
The heartbeat.sh template generated by agent-deck uses GNU sed alternation syntax (\(true\|false\)) which is not supported by macOS BSD sed. This causes the ENABLED check to always return empty, silently skipping every heartbeat.
Affected line
ENABLED=$(agent-deck -p "$PROFILE" conductor status --json 2>/dev/null | tr -d '\n' | sed -n 's/.*"enabled"[[:space:]]*:[[:space:]]*\(true\|false\).*/\1/p')\| alternation in basic regex is a GNU extension. On macOS, this pattern never matches, so ENABLED is always empty and the script exits at the != "true" check.
The same issue affects the STATUS extraction line, though that one happens to work because it doesn't use alternation.
Impact
- Heartbeat never fires on macOS — the conductor never gets poked to check on waiting sessions
- No error is logged (silent failure — exit 0)
- The bridge's internal heartbeat loop is also disabled when the OS daemon is detected, so neither path works
Suggested fix
Replace sed JSON parsing with python3 (already a dependency for the bridge):
ENABLED=$(agent-deck -p "$PROFILE" conductor status --json 2>/dev/null \
| python3 -c "import sys,json; print(json.load(sys.stdin).get('enabled',False))" 2>/dev/null)
if [ "$ENABLED" != "True" ]; then
exit 0
fiOr use grep -o which works on both GNU and BSD:
ENABLED=$(agent-deck -p "$PROFILE" conductor status --json 2>/dev/null \
| grep -o '"enabled"[[:space:]]*:[[:space:]]*true')
if [ -z "$ENABLED" ]; then
exit 0
fiAdditional issue: bridge plist uses system Python
The com.agentdeck.conductor-bridge launchd plist is generated with /opt/homebrew/bin/python3 instead of the venv Python at ~/.agent-deck/conductor/venv/bin/python3. Since toml (and other deps) are installed in the venv but not system-wide, the bridge crashes on startup with ModuleNotFoundError: No module named 'toml'.
Environment
- macOS (Darwin 25.2.0, arm64)
- agent-deck binary (Mach-O 64-bit arm64)
- BSD sed (macOS default)