Dynamically discover rigs in checkStaleAgents

Instead of hardcoding the rig list (gastown, beads), now loads rigs
from mayor/rigs.json using config.LoadRigsConfig. Falls back gracefully
to just checking global agents if the config cannot be loaded.

(gt-mmp0q)

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

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
gastown/crew/jack
2025-12-30 23:23:05 -08:00
committed by Steve Yegge
parent 31c4a222bc
commit d37bd53a90

View File

@@ -10,6 +10,7 @@ import (
"time" "time"
"github.com/steveyegge/gastown/internal/beads" "github.com/steveyegge/gastown/internal/beads"
"github.com/steveyegge/gastown/internal/config"
"github.com/steveyegge/gastown/internal/constants" "github.com/steveyegge/gastown/internal/constants"
"github.com/steveyegge/gastown/internal/tmux" "github.com/steveyegge/gastown/internal/tmux"
) )
@@ -730,12 +731,18 @@ func (d *Daemon) checkStaleAgents() {
beads.MayorBeadID(), beads.MayorBeadID(),
} }
// Add rig-specific agents (witness, refinery) for known rigs // Dynamically discover rigs from the rigs config
// For now, we check gastown - could be expanded to discover rigs dynamically rigsConfigPath := filepath.Join(d.config.TownRoot, "mayor", "rigs.json")
rigs := []string{"gastown", "beads"} rigsConfig, err := config.LoadRigsConfig(rigsConfigPath)
for _, rig := range rigs { if err != nil {
agentBeadIDs = append(agentBeadIDs, beads.WitnessBeadID(rig)) // Log warning but continue with global agents only
agentBeadIDs = append(agentBeadIDs, beads.RefineryBeadID(rig)) d.logger.Printf("Warning: could not load rigs config: %v", err)
} else {
// Add rig-specific agents (witness, refinery) for each discovered rig
for rigName := range rigsConfig.Rigs {
agentBeadIDs = append(agentBeadIDs, beads.WitnessBeadID(rigName))
agentBeadIDs = append(agentBeadIDs, beads.RefineryBeadID(rigName))
}
} }
for _, agentBeadID := range agentBeadIDs { for _, agentBeadID := range agentBeadIDs {