fix: accept StateStarting in OnStackStart lifecycle hook

Containers with Docker healthchecks show 'starting' state for
~30s after compose up. The container is connectable, just hasn't
passed its healthcheck yet. Accept both running and starting.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
2026-02-25 20:24:47 +01:00
parent 74d985b543
commit b5f4a666f0
@@ -82,14 +82,15 @@ func (m *Manager) OnStackStart(_ context.Context, stackName string) {
continue
}
// Both provider and target must be running to re-apply
// Both provider and target must be running (or starting) to re-apply.
// StateStarting = container running but healthcheck hasn't passed yet — still connectable.
provStack, pOk := m.stacks.GetStack(provider)
if !pOk || !provStack.Deployed || provStack.State != stacks.StateRunning {
if !pOk || !provStack.Deployed || !isStackUp(provStack.State) {
continue
}
if target != "filebrowser" {
tgtStack, tOk := m.stacks.GetStack(target)
if !tOk || !tgtStack.Deployed || tgtStack.State != stacks.StateRunning {
if !tOk || !tgtStack.Deployed || !isStackUp(tgtStack.State) {
continue
}
}
@@ -120,6 +121,11 @@ func (m *Manager) OnStackStart(_ context.Context, stackName string) {
}
}
// isStackUp returns true if the stack is running or starting (healthcheck pending).
func isStackUp(state stacks.ContainerState) bool {
return state == stacks.StateRunning || state == stacks.StateStarting
}
// OnStackRemove is called when a stack is removed.
// Permanently revokes and deletes integration state.
func (m *Manager) OnStackRemove(_ context.Context, stackName string) {