Skip to content

[release] Fix sanity_check_cpp.sh under default token auth - #66658

Merged
elliot-barn merged 1 commit into
masterfrom
elliot-barn-sanity-cpp-auth-token
Oct 2, 2026
Merged

elliot-barn merged 1 commit into
masterfrom
elliot-barn-sanity-cpp-auth-token

Conversation

@elliot-barn

Copy link
Copy Markdown
Collaborator

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_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 #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

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]>

@gemini-code-assist gemini-code-assist Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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}"

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

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).

Suggested change
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}"

@cursor cursor Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Cursor Bugbot has reviewed your changes using default effort and found 1 potential issue.

Fix All in Cursor

❌ 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}"

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Fix in Cursor Fix in Web

Reviewed by Cursor Bugbot for commit 4b736ed. Configure here.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@ray-gardener ray-gardener Bot added core Issues that should be addressed in Ray Core devprod release-test release test labels Oct 2, 2026

@sai-miduthuri sai-miduthuri left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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}"

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@sai-miduthuri sai-miduthuri added the go add ONLY when ready to merge, run all tests label Oct 2, 2026
@elliot-barn
elliot-barn enabled auto-merge (squash) October 2, 2026 20:47
@elliot-barn
elliot-barn merged commit f8a314b into master Oct 2, 2026
7 checks passed
@elliot-barn
elliot-barn deleted the elliot-barn-sanity-cpp-auth-token branch October 2, 2026 21:08
nadongjun pushed a commit to nadongjun/ray that referenced this pull request Oct 6, 2026
…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]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

core Issues that should be addressed in Ray Core devprod go add ONLY when ready to merge, run all tests release-test release test

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants