From 33ce65c118ce8d632eafe4c8ff574167ed67412e Mon Sep 17 00:00:00 2001 From: Aryan Kumar Date: Thu, 2 Jul 2026 08:15:32 -0700 Subject: [PATCH] [bugfix]: harden modal ci pr checkout --- fastvideo/tests/modal/pr_test.py | 20 +++++++++++++++++--- 1 file changed, 17 insertions(+), 3 deletions(-) diff --git a/fastvideo/tests/modal/pr_test.py b/fastvideo/tests/modal/pr_test.py index a80e9a8f6..0611ba842 100644 --- a/fastvideo/tests/modal/pr_test.py +++ b/fastvideo/tests/modal/pr_test.py @@ -106,9 +106,23 @@ def run_test_command(test_command: str, if pr_number: print(f"PR number: {pr_number}") - # For PRs (including forks), use GitHub's PR refs to get the correct commit + # For PRs (including forks), use GitHub's PR refs to get the correct commit. + # Keep the fetch narrow and retry transient GitHub/HTTP2 disconnects; otherwise + # Modal shards can fail before pytest starts. if pr_number and pr_number != "false": - checkout_command = f"git fetch --prune origin refs/pull/{pr_number}/head && git checkout FETCH_HEAD" + checkout_command = f""" + for attempt in 1 2 3; do + git fetch --prune --no-tags --depth=1 origin refs/pull/{pr_number}/head && + git checkout --detach FETCH_HEAD && + break + + status=$? + if [ "$attempt" -eq 3 ]; then + exit "$status" + fi + sleep $((attempt * 5)) + done + """ print(f"Using PR ref for checkout: {checkout_command}") else: checkout_command = f"git checkout {git_commit}" @@ -125,7 +139,7 @@ def run_test_command(test_command: str, command = f""" source $HOME/.local/bin/env && source /opt/venv/bin/activate && - git clone {git_repo} /FastVideo && + git clone --filter=blob:none --no-checkout {git_repo} /FastVideo && cd /FastVideo && {checkout_command} && git submodule update --init --recursive &&