Skip to content

The ultimate harness for coding agents and beyond. All your agents. All your machines. One command center. Start with code, then follow your curiosity and build across disciplines: CAD, circuits, robots, games and music.

Allow cold Google Cloud probes to finish before reinstalling (#650)

Deee1e9e2fa02d1
diff --git a/.github/actions/setup-gcloud/check-installed.py b/.github/actions/setup-gcloud/check-installed.py
index becc76267..334fe3ace 100644
--- a/.github/actions/setup-gcloud/check-installed.py
+++ b/.github/actions/setup-gcloud/check-installed.py
@@ -5,11 +5,15 @@ import os
from pathlib import Path
import re
import subprocess
+import time
# Conservative floor: the Ubuntu runner SDK exercised by our real GCS publication
# contract. Older installations take the existing latest-version install path.
MIN_VERSION = (586, 0, 0)
-PROBE_TIMEOUT_SECONDS = 5
+# A cold runner can spend just over five seconds starting its existing SDK.
+# Killing that healthy probe made two jobs install another copy for 20-24s.
+# Keep the check bounded, but allow cold startup to finish before falling back.
+PROBE_TIMEOUT_SECONDS = 10
def installed_version():
@@ -28,14 +32,16 @@ def installed_version():
def main():
+ started = time.monotonic()
version = installed_version()
+ elapsed = time.monotonic() - started
with Path(os.environ["GITHUB_OUTPUT"]).open("a") as output:
output.write(f"reusable={'true' if version else 'false'}\n")
# Never forward raw SDK stdout/stderr into logs or Actions output commands.
if version:
- print(f"Reusing Google Cloud CLI {version}")
+ print(f"Reusing Google Cloud CLI {version} (probe {elapsed:.2f}s)")
else:
- print("Installing Google Cloud CLI: no working runner installation at or above 586.0.0")
+ print(f"Installing Google Cloud CLI: no working runner installation at or above 586.0.0 (probe {elapsed:.2f}s)")
if __name__ == "__main__":
diff --git a/scripts/tests/test_gcloud_setup.py b/scripts/tests/test_gcloud_setup.py
index 1cefd177f..862492a79 100644
--- a/scripts/tests/test_gcloud_setup.py
+++ b/scripts/tests/test_gcloud_setup.py
@@ -45,7 +45,7 @@ class GcloudSetupTests(unittest.TestCase):
for error in (
FileNotFoundError(), PermissionError(),
subprocess.CalledProcessError(1, ["gcloud"], stderr="private diagnostic"),
- subprocess.TimeoutExpired(["gcloud"], 5, stderr="private diagnostic"),
+ subprocess.TimeoutExpired(["gcloud"], 10, stderr="private diagnostic"),
UnicodeDecodeError("utf-8", b"\xff", 0, 1, "invalid encoding"),
):
with self.subTest(error=type(error).__name__), patch.object(setup.subprocess, "run", side_effect=error):
@@ -56,7 +56,7 @@ class GcloudSetupTests(unittest.TestCase):
setup.installed_version()
run.assert_called_once_with(
["gcloud", "version", "--format=json"],
- check=True, capture_output=True, text=True, timeout=5,
+ check=True, capture_output=True, text=True, timeout=10,
)
def test_action_output_is_boolean_and_preserves_other_outputs(self):