Repository navigation
[cherry-pick][2.60.0][Fix][Core/Auth] Enable token auth in C++ and Java drivers that start their own local cluster (#66778) - #66801
Merged
sai-miduthuri merged 3 commits intoOct 13, 2026
Conversation
… their own local cluster (#66778) ## Description Since #64755, `ray start --head` enables token auth when `RAY_AUTH_MODE` is unset and `~/.ray/auth_token` exists, for example after any earlier Python `ray.init()`. C++ and Java drivers that start their own head don't make the same decision: their auth mode stays `disabled`, so they connect without a token and fail with `InvalidAuthToken`. The release sanity check hits this. #66467 fixed the same mismatch for Python `ray.init()`. This PR adds `MaybeEnableTokenAuthIfTokenAvailable()` next to the token loader. When `RAY_AUTH_MODE` is unset and a token exists, it sets `RAY_AUTH_MODE=token` in the process environment so that the later `RayConfig` re-initialization keeps it. Both drivers call it, only when they started the head: ```diff ProcessHelper::RayStart (C++) if driver && no address + MaybeEnableTokenAuthIfTokenAvailable() StartRayNode() # ray start --head RayNativeRuntime.start (Java) if driver && no address RunManager.startRayHead() # ray start --head if driver loadLibrary() + if started the head + nativeMaybeEnableTokenAuthIfTokenAvailable() getGcsClient() ``` Drivers given an explicit address are unchanged. `//cpp:metric_example` now runs without `RAY_AUTH_MODE` to cover this path. ## Related issues N/A ## Additional information N/A Signed-off-by: Chi-Sheng Liu <[email protected]> (cherry picked from commit 8bf3d3e) Signed-off-by: sai.miduthuri <[email protected]>
sai-miduthuri
requested review from
a team,
SongGuyang,
kfstorm and
raulchen
as code owners
October 7, 2026 00:25
Contributor
|
Warning You have reached your daily quota limit. Please wait up to 24 hours and I will start processing your requests again! |
sai-miduthuri
added a commit
that referenced
this pull request
Oct 9, 2026
…C facade (#66675) (#66897) Cherry-pick of #66675 (master commit 4f967ab) onto `releases/2.60.0`. ## Why - **The gRPC facade ships without authentication on this branch.** `releases/2.60.0` includes the sandbox gRPC facade (#65839) but not #66675, which makes it require the API token. This pick brings the branch's facade in line with master. - **It fixes the `:ray: core: sandbox tests` job on this branch.** For example, it fails in microcheck build 55893 for #66801. `test_image_utils.py::test_seeding_stays_inside_the_tree` linked the fake image's `/tmp` to an absolute path under pytest's `tmp_path`, which is itself under `/tmp` in CI. #66675 fixes the test, and the product code is unchanged. The branch already has #65815, which made the sandbox tests actually run in CI instead of skipping. ## Cherry-pick details Applied cleanly with `git cherry-pick -x`. The diff is byte-identical to the master commit: the same 10 files, 726 insertions and 29 deletions, with identical hunks, context lines and offsets. No prerequisite commits are missing: - No commit on master between the branch cut and #66675 touched `python/ray/experimental/sandbox/` or `doc/source/ray-core/sandboxes.md`. Neither did any commit on this branch after the cut. - After the pick, the whole `python/ray/experimental/sandbox/` package and `doc/source/ray-core/sandboxes.md` are identical to master at 4f967ab. - Outside the sandbox package, the picked code imports only `ray.util.annotations`, which is identical on both branches. Not a duplicate: no existing PR against `releases/2.60.0` references #66675. ## Testing `test_grpc_facade.py` and `test_modal_client.py` skip in CI because `grpclib` and `modal` aren't in the CI image, so I ran them locally. Environment: Linux, Python 3.10, `grpclib` 0.4.9 and `modal` 1.5.5 (the versions #66675 used). Other test dependencies were pinned from `python/requirements_compiled.txt`. Ray was the CI-built `ray-2.60.0` wheel for this PR's parent commit (b7a4529), with the wheel's `ray/experimental/sandbox/` replaced by this branch's copy. | Command | Code under test | Result | |---|---|---| | `pytest .../http/tests/test_grpc_facade.py .../http/tests/test_modal_client.py` | this PR | 58 passed (52 + 6), 0 skipped | | `pytest .../http/tests` | this PR | 136 passed, 2 skipped (`test_http_integration.py`, `TEST_SANDBOX` unset) | | Same two files, the branch's tests before this pick | `releases/2.60.0` | 24 passed | | This PR's two test files | `releases/2.60.0` (before this pick) | 30 failed, 28 passed: every token/auth test fails, as expected | `test_image_utils.py::test_seeding_stays_inside_the_tree` and the 2 skipped `test_http_integration.py` cases run in CI's `:ray: core: sandbox tests` job, which sets `TEST_SANDBOX=1`. AI assistance was used to prepare this cherry-pick. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Signed-off-by: xyuzh <[email protected]> Signed-off-by: Sai Miduthuri <[email protected]> Co-authored-by: Xinyu Zhang <[email protected]> Co-authored-by: Philipp Moritz <[email protected]>
sai-miduthuri
enabled auto-merge (squash)
October 13, 2026 05:04
rueian
approved these changes
Oct 13, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Cherry-pick of #66778 (master commit 8bf3d3e) onto
releases/2.60.0.releases/2.60.0already has #64755 (token auth enabled by default for local clusters) and #66467, so C++ and Java drivers that start their own head fail withInvalidAuthTokenon this branch too:ray start --headenables token auth whenRAY_AUTH_MODEis unset and~/.ray/auth_tokenexists, but the driver's auth mode staysdisabled. The release sanity check hits this. The fix addsMaybeEnableTokenAuthIfTokenAvailable()next to the token loader and calls it from both drivers only when they started the head.Applied cleanly with
git cherry-pick -x; the diff is identical to the master commit. All 9 touched files, plus the APIs the new code calls (TryLoadToken(ignore_auth_mode),SetEnv), are byte-identical to master at 8bf3d3e after the pick.Not a duplicate: no existing PR against
releases/2.60.0references #66778.Testing: relying on release-branch CI (
//cpp:metric_example, which now runs withoutRAY_AUTH_MODEto cover this path, plus the C++ and Java driver tests); no local tests run.AI assistance was used to prepare this cherry-pick.
🤖 Generated with Claude Code