Skip to content

Commit b4522c0

Browse files
committed
fix(maestro): stop on-device screenrecord; raise android widget cap to 30m
The Android per-flow video recording left the on-device `screenrecord` running: stop_recording only killed the local `adb shell` client, so the recorder kept going until its --time-limit (180s) and `wait` blocked ~2.5 min PER FLOW. That silently added ~15 min to multi-flow shards and pushed them past the 20-min cap (mass "cancelled" widget shards). Fix: `adb shell pkill -INT screenrecord` to make the recorder finalize the mp4 promptly, then a bounded client kill so we never block on the time-limit again. Also raise the android-widget-tests cap 20→30 min as a hard backstop. With the recording bug fixed a healthy shard finishes far under this; hitting 30 now means real app instability, not cap tightness.
1 parent fbcf0f4 commit b4522c0

2 files changed

Lines changed: 19 additions & 11 deletions

File tree

.github/workflows/NativePipeline.yml

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -624,13 +624,12 @@ jobs:
624624
# Run if widgets need testing (widgets_to_test is not empty) and project succeeds
625625
if: ${{ needs.scope.outputs.widgets_to_test != '[]' && always() && needs.project.result == 'success' && (needs.android-app.result == 'success' || needs.android-app.result == 'skipped') }}
626626
runs-on: ubuntu-26.04
627-
# 20 min per widget shard. With the up-front smoke check (fast-fail on a broken build) and
628-
# the trimmed Precondition waits (60s×2, was 240s×3), a healthy widget — even the largest
629-
# (web-view: 9 flows) — finishes well under this; a broken/hung one no longer grinds to the
630-
# old 60-min cap. Backstop only; the smoke check should catch broken builds in ~1 min.
631-
# (Was 15: a few legit-but-slow shards were truncated at the cap; 20 gives headroom without
632-
# re-opening the runaway-hang window.)
633-
timeout-minutes: 20
627+
# 30 min hard cap per widget shard. A healthy widget's flows run in ~30s each; the cap is a
628+
# backstop for genuinely wedged shards. Bumped 20→30 after a run where shards were cancelled
629+
# at 20 min — that was traced to a video-recording bug (the on-device screenrecord wasn't
630+
# being stopped, adding ~2.5 min/flow); with that fixed 30 is comfortable headroom. If shards
631+
# still hit 30, the cause is real app instability, not the cap — needs a different fix.
632+
timeout-minutes: 30
634633
strategy:
635634
# 5 parallel Linux shards. Bounded by GitHub Free's 20 total concurrent-job cap (not the
636635
# macOS-5 cap that limits the iOS matrix), so there's headroom. iOS stays at 4 to keep a

maestro/helpers/helpers.sh

Lines changed: 13 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -52,15 +52,24 @@ stop_recording() {
5252
[ "$RECORD_VIDEO" = "true" ] || return 0
5353
local keep="$1"
5454
[ -z "$REC_PID" ] && return 0
55-
# SIGINT lets the recorder finalize the file (moov atom / flush); SIGKILL would corrupt it.
56-
kill -INT "$REC_PID" 2>/dev/null || true
57-
wait "$REC_PID" 2>/dev/null || true
5855
if [ "$PLATFORM" == "android" ]; then
59-
sleep 2 # let screenrecord flush to /sdcard before pulling
56+
# CRITICAL: stop the ON-DEVICE screenrecord, not just the local adb client. Killing only
57+
# REC_PID (the `adb shell screenrecord` client) leaves the recorder running on the device
58+
# until its --time-limit (180s), so `wait` would block ~2.5 min per flow and blow the job
59+
# timeout. `pkill -INT` makes screenrecord finalize the mp4 (moov atom) promptly.
60+
adb shell pkill -INT screenrecord >/dev/null 2>&1 || true
61+
sleep 2 # let screenrecord write the trailer + flush to /sdcard
62+
kill "$REC_PID" 2>/dev/null || true # client should already be gone; ensure it, never block
63+
wait "$REC_PID" 2>/dev/null || true
6064
if [ "$keep" == "keep" ]; then
6165
adb pull "$ANDROID_REC_DEVICE_PATH" "$REC_FILE" >/dev/null 2>&1 || true
6266
fi
6367
adb shell rm -f "$ANDROID_REC_DEVICE_PATH" >/dev/null 2>&1 || true
68+
else
69+
# iOS: SIGINT lets simctl recordVideo finalize the file (moov atom); SIGKILL would corrupt it.
70+
# recordVideo has no time-limit, so the client exits promptly on the signal.
71+
kill -INT "$REC_PID" 2>/dev/null || true
72+
wait "$REC_PID" 2>/dev/null || true
6473
fi
6574
REC_PID=""
6675
if [ "$keep" != "keep" ]; then

0 commit comments

Comments
 (0)