From e281708b20d0d156391700e520437137a2e02b26 Mon Sep 17 00:00:00 2001 From: LordMathis Date: Thu, 9 Oct 2025 18:56:23 +0200 Subject: [PATCH] Enhance auto-start logic to differentiate between remote and local instances --- pkg/manager/manager.go | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/pkg/manager/manager.go b/pkg/manager/manager.go index 37989db..56df75a 100644 --- a/pkg/manager/manager.go +++ b/pkg/manager/manager.go @@ -345,8 +345,18 @@ func (im *instanceManager) autoStartInstances() { log.Printf("Auto-starting instance %s", inst.Name) // Reset running state before starting (since Start() expects stopped instance) inst.SetStatus(instance.Stopped) - if err := inst.Start(); err != nil { - log.Printf("Failed to auto-start instance %s: %v", inst.Name, err) + + // Check if this is a remote instance + if node := im.getNodeForInstance(inst); node != nil { + // Remote instance - use StartRemoteInstance + if _, err := im.StartRemoteInstance(node, inst.Name); err != nil { + log.Printf("Failed to auto-start remote instance %s: %v", inst.Name, err) + } + } else { + // Local instance - call Start() directly + if err := inst.Start(); err != nil { + log.Printf("Failed to auto-start instance %s: %v", inst.Name, err) + } } } }