fix(cafe): resolve cooldown notice handling and ensure room state confirmation
- Adjusted `_open_invite_list` to ensure room state cleanup runs regardless of cooldown notice dismissal, preventing unintended back navigation to home. - Enhanced `_invite_student` to confirm room state after attempting to open the invite list, ensuring no stray Escape presses occur on a clean room. - Added detailed comments regarding the root cause of the issue and the fixes applied, including live bug reports and diagnostic findings.
This commit is contained in:
parent
0f3a1c9410
commit
a6e124d175
File diff suppressed because one or more lines are too long
@ -91,6 +91,33 @@ live screenshot pixel-check: SUBSCREEN_HEADER_PROBE read (180,227,244), r=180
|
|||||||
downstream falsely agreed nothing was wrong. Fixed by checking on every
|
downstream falsely agreed nothing was wrong. Fixed by checking on every
|
||||||
_pat_current_view poll iteration instead of only right after a pat -- see
|
_pat_current_view poll iteration instead of only right after a pat -- see
|
||||||
that function's own comment.
|
that function's own comment.
|
||||||
|
|
||||||
|
A 2026-09-19 investigation (see `_save_diagnostic_screenshot`'s own comment)
|
||||||
|
found this same "screen not confirmed (rank-up cutscene stuck?)" warning
|
||||||
|
firing on ~90% of real scheduled runs, but could not reproduce it on demand
|
||||||
|
across several live debugging sessions -- including explicitly trying the
|
||||||
|
cooldown-dialog-dismiss path, which never once failed to recover. Diagnostic
|
||||||
|
screenshot capture was added for the next real occurrence rather than
|
||||||
|
guessing further. That occurrence came 2026-09-24, reported live by the user
|
||||||
|
("it will press Esc many times until it returns home") with an exact log,
|
||||||
|
and reproduced twice in a row on demand this time (the account's invite
|
||||||
|
ticket happened to be on cooldown both times) -- both saved diagnostics
|
||||||
|
showed the plain, undamaged TRUE HOME SCREEN, not a rank-up cutscene at all.
|
||||||
|
Root cause: `_invite_student`'s cooldown-notice path (`_open_invite_list`
|
||||||
|
returning False) `return`ed immediately after dismissing the notice,
|
||||||
|
skipping the exact same "confirm we're back in the room, and correct it if
|
||||||
|
not" cleanup the normal invite-list path always runs. Escaping the notice
|
||||||
|
reliably closes IT (the 2026-07-15 fix above), but that was never actually
|
||||||
|
the same thing as confirming the ROOM behind it is also back to a clean
|
||||||
|
navigable state -- `_pat_room`'s very first call, `_pan_camera`, is a blind
|
||||||
|
drag with no check of its own, so whatever screen was actually left showing
|
||||||
|
got dragged across regardless. The real mechanism connecting that to
|
||||||
|
"reaches home" is `_dismiss_rank_up_if_shown`'s own blind Enter-press loop
|
||||||
|
(5 attempts, unconditional, believing anything that isn't cafe's header must
|
||||||
|
be a rank-up cutscene) -- pressing Enter repeatedly against whatever screen
|
||||||
|
that leftover state actually was, not cafe, evidently backs out through it
|
||||||
|
and beyond, all the way to home. Fixed by moving the room-state cleanup out
|
||||||
|
of the success-only branch so it always runs, cooldown or not.
|
||||||
"""
|
"""
|
||||||
|
|
||||||
import os
|
import os
|
||||||
@ -364,10 +391,32 @@ def _open_invite_list(driver, config):
|
|||||||
# replaced. So verify with is_modal_open and retry the press
|
# replaced. So verify with is_modal_open and retry the press
|
||||||
# (bounded, matching this file's own click-then-verify
|
# (bounded, matching this file's own click-then-verify
|
||||||
# convention) instead of assuming one Escape worked.
|
# convention) instead of assuming one Escape worked.
|
||||||
|
#
|
||||||
|
# Real live bug (2026-09-24, reported live: "it will press Esc
|
||||||
|
# many times until it returns home"): is_modal_open alone is not
|
||||||
|
# a safe stop condition here -- a live state trace (screenshots
|
||||||
|
# at every step) caught it reading True for one extra frame
|
||||||
|
# right as the notice's own closing animation finished, even
|
||||||
|
# though the room behind it was ALREADY back to normal by then
|
||||||
|
# (is_on_subscreen and is_header_bar_visible both True on that
|
||||||
|
# same frame, confirmed by a saved screenshot of a completely
|
||||||
|
# clean, sparkle-visible room). The loop trusted only
|
||||||
|
# is_modal_open and pressed Escape a second, unnecessary time --
|
||||||
|
# and Escape on an already-fine room is exactly the "go back"
|
||||||
|
# press CLAUDE.md already warns is hazardous on home, just one
|
||||||
|
# level up: it backed all the way out of the cafe, confirmed by
|
||||||
|
# a second screenshot catching the game's own "Now Loading..."
|
||||||
|
# transition back to the home screen mid-flight. Fixed by also
|
||||||
|
# accepting is_header_bar_visible as a stop condition --
|
||||||
|
# requires 8 points spread across the full screen width to all
|
||||||
|
# read bright, so it stays reliably False while a real notice's
|
||||||
|
# dimming overlay is still up, but flips True the instant the
|
||||||
|
# room is genuinely clear again, unlike is_modal_open's single
|
||||||
|
# probe point.
|
||||||
for dismiss_attempt in range(1, ROOM_OPEN_RETRIES + 1):
|
for dismiss_attempt in range(1, ROOM_OPEN_RETRIES + 1):
|
||||||
driver.keypress("Escape")
|
driver.keypress("Escape")
|
||||||
driver.wait(1)
|
driver.wait(1)
|
||||||
if not navigation.is_modal_open(driver):
|
if not navigation.is_modal_open(driver) or navigation.is_header_bar_visible(driver):
|
||||||
break
|
break
|
||||||
print(f"[cafe] cooldown notice still open after Escape (attempt {dismiss_attempt}/{ROOM_OPEN_RETRIES})")
|
print(f"[cafe] cooldown notice still open after Escape (attempt {dismiss_attempt}/{ROOM_OPEN_RETRIES})")
|
||||||
else:
|
else:
|
||||||
@ -487,10 +536,7 @@ def _invite_student(driver, config, prefer_highest=True):
|
|||||||
any candidate that would swap an already-seated student's costume or
|
any candidate that would swap an already-seated student's costume or
|
||||||
move one in from the other room.
|
move one in from the other room.
|
||||||
"""
|
"""
|
||||||
if not _open_invite_list(driver, config):
|
if _open_invite_list(driver, config):
|
||||||
print("[cafe] could not open the invitation ticket list -- no ticket available or a click missed, skipping invite")
|
|
||||||
return
|
|
||||||
|
|
||||||
_ensure_invite_sort(driver, config, descending=prefer_highest)
|
_ensure_invite_sort(driver, config, descending=prefer_highest)
|
||||||
|
|
||||||
invited = False
|
invited = False
|
||||||
@ -505,9 +551,34 @@ def _invite_student(driver, config, prefer_highest=True):
|
|||||||
|
|
||||||
if not invited:
|
if not invited:
|
||||||
print("[cafe] no candidate could be invited without swapping/moving an existing student")
|
print("[cafe] no candidate could be invited without swapping/moving an existing student")
|
||||||
|
else:
|
||||||
|
print("[cafe] could not open the invitation ticket list -- no ticket available or a click missed, skipping invite")
|
||||||
|
|
||||||
# Return to the plain room view regardless of outcome.
|
# Return to the plain room view regardless of outcome.
|
||||||
if navigation.is_modal_open(driver):
|
#
|
||||||
|
# Real live bug (2026-09-24): this used to be skipped entirely on the
|
||||||
|
# cooldown-notice path above, which returned right after dismissing the
|
||||||
|
# notice without ever re-confirming the room state. Escaping the notice
|
||||||
|
# reliably clears it (see this module's own 2026-07-15 fix), but that
|
||||||
|
# alone was never verified to also leave the room itself in a clean
|
||||||
|
# is_on_subscreen state -- confirmed live: `_pat_room`'s very next call,
|
||||||
|
# `_pan_camera`, is a blind drag gesture with no state check of its own,
|
||||||
|
# and performing it against whatever screen we actually landed on
|
||||||
|
# (reproduced twice in a row, byte-for-byte identical log both times)
|
||||||
|
# cascaded through `_dismiss_rank_up_if_shown`'s blind Enter-press loop
|
||||||
|
# all the way back to the true home screen, confirmed via its own saved
|
||||||
|
# diagnostic screenshot -- not a rank-up cutscene at all. Moving this
|
||||||
|
# check out of the `if` branch so it always runs, cooldown or not,
|
||||||
|
# gives `_pat_room` a confirmed-clean room to work with either way.
|
||||||
|
# is_modal_open alone is not a safe trigger for a stray Escape here
|
||||||
|
# either -- see _open_invite_list's own 2026-09-24 fix for why: the same
|
||||||
|
# stale-for-one-frame reading, on an already-clean room, cost a real
|
||||||
|
# live run this exact "one extra Escape backs out of the whole room"
|
||||||
|
# failure a second time, from THIS check specifically, even after the
|
||||||
|
# first fix stopped _open_invite_list's own retry loop from firing it.
|
||||||
|
# Same guard applied here: only escape if the room doesn't already read
|
||||||
|
# unambiguously clear.
|
||||||
|
if navigation.is_modal_open(driver) and not navigation.is_header_bar_visible(driver):
|
||||||
driver.keypress("Escape")
|
driver.keypress("Escape")
|
||||||
driver.wait(1)
|
driver.wait(1)
|
||||||
if not navigation.is_on_subscreen(driver):
|
if not navigation.is_on_subscreen(driver):
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user