fix(rig): respect parked/docked status in gt up and gt rig start
Previously, `gt up` and `gt rig start` would start witnesses and refineries for parked/docked rigs, bypassing the operational status protection. Only the daemon respected the wisp config status. Now both commands check wisp config status before starting agents: - `gt up` shows "skipped (rig parked)" for parked/docked rigs - `gt rig start` warns and skips parked/docked rigs This prevents accidentally bringing parked/docked rigs back online when running routine commands. Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
committed by
beads/crew/emma
parent
6d29f34cd0
commit
4ef93e1d8a
@@ -825,6 +825,15 @@ func runRigStart(cmd *cobra.Command, args []string) error {
|
||||
continue
|
||||
}
|
||||
|
||||
// Check if rig is parked or docked
|
||||
cfg := wisp.NewConfig(townRoot, rigName)
|
||||
status := cfg.GetString("status")
|
||||
if status == "parked" || status == "docked" {
|
||||
fmt.Printf("%s Rig '%s' is %s - skipping (use 'gt rig unpark' or 'gt rig undock' first)\n",
|
||||
style.Warning.Render("⚠"), rigName, status)
|
||||
continue
|
||||
}
|
||||
|
||||
fmt.Printf("Starting rig %s...\n", style.Bold.Render(rigName))
|
||||
|
||||
var started []string
|
||||
|
||||
@@ -22,6 +22,7 @@ import (
|
||||
"github.com/steveyegge/gastown/internal/rig"
|
||||
"github.com/steveyegge/gastown/internal/style"
|
||||
"github.com/steveyegge/gastown/internal/tmux"
|
||||
"github.com/steveyegge/gastown/internal/wisp"
|
||||
"github.com/steveyegge/gastown/internal/witness"
|
||||
"github.com/steveyegge/gastown/internal/workspace"
|
||||
)
|
||||
@@ -431,8 +432,18 @@ func startRigAgentsWithPrefetch(rigNames []string, prefetchedRigs map[string]*ri
|
||||
}
|
||||
|
||||
// upStartWitness starts a witness for the given rig and returns a result struct.
|
||||
// Respects parked/docked status - skips starting if rig is not operational.
|
||||
func upStartWitness(rigName string, r *rig.Rig) agentStartResult {
|
||||
name := "Witness (" + rigName + ")"
|
||||
|
||||
// Check if rig is parked or docked
|
||||
townRoot := filepath.Dir(r.Path)
|
||||
cfg := wisp.NewConfig(townRoot, rigName)
|
||||
status := cfg.GetString("status")
|
||||
if status == "parked" || status == "docked" {
|
||||
return agentStartResult{name: name, ok: true, detail: fmt.Sprintf("skipped (rig %s)", status)}
|
||||
}
|
||||
|
||||
mgr := witness.NewManager(r)
|
||||
if err := mgr.Start(false, "", nil); err != nil {
|
||||
if err == witness.ErrAlreadyRunning {
|
||||
@@ -444,8 +455,18 @@ func upStartWitness(rigName string, r *rig.Rig) agentStartResult {
|
||||
}
|
||||
|
||||
// upStartRefinery starts a refinery for the given rig and returns a result struct.
|
||||
// Respects parked/docked status - skips starting if rig is not operational.
|
||||
func upStartRefinery(rigName string, r *rig.Rig) agentStartResult {
|
||||
name := "Refinery (" + rigName + ")"
|
||||
|
||||
// Check if rig is parked or docked
|
||||
townRoot := filepath.Dir(r.Path)
|
||||
cfg := wisp.NewConfig(townRoot, rigName)
|
||||
status := cfg.GetString("status")
|
||||
if status == "parked" || status == "docked" {
|
||||
return agentStartResult{name: name, ok: true, detail: fmt.Sprintf("skipped (rig %s)", status)}
|
||||
}
|
||||
|
||||
mgr := refinery.NewManager(r)
|
||||
if err := mgr.Start(false, ""); err != nil {
|
||||
if err == refinery.ErrAlreadyRunning {
|
||||
|
||||
Reference in New Issue
Block a user