diff --git a/internal/cluster/orchestrator.go b/internal/cluster/orchestrator.go index b28409c..76cb422 100644 --- a/internal/cluster/orchestrator.go +++ b/internal/cluster/orchestrator.go @@ -107,6 +107,13 @@ func (o *Orchestrator) Startup(ctx context.Context, opts StartupOptions) (err er if readErr != nil { return fmt.Errorf("read startup intent: %w", readErr) } + if currentIntent.State == state.IntentStartupInProgress { + o.log.Printf("warning: detected stale startup intent from a previous interrupted run; clearing it before continuing") + if clearErr := state.MustWriteIntent(o.cfg.State.IntentPath, state.IntentNormal, "auto-clear stale startup intent", "startup"); clearErr != nil { + return fmt.Errorf("clear stale startup intent: %w", clearErr) + } + currentIntent = state.Intent{State: state.IntentNormal} + } if currentIntent.State == state.IntentShuttingDown { return fmt.Errorf("startup blocked: shutdown intent is active (%s)", currentIntent.Reason) }