fix(daemon): respect rig bead docked status in isRigOperational
The daemon's isRigOperational() was only checking wisp config layer for docked/parked status. However, 'gt rig dock' sets the status:docked label on the rig identity bead (global/synced), not wisp config. This caused the daemon to auto-restart agents on docked rigs because it couldn't see the bead-level docked status. Fix: - Check rig bead labels for status:docked and status:parked - Also updated mol-deacon-patrol formula to explicitly skip DOCKED/PARKED rigs in health-scan step Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
@@ -596,7 +596,7 @@ func (d *Daemon) isRigOperational(rigName string) (bool, string) {
|
||||
d.logger.Printf("Warning: no wisp config for %s - parked state may have been lost", rigName)
|
||||
}
|
||||
|
||||
// Check rig status - parked and docked rigs should not have agents auto-started
|
||||
// Check wisp layer first (local/ephemeral overrides)
|
||||
status := cfg.GetString("status")
|
||||
switch status {
|
||||
case "parked":
|
||||
@@ -605,6 +605,25 @@ func (d *Daemon) isRigOperational(rigName string) (bool, string) {
|
||||
return false, "rig is docked"
|
||||
}
|
||||
|
||||
// Check rig bead labels (global/synced docked status)
|
||||
// This is the persistent docked state set by 'gt rig dock'
|
||||
rigPath := filepath.Join(d.config.TownRoot, rigName)
|
||||
if rigCfg, err := rig.LoadRigConfig(rigPath); err == nil && rigCfg.Beads != nil {
|
||||
rigBeadID := fmt.Sprintf("%s-rig-%s", rigCfg.Beads.Prefix, rigName)
|
||||
rigBeadsDir := beads.ResolveBeadsDir(rigPath)
|
||||
bd := beads.NewWithBeadsDir(rigPath, rigBeadsDir)
|
||||
if issue, err := bd.Show(rigBeadID); err == nil {
|
||||
for _, label := range issue.Labels {
|
||||
if label == "status:docked" {
|
||||
return false, "rig is docked (global)"
|
||||
}
|
||||
if label == "status:parked" {
|
||||
return false, "rig is parked (global)"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Check auto_restart config
|
||||
// If explicitly blocked (nil), auto-restart is disabled
|
||||
if cfg.IsBlocked("auto_restart") {
|
||||
|
||||
Reference in New Issue
Block a user