From 8bd76b88f880945e22eec58540ab07dcf7b3f0ff Mon Sep 17 00:00:00 2001 From: Nik Afiq Date: Thu, 29 Oct 2026 14:50:56 +0900 Subject: [PATCH] fix(login): fail the run when login can't reach home login.run() only printed a warning and returned when it gave up, so the game window still existed, _run_sequence kept going, every later task aborted at its own first click-verify, and the run exited 0. Cron then logged and Discord-alerted "finished OK" for runs that did nothing -- 18 of them between 2026-10-26 and 2026-10-29 while the client itself was hanging at its "Initialize Catalog" startup screen. Now login kills the stuck game and raises RuntimeError, so the run exits non-zero and ba_cron_run.sh logs FAILED and sends the error alert. Co-Authored-By: Claude Opus 5.5 --- ba_auto/tasks/login.py | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/ba_auto/tasks/login.py b/ba_auto/tasks/login.py index 7dae8f2..bf5e156 100644 --- a/ba_auto/tasks/login.py +++ b/ba_auto/tasks/login.py @@ -553,4 +553,17 @@ def run(driver, config): if attempt < config.LOGIN_MAX_RELAUNCHES: _recover(driver, config) - print(f"[login] warning: could not reach home after {config.LOGIN_MAX_RELAUNCHES} attempts -- manual check needed") + # Raise rather than print-and-return (real incident, 2026-10-29): the + # game window still exists here, so _run_sequence's own window_exists() + # check never fired -- every later task then failed its own first + # click-verify step and aborted safely, the run exited 0, and + # ba_cron_run.sh logged and Discord-alerted "finished OK" for runs that + # did nothing at all (18 of them over 10/26-10/29). Raising makes the + # run exit non-zero, so cron logs FAILED and sends the error alert. The + # game is killed first: it's stuck somewhere short of home, and this + # abort skips the exit_game task that would otherwise have closed it. + driver.kill_game() + raise RuntimeError( + f"[login] could not reach home after {config.LOGIN_MAX_RELAUNCHES} attempts -- " + "aborting the rest of this run (check nik-gpu manually)" + )