In rescue mode, the agent attempts to stop the heartbeater thread
even though it was never started, causing a RuntimeError. This fix
adds checks to ensure the heartbeater thread is alive before
attempting to stop it.
Assisted-By: Claude Sonnet 4.5
Change-Id: I3e97b10f2c7f3c454f0db2a3c3c8efb61ffeda5a
Signed-off-by: Riccardo Pittau <elfosardo@gmail.com>
(cherry picked from commit bae591a808)