Repository navigation
[release] Fix sanity_check_cpp.sh under default token auth - #66658
Conversation
Token authentication is enabled by default for local clusters (#64755), but the C++ API only loads tokens from RAY_AUTH_TOKEN(_PATH) and has no fallback to the default ~/.ray/auth_token file that 'is written by ray start'. The cpp sanity example auto-starts a cluster whose GCS then rejects the tokenless C++ driver with InvalidAuthToken. Pre-generate a token and export RAY_AUTH_TOKEN_PATH so the cluster and the driver agree — the same approach #64755 used for the in-repo cpp bazel tests. This keeps the sanity check exercising the supported authenticated configuration instead of disabling auth. Found on the 2.59.0 release: every wheel-validation job failed in the cpp leg (the only CI anywhere that exercises ray-cpp against a local token-auth cluster from wheels), e.g. https://buildkite.com/ray-project/release-automation/builds/3472 Signed-off-by: elliot-barn <[email protected]>
There was a problem hiding this comment.
Code Review
This pull request updates the C++ sanity check script to generate and configure a temporary authentication token, resolving an issue where the C++ driver fails with InvalidAuthToken on local clusters. The review feedback suggests using python3 instead of python to ensure compatibility and robustness across environments where python might point to Python 2.
| # InvalidAuthToken, which is how the 2.59.0 release sanity run first caught it. | ||
| AUTH_TOKEN_FILE="$(mktemp)" | ||
| trap 'rm -f "${AUTH_TOKEN_FILE}"' EXIT | ||
| python -c "import secrets; print(secrets.token_hex(32), end='')" > "${AUTH_TOKEN_FILE}" |
There was a problem hiding this comment.
Using python can fail on environments where the python command is not available or points to Python 2 (which lacks the secrets module). Since Ray is a Python 3 project, explicitly using python3 is more robust and consistent with the rest of the codebase (e.g., cpp/BUILD.bazel).
| python -c "import secrets; print(secrets.token_hex(32), end='')" > "${AUTH_TOKEN_FILE}" | |
| python3 -c "import secrets; print(secrets.token_hex(32), end='')" > "${AUTH_TOKEN_FILE}" |
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes using default effort and found 1 potential issue.
❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, have a team admin enable autofix in the Cursor dashboard.
Reviewed by Cursor Bugbot for commit 4b736ed. Configure here.
| AUTH_TOKEN_FILE="$(mktemp)" | ||
| trap 'rm -f "${AUTH_TOKEN_FILE}"' EXIT | ||
| python -c "import secrets; print(secrets.token_hex(32), end='')" > "${AUTH_TOKEN_FILE}" | ||
| export RAY_AUTH_TOKEN_PATH="${AUTH_TOKEN_FILE}" |
There was a problem hiding this comment.
C++ driver skips token without auth mode
High Severity
The script exports RAY_AUTH_TOKEN_PATH but not RAY_AUTH_MODE. ray start then turns token auth on because a token file exists, while the C++ driver still treats auth as disabled and sends no token, so GCS rejects the connection with InvalidAuthToken.
Reviewed by Cursor Bugbot for commit 4b736ed. Configure here.
There was a problem hiding this comment.
sai-miduthuri
left a comment
There was a problem hiding this comment.
Seems good. Approving for urgency, but please take a look at the behavior of RAY_AUTH_MODE before merging.
| AUTH_TOKEN_FILE="$(mktemp)" | ||
| trap 'rm -f "${AUTH_TOKEN_FILE}"' EXIT | ||
| python -c "import secrets; print(secrets.token_hex(32), end='')" > "${AUTH_TOKEN_FILE}" | ||
| export RAY_AUTH_TOKEN_PATH="${AUTH_TOKEN_FILE}" |
There was a problem hiding this comment.
…ct#66658) Token authentication is enabled by default for local clusters (ray-project#64755), but the C++ API only loads tokens from `RAY_AUTH_TOKEN` / `RAY_AUTH_TOKEN_PATH` — it has no fallback to the default `~/.ray/auth_token` file that `ray start` writes. The cpp sanity example auto-starts a cluster whose GCS then rejects the tokenless C++ driver with `InvalidAuthToken`. Fix: pre-generate a token and export `RAY_AUTH_TOKEN_PATH` so the auto-started cluster and the C++ driver agree — the same approach ray-project#64755 used for the in-repo cpp bazel tests. This keeps the sanity check exercising the supported authenticated configuration rather than disabling auth. **Context**: found on the 2.59.0 release — all 11 wheel-validation jobs (Linux x86/arm64 py3.10–3.14 + macOS) failed in the cpp leg on [release-automation build 3472](https://buildkite.com/ray-project/release-automation/builds/3472). This script is the only CI anywhere that exercises ray-cpp against a local token-auth cluster from published wheels, and it hadn't run since the auth default landed (master's TestPyPI/validate steps stay blocked on nightlies). Will need a cherry-pick to releases/2.59.0 to re-run the validation there. Separately, proper C++ API token support (default-path fallback) deserves an upstream issue. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Signed-off-by: elliot-barn <[email protected]>


Token authentication is enabled by default for local clusters (#64755), but the C++ API only loads tokens from
RAY_AUTH_TOKEN/RAY_AUTH_TOKEN_PATH— it has no fallback to the default~/.ray/auth_tokenfile thatray startwrites. The cpp sanity example auto-starts a cluster whose GCS then rejects the tokenless C++ driver withInvalidAuthToken.Fix: pre-generate a token and export
RAY_AUTH_TOKEN_PATHso the auto-started cluster and the C++ driver agree — the same approach #64755 used for the in-repo cpp bazel tests. This keeps the sanity check exercising the supported authenticated configuration rather than disabling auth.Context: found on the 2.59.0 release — all 11 wheel-validation jobs (Linux x86/arm64 py3.10–3.14 + macOS) failed in the cpp leg on release-automation build 3472. This script is the only CI anywhere that exercises ray-cpp against a local token-auth cluster from published wheels, and it hadn't run since the auth default landed (master's TestPyPI/validate steps stay blocked on nightlies). Will need a cherry-pick to releases/2.59.0 to re-run the validation there. Separately, proper C++ API token support (default-path fallback) deserves an upstream issue.
🤖 Generated with Claude Code