ci: bound each cmux-tui client download so a stalled stream can't hang the Release build

Merged
AU
17d ago
+104-2

A stalled download in scripts/install-cmux-tui-client.sh could hold the Release build for the whole job timeout. Each download attempt is now bounded by progress and reconnects on retry, so a dead stream costs about a minute instead of the job.

In full-suite run 36685498203, the Release build's "Install Release helpers" step sat from 08:33 to 09:20 UTC. curl logged HTTP/2 stream 1 was not closed cleanly after 19.5 minutes, then again on each retry. Two things caused it:

  • curl had --retry 5 but no connect timeout, low-speed limit or max time.
  • curl's own retries reuse the stalled connection.

The job hit its 60-minute limit and was cancelled, which failed macos / macOS status and the run (part of #15488).

Each attempt is now its own curl process, so a retry opens a fresh connection. Each is bounded by progress, not total time:

  • --connect-timeout 30
  • --speed-limit 1024 --speed-time 60: a stream that moves less than 1 KiB/s for 60 s is cut.

A slow but moving download of a 40 MB slice still finishes. There are up to 5 attempts, 3 s apart.

CMUX_TUI_CLIENT_DOWNLOAD_ATTEMPTS and CMUX_TUI_CLIENT_DOWNLOAD_STALL_SECONDS override the budget; a malformed value exits 64 and names the variable. A slice download that fails every attempt exits instead of falling through to a sha256 mismatch.

Verification

tests/test_install_cmux_tui_client.sh gains a stalled-download case. A local TLS server sends response headers and one byte, then nothing. The real installer and real curl must fail inside a 60 s watchdog; a hang counts as a failure, not a pass.

The case also requires:

  • curl's stall error (28) on both attempts
  • the installer's after 2 attempts error
  • exactly two server connections

So a failure for another reason, such as a certificate error, does not pass it.

  • Before the fix (5be32d8160e): FAIL: a stalled download hung the installer for 60 s.
  • After the fix: PASS: a stalled download fails after 8 s instead of hanging, with all 21 cases passing.

I ran both locally with macOS /bin/bash 3.2. On this head CI ran the file in the Linux release-tooling guard lane, where it passed. The macOS release-build lane that also runs it was skipped for this diff.

An independent review also checked:

  • a real download of the published manifest with these flags
  • 404 and 500 retries
  • the env validation, which exits before any connection

Changelog

  • none

šŸ¤– Generated with Claude Code

Summary by CodeRabbit

  • Bug Fixes
    • Installer downloads now retry failed or stalled transfers and report an error if all attempts fail.
    • Downloads stop waiting when transfer speed remains below the configured threshold, helping prevent the installer from hanging indefinitely.
  • Configuration
    • Download attempt limits and stall-time limits can be configured; defaults are five attempts and 60 seconds.