From c7faef885bc2ed52fc0b0ec5e88cde688bd98a78 Mon Sep 17 00:00:00 2001 From: Garry Tan Date: Sun, 16 Aug 2026 09:09:37 -0700 Subject: [PATCH] fix: gstack-gbrain-install --dry-run no longer requires the network (#2540) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The GitHub reachability probe (curl --head, 10s max) was gated only on --validate-only, so a --dry-run — which prints a plan and exits without ever cloning — could fail with exit 3 "cannot reach https://github.com" whenever the curl lost a race for sockets/DNS. Reproducible at ~15% by running 60 dry-runs concurrently, and the cause of intermittent red in the D5 detect-first tests, which call this exact path. The probe now also skips under --dry-run: requiring the network for a plan-print buys nothing and costs a real failure mode. Real installs still fail fast when offline rather than hanging git clone. Absorbs PR #2540 by @CarringtonCreative (applied via git am -3; 26 tests pass across test/gbrain-detect-install.test.ts + test/egress-receipt-wiring.test.ts). Fixes the offline/flake half of #2536. Co-authored-by: Carrington Dennis Co-Authored-By: Claude Fable 5 --- bin/gstack-gbrain-install | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/bin/gstack-gbrain-install b/bin/gstack-gbrain-install index 35aab4b08..f7d302b8f 100755 --- a/bin/gstack-gbrain-install +++ b/bin/gstack-gbrain-install @@ -84,7 +84,14 @@ if ! $VALIDATE_ONLY; then # GitHub reachability — fail fast if offline rather than hanging `git clone`. # --max-time 10, --head (no body), quiet. Status code 200-4xx means we reached # the server (even 404 is reachability proof). - if ! curl -s --head --max-time 10 https://github.com >/dev/null 2>&1; then + # + # Skipped under --dry-run: a dry run prints a plan and exits without ever + # cloning, so requiring the network buys nothing and costs a real failure mode. + # It made `--dry-run` fail (exit 3, "cannot reach https://github.com") whenever + # the curl lost a race for sockets/DNS — reproducible at ~15% by running 60 + # dry-runs concurrently, and the cause of intermittent red in the D5 tests, + # which call this exact path. + if ! $DRY_RUN && ! curl -s --head --max-time 10 https://github.com >/dev/null 2>&1; then fail "cannot reach https://github.com. Check your network and try again." fi fi