From b1525842304528ea2fa26f066435a2439237623a Mon Sep 17 00:00:00 2001 From: RRRosmontis Date: Fri, 25 Sep 2026 11:48:31 +0800 Subject: [PATCH] =?UTF-8?q?fix(daily-run):=20=E9=A2=84=E6=A3=80=E5=A2=9E?= =?UTF-8?q?=E5=8A=A0=E7=A8=B3=E5=AE=9A=E6=80=A7=E7=A1=AE=E8=AE=A4=EF=BC=8C?= =?UTF-8?q?StartUp=20=E5=A4=B1=E8=B4=A5=E7=AB=8B=E5=8D=B3=E4=B8=AD?= =?UTF-8?q?=E6=AD=A2=E6=9C=AC=E8=BD=AE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 2026-09-25 实战暴露两个问题: - 预检把单帧 679KB 的过渡画面判为就绪交给 MAA,StartUp 仍识别失败 (要求 in-game 级别画面连续两帧稳定才交接) - StartUp 失败后其余任务必然全部失败(9/23-9/25 三天均如此),但旧逻辑 会让 MAA 把剩余 5 个任务逐个跑完报错,白烧约 7 分钟额度 (检测 StartUp Error 立即 SIGINT 中止本轮进入重试) --- bin/maa-online-daily-run | 40 ++++++++++++++++++++++++++++------------ 1 file changed, 28 insertions(+), 12 deletions(-) diff --git a/bin/maa-online-daily-run b/bin/maa-online-daily-run index 9ec3e05..3492180 100755 --- a/bin/maa-online-daily-run +++ b/bin/maa-online-daily-run @@ -76,6 +76,14 @@ run_daily_watchdog() { # arg1: log file, arg2: task file name; sets REASON on ab REASON="MAA reported Disconnected (cloud session lost)" break fi + if grep -qE '\] StartUp Error$' "$log" 2>/dev/null; then + # When StartUp fails, every later task fails too (observed on + # 2026-09-23/24/25): the game screen is not ready. Abort now + # instead of burning ~7 more minutes of quota on the remaining + # tasks; the retry's preflight will find a ready screen. + REASON="StartUp failed; game screen not ready (remaining tasks would fail too)" + break + fi done if [ -n "$REASON" ]; then echo "[daily-run] watchdog: $REASON; aborting attempt" >&2 @@ -100,25 +108,33 @@ fi # black/loading <20KB | login 200-350KB (开始唤醒) | title ~480KB | # announcement/menu >=650KB (hand off to MAA) preflight() { # arg1: max seconds; returns 0 once the screen looks in-game - local max="$1" elapsed=0 last_action=-20 + local max="$1" elapsed=0 last_action=-20 ready_hits=0 local png=/tmp/maa-preflight.png while [ "$elapsed" -lt "$max" ]; do if api GET /screencap > "$png" 2>/dev/null; then local size size=$(stat -c %s "$png" 2>/dev/null || echo 0) if [ "$size" -ge 650000 ]; then - echo "[daily-run] preflight: ready after ${elapsed}s (screen ${size}B, in-game class)" - return 0 - fi - if [ $((elapsed - last_action)) -ge 12 ]; then - if [ "$size" -ge 200000 ] && [ "$size" -lt 350000 ]; then - api POST /click '{"x":640,"y":510}' >/dev/null 2>&1 - echo "[daily-run] preflight: ${elapsed}s login-class screen (${size}B); tapping 开始唤醒" - else - api POST /click '{"x":640,"y":360}' >/dev/null 2>&1 - echo "[daily-run] preflight: ${elapsed}s screen ${size}B; tapping center" + # Require the in-game-class screen to be stable: a single large + # frame can still be a loading/transition screen (2026-09-25 + # attempt 1 handed a 679KB not-ready screen to MAA this way). + ready_hits=$((ready_hits + 1)) + if [ "$ready_hits" -ge 2 ]; then + echo "[daily-run] preflight: ready after ${elapsed}s (screen ${size}B, in-game class, stable)" + return 0 + fi + else + ready_hits=0 + if [ $((elapsed - last_action)) -ge 12 ]; then + if [ "$size" -ge 200000 ] && [ "$size" -lt 350000 ]; then + api POST /click '{"x":640,"y":510}' >/dev/null 2>&1 + echo "[daily-run] preflight: ${elapsed}s login-class screen (${size}B); tapping 开始唤醒" + else + api POST /click '{"x":640,"y":360}' >/dev/null 2>&1 + echo "[daily-run] preflight: ${elapsed}s screen ${size}B; tapping center" + fi + last_action=$elapsed fi - last_action=$elapsed fi fi sleep 6