diff --git a/ci/build/build-code-server.sh b/ci/build/build-code-server.sh
index 1ede7a88a78a..c465f7e4a0c4 100755
--- a/ci/build/build-code-server.sh
+++ b/ci/build/build-code-server.sh
@@ -19,9 +19,15 @@ main() {
   fi
 
   if ! [ -f ./lib/coder-cloud-agent ]; then
+    echo "Downloading the cloud agent..."
+
+    # for arch; we do not use OS from lib.sh and get our own.
+    # lib.sh normalizes macos to darwin - but cloud-agent's binaries do not
+    source ./ci/lib.sh
     OS="$(uname | tr '[:upper:]' '[:lower:]')"
+
     set +e
-    curl -fsSL "https://storage.googleapis.com/coder-cloud-releases/agent/latest/$OS/cloud-agent" -o ./lib/coder-cloud-agent
+    curl -fsSL "https://github.com/cdr/cloud-agent/releases/latest/download/cloud-agent-$OS-$ARCH" -o ./lib/coder-cloud-agent
     chmod +x ./lib/coder-cloud-agent
     set -e
   fi