🪢 Open source agent evals & observability: Trace, evaluate, and improve LLM applications with one open platform.
TypeScript analyticsautogenevaluationlangchainlarge-language-modelsllama-indexllmllm-evaluationllm-observabilityllmopsmonitoringobservabilityopen-sourceopenaiplaygroundprompt-engineeringprompt-managementself-hostedycombinator
fix(agents): repair Docker socket reachability on Cursor Cloud start (#16009)
Max Deichmann0ad88802b30d
diff --git a/.agents/README.md b/.agents/README.mdindex 1530b03c9f..e77663825c 100644--- a/.agents/README.md+++ b/.agents/README.md@@ -246,6 +246,12 @@ and public build controls are passed into Compose. The seed command also receiveexplicit local connection URLs so an exported secret cannot redirect it to anexternal database.+Nested Cursor VMs sometimes leave `/var/run` mode `0700`, which hides+`docker.sock` from the `ubuntu` agent user even when that user is in the+`docker` group. `start-cursor-cloud.sh` opens search/execute on the socket+parent directories (and loosens the socket if needed) before probing the+daemon, including again after `service docker start`.+### Cursor team toolsRepository files cannot publish or authenticate Cursor Team Marketplace MCPs.diff --git a/.cursor/Dockerfile b/.cursor/Dockerfileindex 1cd6e05fba..2c4ca0c71e 100644--- a/.cursor/Dockerfile+++ b/.cursor/Dockerfile@@ -67,6 +67,12 @@ RUN mkdir -p /etc/docker \&& update-alternatives --set iptables /usr/sbin/iptables-legacy \&& update-alternatives --set ip6tables /usr/sbin/ip6tables-legacy+# /run (and the /var/run symlink target) can land mode 0700 in nested Docker+# VMs. Keep the directory searchable so the docker-group ubuntu user can reach+# docker.sock. start-cursor-cloud.sh also repairs this at runtime after+# `service docker start`, which may recreate a private /var/run.+RUN chmod 755 /run /var/run 2>/dev/null || true+RUN id -u ubuntu >/dev/null 2>&1 || useradd -m -s /bin/bash ubuntu \&& groupadd -f docker \&& usermod -aG docker,sudo ubuntu \diff --git a/scripts/agents/start-cursor-cloud.sh b/scripts/agents/start-cursor-cloud.shindex 6abbe06a9e..a99d51c009 100755--- a/scripts/agents/start-cursor-cloud.sh+++ b/scripts/agents/start-cursor-cloud.sh@@ -36,6 +36,39 @@ compose() {docker compose --env-file /dev/null -f "$compose_file" "$@"}+# Nested Cursor VMs have been observed with /var/run (or /run) mode 0700.+# The ubuntu agent user is in the docker group and docker.sock may already be+# group/world accessible, but a non-executable parent directory still makes+# `docker info` fail with "permission denied" even when dockerd is healthy.+# Open search/execute on the socket parent dirs (and loosen the socket itself+# if needed) before probing the daemon.+ensure_docker_socket_reachable() {+ local sock="${CURSOR_DOCKER_SOCKET:-/var/run/docker.sock}"+ local sock_dir+ sock_dir="$(dirname "$sock")"++ if [ -S "$sock" ] && [ -r "$sock" ] && [ -w "$sock" ]; then+ return 0+ fi++ if ! command -v sudo >/dev/null 2>&1; then+ return 0+ fi++ # Prefer the real runtime dirs; CURSOR_DOCKER_SOCKET is for tests.+ sudo chmod a+rx "$sock_dir" 2>/dev/null || true+ if [ "$sock_dir" = "/var/run" ] || [ "$sock_dir" = "/run" ]; then+ sudo chmod a+rx /var/run /run 2>/dev/null || true+ fi++ if sudo test -S "$sock" 2>/dev/null; then+ if ! { [ -r "$sock" ] && [ -w "$sock" ]; } 2>/dev/null; then+ sudo chgrp docker "$sock" 2>/dev/null || true+ sudo chmod 666 "$sock" 2>/dev/null || true+ fi+ fi+}+dump_diagnostics() {local exit_code=$?trap - ERR@@ -51,11 +84,16 @@ dump_diagnostics() {trap dump_diagnostics ERR+ensure_docker_socket_reachable+if ! docker info >/dev/null 2>&1; thensudo service docker start+ # service start can recreate /var/run with mode 0700 again.+ ensure_docker_socket_reachablefifor _ in $(seq 1 60); do+ ensure_docker_socket_reachableif docker info >/dev/null 2>&1; thenbreakfidiff --git a/scripts/agents/start-cursor-cloud.test.sh b/scripts/agents/start-cursor-cloud.test.shindex 07dc822eed..3c9ba695ff 100755--- a/scripts/agents/start-cursor-cloud.test.sh+++ b/scripts/agents/start-cursor-cloud.test.sh@@ -6,13 +6,14 @@ repo_root="$(cd "$(dirname "${BASH_SOURCE[0]}")/../.." && pwd)"tmpdir="$(mktemp -d)"command_log="$tmpdir/commands.log"docker_ready="$tmpdir/docker-ready"+test_docker_socket="$tmpdir/locked/docker.sock"cleanup() {rm -rf "$tmpdir"}trap cleanup EXIT-mkdir -p "$tmpdir/bin"+mkdir -p "$tmpdir/bin" "$tmpdir/locked"cat <<EOF > "$tmpdir/bin/docker"#!/usr/bin/env bash@@ -43,17 +44,33 @@ cat <<EOF > "$tmpdir/bin/curl"printf 'curl %s\n' "\$*" >> "$command_log"EOF-cat <<'EOF' > "$tmpdir/bin/sudo"+cat <<EOF > "$tmpdir/bin/sudo"#!/usr/bin/env bash-exec "$@"+printf 'sudo %s\n' "\$*" >> "$command_log"+exec "\$@"EOF-chmod +x "$tmpdir/bin/docker" "$tmpdir/bin/service" "$tmpdir/bin/pnpm" "$tmpdir/bin/curl" "$tmpdir/bin/sudo"+cat <<EOF > "$tmpdir/bin/chmod"+#!/usr/bin/env bash+printf 'chmod %s\n' "\$*" >> "$command_log"+exit 0+EOF++chmod +x \+ "$tmpdir/bin/docker" \+ "$tmpdir/bin/service" \+ "$tmpdir/bin/pnpm" \+ "$tmpdir/bin/curl" \+ "$tmpdir/bin/sudo" \+ "$tmpdir/bin/chmod"+# Leave $test_docker_socket missing so ensure_docker_socket_reachable must+# repair the parent directory before the daemon probe loop.PATH="$tmpdir/bin:$PATH" \DATABASE_URL="postgresql://external.example:5432/production" \CLICKHOUSE_URL="https://external.example:8443" \CURSOR_COMPOSE_WAIT_TIMEOUT_SECONDS=321 \+CURSOR_DOCKER_SOCKET="$test_docker_socket" \bash "$repo_root/scripts/agents/start-cursor-cloud.sh"assert_command() {@@ -65,6 +82,7 @@ assert_command() {fi}+assert_command "chmod a+rx $tmpdir/locked"assert_command "service docker start"assert_command "docker compose --env-file /dev/null -f $repo_root/docker-compose.build.yml up -d --build --wait --wait-timeout 321"assert_command "compose DATABASE_URL=<unset>"