Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 6 additions & 1 deletion .github/workflows/cmux-next.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6493,9 +6493,14 @@ jobs:
API: ${{ github.api_url }}/repos/${{ github.repository }}
RUN_URL: ${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}
RESULTS: https://gh-events.cmux.com/compile-checks/v1
# The pull request this head belongs to (empty on a push). A head whose run the controller never
# saw has no check; a read that names its pull request has the controller queue one
# (cmuxterm-hq#5571), instead of this step waiting 40 minutes for a check that never comes.
PR: ${{ github.event.pull_request.number }}
run: |
set -uo pipefail
[[ "$SHA" =~ ^[0-9a-f]{40}$ ]] || { echo "::error title=Compile check::bad head sha '$SHA'"; exit 1; }
[[ -z "${PR:-}" || "$PR" =~ ^[1-9][0-9]*$ ]] || PR=""
# One deadline for the pending post and the wait (40 min); the terminal post comes after it
# (at most 110 s), so the step (50 min) and the App token (60 min) always outlast both.
deadline=$((SECONDS + ${WAIT_SECONDS:-2400}))
Expand All @@ -6520,7 +6525,7 @@ jobs:
# and a 404 (no result yet) is retried by curl inside the same bound.
if ! timeout "$left" curl -sS --fail --connect-timeout 10 --max-time "$((wait + 30))" \
--retry 60 --retry-delay 30 --retry-max-time "$left" --retry-all-errors \
-o "$reply" "$RESULTS/$SHA?repo=${REPO/\//%2F}&wait=$wait"; then
-o "$reply" "$RESULTS/$SHA?repo=${REPO/\//%2F}${PR:+&pr=$PR}&wait=$wait"; then
echo "::warning title=Compile check::no result for $SHA from the controller (attempt $attempt)"
continue
fi
Expand Down
5 changes: 5 additions & 0 deletions tests/test_ci_cmux_next_compile_status.py
Original file line number Diff line number Diff line change
Expand Up @@ -109,6 +109,11 @@ def test_a_failure_links_the_compile_log(self):
def test_the_wait_is_one_blocking_read_per_attempt_and_bounded(self):
_, _, reads = self.run_step(self.reply("pass"))
self.assertEqual(reads, [f"https://results/v1/{SHA}?repo=manaflow-ai%2Fcmux&wait=1800"])
# A pull request's read names it, so the controller can queue a head it never saw (cmuxterm-hq#5571).
_, _, reads = self.run_step(self.reply("pass"), PR="28059")
self.assertEqual(reads, [f"https://results/v1/{SHA}?repo=manaflow-ai%2Fcmux&pr=28059&wait=1800"])
_, _, reads = self.run_step(self.reply("pass"), PR="1;x")
self.assertEqual(reads, [f"https://results/v1/{SHA}?repo=manaflow-ai%2Fcmux&wait=1800"])
_, _, reads = self.run_step(self.reply("running"))
self.assertLessEqual(len(reads), 3)
# Every read asks for no more than what is left of the overall deadline.
Expand Down
Loading