Clearly, when the dimension is $3$ and the repeated diagonal entries appear only in contiguous blocks, the problem is not really destabilizing.
The case when the dimension is $n$ is studied in If a matrix is triangular, is there a quicker way to tell if it is can be diagonalized?
When the repeated diagonal entries appear only in contiguous blocks, the matrix $B$ is similar to the matrix of diagonal blocks; here $B$ is similar to $diag(\begin{pmatrix}\lambda_1&a\\0&\lambda_1\end{pmatrix},\lambda_2)$. Thus $B$ is diagonalizable iff each block is diagonal; consequently, the complexity of this algorithm is $0$ algebraic operation.
The case when the equal eigenvalues are not grouped is much more difficult. We have not been able to find an algorithm that does the job in $O(n^2)$ and even in $o(n^3)$.
Who can do better?