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 <noreply@anthropic.com>
Root-caused 3 consecutive real cron failures (one q4h, two daily, all
2026-09-20) to Steam itself sitting signed out on its own account
sign-in dialog -- not a Blue Archive client issue, and not something any
amount of retrying/relaunching the game can fix.
login._steam_needs_sign_in (new detector.read_text_white_on_dark, since
the dialog's own light-on-dark text is the opposite OCR polarity this
project usually assumes) recognizes that exact state and turns the
generic "game window never appeared" warning into a specific, actionable
one instead of requiring a fresh screenshot investigation every time it
recurs.
ba_daily.py's _run_sequence now checks driver.window_exists() after every
task (except the last, and except exit_game) and aborts the whole run
immediately with one clear message if the window is gone, instead of
letting every remaining task independently rediscover this via its own
doomed pre-task retry cycle before crashing two tasks deep in a stack
trace. Still propagates as a real FAILED exit code -- this project
deliberately never swallows a genuine crash.
Confirmed live: reproduced the original failure via a real
./ba_cron_run.sh q4h run while Steam was still genuinely signed out, then
verified the new diagnostic fired correctly and the sequence aborted
immediately. After the user signed back into Steam, ran the actual daily
recovery preset end-to-end (all 17 tasks, ~24 minutes, exit 0) to catch
up the account's daily claims.
Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
- cafe.py: room 2 now invites the lowest-affection candidate instead of
highest (room 1 unchanged), plus OCR'd invited-student name logging
- exit_game.py: alert (AP_ALERT: log tag, picked up by ba_cron_run.sh's
Discord alerting) if AP is still unspent above threshold when the game
closes
- login.py: re-check window_exists() after the stabilization wait to catch
a startup window-flicker race that could crash a run
- config.py/mapping.md: supporting constants and reference-mapping updates
Also rewrites plan.md: retires the phase-by-phase changelog (now fully
superseded by CLAUDE.md's own documentation) down to forward-looking
backlog items, and adds a performance-improvement plan from a cron-log
time analysis (lesson.py's per-cell screenshot redundancy, event_sweep's
multi-call design).
Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
- Added _loading_buffer_visible function to detect the loading spinner badge
- Updated _wait_for_home to utilize the new detection for early recovery
- Introduced configuration options for loading buffer detection parameters
- Improved handling of stuck loading state to reduce wait time
fix(cron): make ba_cron_run.sh executable
- Changed file mode of ba_cron_run.sh to 755 to ensure it is executable
- Verified that cron can now execute the script as intended
fix(navigation): prevent crash in return_to_home when window disappears
- Added guard to return_to_home to check if the game window exists before focusing
- Ensured robustness in cleanup path during game exit
- Implemented `_connectivity_confirmed` to verify session validity by opening the Mission panel, addressing two failure modes:
1. Bright full-screen transition frames that could falsely satisfy home checks.
2. Dead sessions due to server resets or concurrent logins, which appear as normal home screens until navigation is attempted.
- Improved detection logic by requiring a second verification of `_true_home` after a short wait, reducing the likelihood of coincidental false positives.
- Confirmed live against real scenarios, ensuring robust handling of session states during login.
- Added `login.py` to handle the login process, including detection of various states such as the title screen, network error notices, loading transitions, daily attendance cards, and the home screen.
- Integrated a recovery mechanism to relaunch the game if it gets stuck during loading.
- Updated `ba_daily.py` to include the login task in the default execution order, ensuring it runs first to navigate to the home screen before other tasks.
- Fixed a bug in the home detection logic to accurately identify when the user is on the true home screen.
- Live-tested and calibrated the login flow against real game states, confirming functionality and addressing any issues encountered during testing.