fix(daily-run): 预检增加稳定性确认,StartUp 失败立即中止本轮
2026-09-25 实战暴露两个问题: - 预检把单帧 679KB 的过渡画面判为就绪交给 MAA,StartUp 仍识别失败 (要求 in-game 级别画面连续两帧稳定才交接) - StartUp 失败后其余任务必然全部失败(9/23-9/25 三天均如此),但旧逻辑 会让 MAA 把剩余 5 个任务逐个跑完报错,白烧约 7 分钟额度 (检测 StartUp Error 立即 SIGINT 中止本轮进入重试)
This commit is contained in:
+28
-12
@@ -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)"
|
REASON="MAA reported Disconnected (cloud session lost)"
|
||||||
break
|
break
|
||||||
fi
|
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
|
done
|
||||||
if [ -n "$REASON" ]; then
|
if [ -n "$REASON" ]; then
|
||||||
echo "[daily-run] watchdog: $REASON; aborting attempt" >&2
|
echo "[daily-run] watchdog: $REASON; aborting attempt" >&2
|
||||||
@@ -100,25 +108,33 @@ fi
|
|||||||
# black/loading <20KB | login 200-350KB (开始唤醒) | title ~480KB |
|
# black/loading <20KB | login 200-350KB (开始唤醒) | title ~480KB |
|
||||||
# announcement/menu >=650KB (hand off to MAA)
|
# announcement/menu >=650KB (hand off to MAA)
|
||||||
preflight() { # arg1: max seconds; returns 0 once the screen looks in-game
|
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
|
local png=/tmp/maa-preflight.png
|
||||||
while [ "$elapsed" -lt "$max" ]; do
|
while [ "$elapsed" -lt "$max" ]; do
|
||||||
if api GET /screencap > "$png" 2>/dev/null; then
|
if api GET /screencap > "$png" 2>/dev/null; then
|
||||||
local size
|
local size
|
||||||
size=$(stat -c %s "$png" 2>/dev/null || echo 0)
|
size=$(stat -c %s "$png" 2>/dev/null || echo 0)
|
||||||
if [ "$size" -ge 650000 ]; then
|
if [ "$size" -ge 650000 ]; then
|
||||||
echo "[daily-run] preflight: ready after ${elapsed}s (screen ${size}B, in-game class)"
|
# Require the in-game-class screen to be stable: a single large
|
||||||
return 0
|
# frame can still be a loading/transition screen (2026-09-25
|
||||||
fi
|
# attempt 1 handed a 679KB not-ready screen to MAA this way).
|
||||||
if [ $((elapsed - last_action)) -ge 12 ]; then
|
ready_hits=$((ready_hits + 1))
|
||||||
if [ "$size" -ge 200000 ] && [ "$size" -lt 350000 ]; then
|
if [ "$ready_hits" -ge 2 ]; then
|
||||||
api POST /click '{"x":640,"y":510}' >/dev/null 2>&1
|
echo "[daily-run] preflight: ready after ${elapsed}s (screen ${size}B, in-game class, stable)"
|
||||||
echo "[daily-run] preflight: ${elapsed}s login-class screen (${size}B); tapping 开始唤醒"
|
return 0
|
||||||
else
|
fi
|
||||||
api POST /click '{"x":640,"y":360}' >/dev/null 2>&1
|
else
|
||||||
echo "[daily-run] preflight: ${elapsed}s screen ${size}B; tapping center"
|
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
|
fi
|
||||||
last_action=$elapsed
|
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
sleep 6
|
sleep 6
|
||||||
|
|||||||
Reference in New Issue
Block a user