feat(status): Check bd daemon health and attempt restart (gt-2f0p3)

Add bd daemon health check at the start of gt status:
- Check daemon health via bd daemon health --json
- Attempt restart if daemons are unhealthy (version mismatch, stale, unresponsive)
- Show warning at end of status output if daemons could not be started
- Non-blocking: status display continues regardless of daemon state

This prevents the 39+ second slowdown when bd daemons are not running
properly, as each bd command falls back to slow direct mode.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
furiosa
2026-01-02 12:05:26 -08:00
committed by Steve Yegge
parent c92cc955dd
commit b81c4760fe
2 changed files with 149 additions and 1 deletions

View File

@@ -126,6 +126,10 @@ func runStatus(cmd *cobra.Command, args []string) error {
return fmt.Errorf("not in a Gas Town workspace: %w", err)
}
// Check bd daemon health and attempt restart if needed
// This is non-blocking - if daemons can't be started, we show a warning but continue
bdWarning := beads.EnsureBdDaemonHealth(townRoot)
// Load town config
townConfigPath := constants.MayorTownPath(townRoot)
townConfig, err := config.LoadTownConfig(townConfigPath)
@@ -302,7 +306,17 @@ func runStatus(cmd *cobra.Command, args []string) error {
if statusJSON {
return outputStatusJSON(status)
}
return outputStatusText(status)
if err := outputStatusText(status); err != nil {
return err
}
// Show bd daemon warning at the end if there were issues
if bdWarning != "" {
fmt.Printf("%s %s\n", style.Warning.Render("⚠"), bdWarning)
fmt.Printf(" Run 'bd daemon killall && bd daemon --start' to restart daemons\n")
}
return nil
}
func outputStatusJSON(status TownStatus) error {