From ebca3d1cd4d7f41ca9629100087c2e3a7708b588 Mon Sep 17 00:00:00 2001 From: Carrington Dennis Date: Wed, 12 Aug 2026 17:02:00 -0400 Subject: [PATCH] fix(gbrain-install): --dry-run no longer requires the network `gstack-gbrain-install --dry-run` prints a plan and exits without cloning, but it ran the GitHub reachability check first. The check is gated on VALIDATE_ONLY, and --dry-run sets DRY_RUN, so every dry run made a live request to github.com that nothing downstream needed. When that curl lost a race for sockets or DNS it called fail(), which exits 3, and the dry run reported "cannot reach https://github.com" on a machine that was online. Reproducible outside any test runner: 60 concurrent --dry-run invocations against temp HOME/GSTACK_HOME failed 9 times, ~15%. With the guard, 0 of 60. This is what made `bun test` non-deterministic. The three `gstack-gbrain-install D5 detect-first` tests each call --dry-run and assert exit 0, so a full suite -- which spawns plenty of concurrent processes -- lost whichever of them happened to be running when the curl failed. That matches every symptom: green in isolation, a different one of the three failing each time, sub-second failures rather than timeouts, and 3 of 7 clean-clone suite runs red before this change. Real installs keep the fail-fast offline check; only the path that never clones skips it. Validation on a clean clone: the documented Tier 1 gate run 10 times, 0 failures, against a 43% failure rate on the same clone before the change. Refs #2536 Co-Authored-By: Claude Opus 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 60c8f86b66..95b08e9622 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