Skip to content

[POC][build] Hybrid bzlmod on Bazel 8.8.1 with rules_rust_pyo3 (stacks on #66483) - #66875

Draft
elliot-barn wants to merge 27 commits into
masterfrom
elliot-barn/bazel8-pyo3-poc
Draft

elliot-barn wants to merge 27 commits into
masterfrom
elliot-barn/bazel8-pyo3-poc

Conversation

@elliot-barn

@elliot-barn elliot-barn commented Oct 9, 2026 •

Copy link
Copy Markdown
Collaborator

Why

Turns on bzlmod alongside WORKSPACE (hybrid mode) on Bazel 8.8.1, so Ray can use rules_rust and rules_rust_pyo3. rules_rust_pyo3 has no WORKSPACE support in any release, and rules_rust dropped it in 0.71.0. This is also the first step towards Bazel 9, which removes WORKSPACE.

Stacked on #66483 (Bazel 8.8.1 + protobuf 29.6 / gRPC 1.69.0), and based on its branch, so the diff here is only the bzlmod and PyO3 changes. GitHub retargets it to master once #66483 merges.

Still a proof of concept. rust_probe/ is a stand-in for real Rust code.

What changes

Hybrid mode. .bazelrc sets --enable_bzlmod (WORKSPACE stays on). MODULE.bazel declares rules_rust / rules_rust_pyo3 0.74.0 and the Rust toolchains. Everything else Ray uses still comes from WORKSPACE.

One copy of each shared dependency. rules_cc, rules_python and stardoc pull protobuf, abseil, zlib, rules_python and rules_java into the module graph. In hybrid mode, Bazel 8's autoloads and the default proto toolchains then resolve to those copies, not WORKSPACE's, and you get two incompatible ProtoInfo / PyInfo / JavaInfo providers. MODULE.bazel therefore declares each of them under its WORKSPACE name, so the main repo and WORKSPACE repos (gRPC, ...) resolve to the same single copy:

Module Version Note
protobuf as com_google_protobuf 29.6 archive_override (BCR stops at 29.5)
abseil-cpp as com_google_absl 20240722.2 with Ray's shadow patch
zlib 1.3.2.bcr.2
rules_python 1.6.3 what rules_rust_pyo3 requires
rules_java 8.12.0 single_version_override: bazel_tools asks for 8.14.0, whose java_tools need GLIBCXX_3.4.21 (manylinux2014 lacks it)

rules_python 1.x in WORKSPACE. Drops pip_install_dependencies(). Python runs on the system interpreter through a local runtime toolchain, plus a second python runtime for Windows (no python3.exe). pyo3_extension is now a real deps edge of Ray's py_library / py_test targets.

Fixes the switch needs:

  • Explicit load()s for py_test (bazel/python.bzl) and java_library (bazel/ray.bzl), plus a rules_pkg patch for its unloaded py_binary. Bare native.* names autoload from the module graph.
  • --@rules_python//python/config_settings:precompile=force_disabled (rules_python 1.x precompiles, and ci/ray_ci/automation lists the same sources in several targets). imports = ["."] on five CI tooling tests (PYTHONSAFEPATH on 3.11+).
  • rules_foreign_cc 0.9.0 ninja_tool patch for path-only Python runtimes.
  • The main repo's runfiles directory is _main, not io_ray: release/ray_release/bazel.py, test_exported_symbols_linux.sh ($TEST_WORKSPACE), test_traceback.py.
  • MODULE.bazel / MODULE.bazel.lock added to the wanda build contexts for ray-core, ray-cpp-core and ray-java.

Tests run

Locally on linux x86_64, Bazel 8.8.1:

Command Result
bazel build --nobuild //:ray_pkg_zip //:ray_py_proto_zip //java:gen_ray_java_pkg //cpp:ray_cpp_pkg_zip //rust_probe/... analysis passes
bazel test //rust_probe/... //ci/ray_ci:test_tester //ci/ray_ci:test_bazel_sharding 5/5 pass, including ray_probe_ext_deps_test (PyO3 extension as a deps edge)
bazel build --nobuild -k //... same results as #66483 (only its two known issues)

Before this restack, the same changes on top of an older #66483 reached CI parity with it (premerge 75359: 710 passed, every remaining failure belonging to the gRPC bump that #66483 has since fixed). The previous restack ran premerge 76319 with every gate unblocked: 732 jobs passed. Its one failure, test_token_auth_integration on Windows, was a test bug that master fixed in #67804, which this rebase picks up. Premerge on the current restack: in progress.

🤖 Generated with Claude Code

@elliot-barn elliot-barn added the go add ONLY when ready to merge, run all tests label Oct 16, 2026
@elliot-barn
elliot-barn force-pushed the elliot-barn/bazel8-pyo3-poc branch from c4aed33 to 93f815f Compare October 21, 2026 20:45
@elliot-barn
elliot-barn force-pushed the elliot-barn/bazel8-pyo3-poc branch from d5c6192 to 833077b Compare November 5, 2026 23:58
@elliot-barn elliot-barn changed the title [POC][build] Bazel 8.8.1 with rules_rust_pyo3 (stacks on #66870) [POC][build] Hybrid bzlmod on Bazel 8.8.1 with rules_rust_pyo3 (stacks on #66483) Nov 5, 2026
@elliot-barn
elliot-barn changed the base branch from master to elliot-barn/bazel-protobuf-29 November 5, 2026 23:59
@elliot-barn
elliot-barn force-pushed the elliot-barn/bazel-protobuf-29 branch from 8444a22 to cef9fdd Compare November 8, 2026 21:03
@elliot-barn
elliot-barn force-pushed the elliot-barn/bazel8-pyo3-poc branch 2 times, most recently from efbe428 to f070f83 Compare November 12, 2026 21:13
elliot-barn and others added 11 commits November 12, 2026 22:43
rules_java 8.x (needed for Bazel 8) loads @com_google_protobuf//bazel:*.bzl,
which does not exist in the v23.4-era protobuf Ray pinned, so the two move
together. gRPC < 1.69 builds a standalone @upb that does not compile against
protobuf 29, so gRPC (and abseil, boringssl to match it) moves too.

- Declare bazel_skylib 1.7.1, rules_cc 0.0.16 and rules_java 8.14.0 at the
  top of WORKSPACE. The first declaration of a repo wins, and rules_python's
  py_repositories() otherwise pulls skylib 1.3.0 and rules_cc 0.0.13.
- Run rules_java_dependencies() after ray_deps_setup(), so its maybe() does
  not replace Ray's protobuf with 29.0-rc2.
- Pin rules_pkg 0.9.1: the v3.20.3 protobuf used by rules_proto_grpc loads
  the root @rules_pkg//:providers.bzl stub, which rules_pkg 0.10.0 removed.
- Arena::CreateMessage -> Arena::Create, always_print_primitive_fields ->
  always_print_fields_with_no_presence (same output for Ray's protos).
- Load cc_proto_library from protobuf; use gRPC's health_cc_grpc target.
- Drop protobuf-bazel7.patch, grpc-disable-layering-check.patch and grpc's
  protobuf.patch; port the thread-count, NextResult and zlib-fdopen patches.

Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
Signed-off-by: elliot-barn <[email protected]>
- rules_java 8.14.0 -> 8.12.0: from 8.13.0 on, the prebuilt java_tools need
  GLIBCXX_3.4.21, newer than manylinux2014's libstdc++ (jar build).
- Keep boringssl at 2ff4b968: later commits require C11 <stdalign.h> on
  MSVC, which the Windows CI SDK (10.0.19041) lacks (Windows build).
- Restore grpc-disable-layering-check.patch, ported to 1.69: gRPC's own
  BUILD files miss deps that clang enforces on macOS (macOS build).
- Define PROTOBUF_FUTURE_REMOVE_CREATEMESSAGE: GCC 10 warns on the
  deprecated shim's own body in every file including arena.h, and -Werror
  makes that fatal (all manylinux wheel / cpp / java images).

Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
Signed-off-by: elliot-barn <[email protected]>
rules_java 7.x compiled Java at source/target 8 by default; 8.x defaults
to 11. Ray's jars came out as class file version 55, which a Java 8
runtime rejects (UnsupportedClassVersionError in test_raydp and
test_logging_java). Pin --java_language_version=8.

Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
Signed-off-by: elliot-barn <[email protected]>
…240722.2

- Keep gRPC's EventEngine client and listener off on Windows. gRPC 1.69
  enables them there (1.58 marked them broken), and they abort at
  teardown: win_socket.cc "Check failed: is_shutdown_" (test_implicit_resource,
  test_object_spilling_2_asan). Posix keeps 1.69's defaults.
- abseil 20240722.0 -> 20240722.2: patch 1 fixed a security issue in hash
  container create/resize.
- UBSan: GCC rejects abseil's hash containers under the null,
  nonnull-attribute and returns-nonnull-attribute checks (a function-pointer
  comparison in a constexpr stops being a constant expression). Turn those
  three off; they must follow -fsanitize=undefined in the same flag list.

Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
Signed-off-by: elliot-barn <[email protected]>
The Windows patch moved gRPC's client and listener back to iomgr but left
event_engine_callback_cq on. On Windows grpc_iomgr_run_in_background()
returns IsEventEngineCallbackCqEnabled(), so gRPC assumed I/O makes progress
in the background and gave callback-API code no polling thread, while the
iomgr sockets need one. pubsub_integration_test, which only uses the
callback API, could never connect ('tcp handshaker shutdown' after 20s).
Raylet/GCS only worked because their CompletionQueue threads poll the same
iomgr. Turn the callback CQ off too so callback-API code uses
CallbackAlternativeCQ, which polls iomgr, as 1.58 did.

Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
Signed-off-by: elliot-barn <[email protected]>
GCC 11 reports a false -Wmaybe-uninitialized in protobuf 29's generated
move-assignment (CanMoveWithInternalSwap) when it is inlined into
core_worker.cc under the ubsan config, and -Werror turns it into a build
failure for core_worker_lib. Keep the warning but don't make it fatal
under ubsan.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Signed-off-by: elliot-barn <[email protected]>
Bazel's own Linux releases need glibc >= 2.25 since Bazel 8, so they cannot
start in manylinux2014 (CentOS 7, glibc 2.17), where Ray builds its Linux
wheels. Add a bazel-glibc217 wanda image that builds the .bazelversion
release from source inside that image (bootstrap with compile.sh, then
//src:bazel with an embedded JDK) and smoke-tests a server start there.
The core, cpp-core and java image builds and the manylinux CI image copy
it in and point bazelisk at it. Wheels keep targeting glibc 2.17.

Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
Signed-off-by: elliot-barn <[email protected]>
On x86_64 the second-stage //src:bazel build runs rules_java's prebuilt
ijar, which needs GLIBCXX_3.4.21 and fails on CentOS 7. Ship compile.sh's
bazel_nojdk with the Temurin JDK 21 it was built with, passed via
--server_javabase. Embed the release label so 'bazel info release' (and
anything keyed on the version) reports , not no_version, which is
what failed the aarch64 smoke test.

Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
Signed-off-by: elliot-barn <[email protected]>
Each test built a fresh mock workspace and HOME, so every bazel query
started a new Bazel server, and on Bazel 8 fetched rules_python from the
registry to autoload the mock BUILD's py_test. Six of those took the small
test past its 60s timeout (69s locally). Nothing writes to the workspace,
so make the fixture module-scoped: 21.5s locally.

Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
Signed-off-by: elliot-barn <[email protected]>
Move from Bazel 7.5.0 to 8.8.1, still in WORKSPACE mode (bzlmod stays off,
so every repo still comes from WORKSPACE and there is one copy of
protobuf, rules_java and rules_python).

- .bazelversion 7.5.0 -> 8.8.1.
- --noincompatible_disallow_empty_glob: the root BUILD.bazel globs
  platform-specific paths that are empty on other platforms.
- --noincompatible_disallow_ctx_resolve_tools: the 2021
  rules_proto_grpc pin still calls ctx.resolve_tools.
- Pin rules_proto 7.1.0 ahead of grpc_deps(): 6.0.2 reads native
  proto_common.ProtoLangToolchainInfo, which Bazel 8 removed.

Official Bazel 8 binaries need glibc >= 2.25 and can't start in the
manylinux2014 images, so the previous commits build Bazel for glibc 2.17
in CI.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Signed-off-by: elliot-barn <[email protected]>
Bazel 8 autoloads sh_binary/sh_test from rules_shell, and on Windows they
need a registered shell toolchain to build their launcher. Bzlmod registers
it automatically; in WORKSPACE mode nothing did, so every Windows job failed
analysis on @bazel_tools//tools/test:collect_coverage ("No suitable shell
toolchain found"). Declare rules_shell 0.2.0 (protobuf 29's pin) early and
call rules_shell_toolchains().

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Signed-off-by: elliot-barn <[email protected]>
@elliot-barn
elliot-barn force-pushed the elliot-barn/bazel-protobuf-29 branch from c867d2a to 59c6539 Compare November 12, 2026 22:44
@elliot-barn
elliot-barn force-pushed the elliot-barn/bazel8-pyo3-poc branch from f070f83 to cc27fb4 Compare November 12, 2026 22:45
elliot-barn and others added 6 commits November 12, 2026 23:02
The *_pb2_grpc.py stubs come from the Python plugin of the gRPC that Ray
builds. From 1.63 on, that plugin emits `_registered_method=True` on client
stubs and `server.add_registered_method_handlers()`, which only exist in
grpcio >= 1.64. With gRPC 1.69 the stubs failed on grpcio 1.62 (client and
server) and 1.63 (server), while setup.py allows grpcio >= 1.42.0. CI pins
grpcio 1.75, so it never showed.

Patch the plugin to leave both out, so the stubs match what the 1.58 plugin
generated. This gives up grpcio's registered-method fast path, which Ray's
stubs did not use before either.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Signed-off-by: elliot-barn <[email protected]>
…lmod mode

Not for merge. Proof of concept on top of #66483 and #66305, still on
Bazel 7.5.0.

- Turn on bzlmod alongside WORKSPACE (--enable_bzlmod --enable_workspace).
- MODULE.bazel declares only rules_rust and rules_rust_pyo3 (0.74.0), so
  none of Ray's WORKSPACE repos change: com_google_protobuf stays 29.6 and
  the module graph's protobuf/rules_python live in separate canonical repos.
- rust_probe/: a rust_library + rust_test, and a pyo3_extension consumed by
  a py_test as a data file. It cannot go in deps: the module world's
  rules_python PyInfo is a different provider than WORKSPACE's.

Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
Signed-off-by: elliot-barn <[email protected]>
ci/lint check_bazel_team_owner requires a team:* tag on every py_test/cc_test
target; the probe tests had none.

Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
Signed-off-by: elliot-barn <[email protected]>
…eps edge

Not for merge. Declare rules_python 1.6.3 (the version rules_rust_pyo3
already requires) in MODULE.bazel under its WORKSPACE name, so Ray's py_*
rules, Bazel 8's autoloads and pyo3_extension share one PyInfo.

Ray's WORKSPACE Python setup moves to the rules_python 1.x API:
- drop pip_install_dependencies(); py_repositories() covers it in >= 1.0.
- the hermetic interpreter is @python3_10_host//:python (defs.bzl no longer
  exports `interpreter`), in WORKSPACE's pip_parse and bazel/BUILD.bazel.
- py_runtime_pair no longer takes py2_runtime.

rust_probe/pyo3 gains ray_probe_ext_deps_test, which imports the extension
through deps with a plain `from rust_probe.pyo3 import ray_probe_ext`.

On Bazel 8.8.1, linux x86_64: full //:ray_pkg_zip //:ray_py_proto_zip build
passes; //rust_probe/... (4 tests) and //ci/ray_ci:test_tester pass.

Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
Signed-off-by: elliot-barn <[email protected]>
Two rules_python 1.x behaviour changes broke the ci+release tooling job:

- py_test/py_binary run with PYTHONSAFEPATH on Python >= 3.11, so a test's
  own directory is no longer on sys.path. Five tests import a sibling module
  by bare name (ci/build build_image/build_wheel/container_resource_utils
  tests, ci/pipeline test_doc_api_rules_sync, ci/ray_ci test_bazel_sharding);
  give them imports = ["."]. Local runs use the hermetic Python 3.10, which
  has no safe-path mode, so this only shows on 3.11 CI images.
- Build-time .pyc compilation: ci/ray_ci/automation lists the same sources in
  a py_library and several py_binary targets, which then produce conflicting
  __pycache__ outputs. Force precompile off, as rules_python 0.40 behaved.

Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
Signed-off-by: elliot-barn <[email protected]>
… toolchain

rules_python >= 1.0 as a module registers hermetic interpreters
(@pythons_hub) for every platform, so py_test targets stopped running on the
Python found on PATH, where CI images install pytest and Ray's deps:
test_basic failed on macOS with "No module named 'pytest'".

Register a local_runtime_repo built from python3 on PATH, in WORKSPACE so it
takes priority over the module's hermetic toolchains. Unlike the bare
runtime_env toolchain, it records the interpreter version and exposes its
headers and libpython, which rules_rust_pyo3 needs to build extensions
(runtime_env left PYO3_CROSS_PYTHON_VERSION=None.None). on_failure = "warn"
falls back to the hermetic toolchain where no usable system Python exists.

Locally: test_basic resolves to @local_python3 (system 3.11);
//rust_probe/... (both pyo3 tests), test_tester, build_image_test and
test_doc_api_rules_sync pass.

Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
Signed-off-by: elliot-barn <[email protected]>
elliot-barn and others added 10 commits November 12, 2026 23:03
Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
Signed-off-by: elliot-barn <[email protected]>
Bzlmod is enabled, so the core/cpp/java image builds need the root module
file; without it @rules_python resolves to the WORKSPACE 0.40.0 copy.

Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
Signed-off-by: elliot-barn <[email protected]>
Windows has no python3.exe, so the python3 local runtime is marked
incompatible there and Bazel fell back to the hermetic interpreter, which
lacks CI deps like click. Register a second local runtime on 'python'.

Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
Signed-off-by: elliot-barn <[email protected]>
The WORKSPACE local python runtime sets interpreter_path, so py3_runtime
has no interpreter/files and ninja_tool analysis fails (aarch64 core build).
Fall back to interpreter_path in that case.

Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
Signed-off-by: elliot-barn <[email protected]>
Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
Signed-off-by: elliot-barn <[email protected]>
On Windows os.path.join produced 'io_ray\ci\...', so the runfiles
library could not split off the repo name and never applied the bzlmod
io_ray -> _main mapping; every Windows ray_ci entry point failed to find
oss_config.yaml.

Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
Signed-off-by: elliot-barn <[email protected]>
Joining with '/' turned absolute inputs into 'io_ray//tmp/...', which
Rlocation rejects; keep os.path.join and only normalize separators.

Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
Signed-off-by: elliot-barn <[email protected]>
Under bzlmod the main repo's runfiles directory and Windows module prefix
are _main. Use TEST_WORKSPACE in the exported-symbols test and scrub
either prefix in test_traceback.

Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
Signed-off-by: elliot-barn <[email protected]>
Not for merge. Replaces the autoload narrowing from the WIP commit with a
single protobuf, abseil and zlib for both dependency systems:

- MODULE.bazel declares protobuf (archive_override to v29.6, as WORKSPACE
  pinned), abseil-cpp 20240722.2 (with Ray's shadow patch) and zlib under
  their WORKSPACE names. The main repo and WORKSPACE repos resolve
  @com_google_protobuf / @com_google_absl / @zlib through the root module,
  so Bazel 8's proto autoloads and the default proto toolchains use the
  same protobuf as Ray and grpc instead of a second copy.
- Load py_test and java_library explicitly in bazel/python.bzl and
  bazel/ray.bzl. Bare native.* names autoload from the module graph's
  rules_python/rules_java, whose providers don't match WORKSPACE's.
- Patch rules_pkg's zip/BUILD, which uses py_binary without loading it.
- --noincompatible_disallow_ctx_resolve_tools for the 2021 rules_proto_grpc.

On Bazel 8.8.1: analysis of //:ray_pkg_zip, //:ray_py_proto_zip and
//rust_probe/... passes; //rust_probe/... and //ci/ray_ci:test_tester pass.

Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
Signed-off-by: elliot-barn <[email protected]>
(cherry picked from commit c7a3586)
Signed-off-by: elliot-barn <[email protected]>
Bazel 8 loads Java rules from the module graph's rules_java (8.14.0, asked
for by bazel_tools), while WORKSPACE's rules_jvm_external builds @maven's
JavaInfo from WORKSPACE's rules_java 8.12.0, so //java:io_ray_ray_api
rejected the @maven jars. Declare rules_java in MODULE.bazel under its
WORKSPACE name, pinned to 8.12.0: 8.13+ java_tools need GLIBCXX_3.4.21,
which manylinux2014 lacks.

Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
Signed-off-by: elliot-barn <[email protected]>
@elliot-barn
elliot-barn force-pushed the elliot-barn/bazel8-pyo3-poc branch from cc27fb4 to 57931b7 Compare November 12, 2026 23:03
Base automatically changed from elliot-barn/bazel-protobuf-29 to master November 13, 2026 09:36
elliot-barn added a commit that referenced this pull request Nov 13, 2026
… gRPC to 1.69.0 (#66483)

## Why

This PR moves Ray to **Bazel 8.8.1**, still in WORKSPACE mode, together
with the dependency bumps that Bazel 8 forces. It is the Bazel 8 step of
the Bazel 7.5 → 8 → 9 migration. The earlier steps (#66160, #66207,
#66305) got the tree as far as letting Bazel 8 start.

Bazel 8 needs `rules_java` 8.x. Every `rules_java` 8.x release loads
`@com_google_protobuf//bazel:java_proto_library.bzl`, and that file does
not exist in the v23.4-era protobuf commit Ray pins. So `rules_java` and
protobuf have to move together, and protobuf ≥ 29 then pulls gRPC and
abseil along.

## Split for review

The parts that work on master on their own are split out into separate
PRs. **Please review those first.** Once they merge, this PR is rebased
and those commits drop out of the diff.

| PR | What |
|---|---|
| #67717 | Deflake four timing-sensitive tests that the gRPC bump made
fail more often |
| #67718 | A gRPC client with calls in flight is never idle (actor task
ordering fix, see below) |
| #67719 | Keep gRPC's absl logging at ERROR unless `GRPC_VERBOSITY` is
set (see below) |
| #67720 | `Arena::CreateMessage` → `Arena::Create`, and pin Java 8
bytecode ahead of `rules_java` 8 |
| #67721 | `bazel_skylib` 1.7.1 and `rules_pkg` 0.9.1 |

What stays here: the Bazel version, the protobuf / `rules_java` / gRPC /
abseil / `rules_cc` bumps, the code and patch changes they need, the
glibc 2.17 Bazel build for CI, and the Windows / sanitizer / test fixes
for gRPC 1.69.

## Versions

| Repo | Before | After | Why it moves |
|---|---|---|---|
| Bazel | 7.5.0 | **8.8.1** | The goal. See "Bazel 8" below |
| `com_google_protobuf` | `2c5fa078` (~v23.4) | **v29.6** | `rules_java`
8.x loads from its `bazel/` package |
| `rules_java` | 7.12.4 | **8.12.0** | Needed for Bazel 8. 8.12.0 is the
ceiling: from 8.13.0 on, the prebuilt `java_tools` (`singlejar`, `ijar`,
`one_version`) need `GLIBCXX_3.4.21`, newer than manylinux2014's
libstdc++. 8.x also changed the default Java language level from 8 to
11, so `.bazelrc` pins `--java_language_version=8` (#67720). |
| `com_github_grpc_grpc` | 1.58.0 | **1.69.0** | gRPC < 1.69 builds a
standalone `@upb` that fails to compile against protobuf 29's
`descriptor.proto` (`FileDescriptorProto.edition` is now an enum).
1.69.0 is the first gRPC whose `grpc_deps.bzl` pins protobuf 29. |
| `com_google_absl` | 20230802.1 | **20240722.2** | Matches gRPC 1.69.0.
Patch release 2 fixes a security issue in hash container create/resize.
|
| `rules_proto` | 6.0.2 (from `grpc_deps()`) | **7.1.0** | 6.0.2 reads
native `proto_common.ProtoLangToolchainInfo`, which Bazel 8 removed |
| `rules_cc` | 0.0.13 (transitive) | **0.0.16** | What protobuf 29
declares |
| `bazel_skylib` | 1.6.1 (in name only) | **1.7.1** | Protobuf 29 calls
`paths.is_normalized()` (#67721) |
| `rules_pkg` | 0.7.0 (transitive) | **0.9.1** | Ceiling, see below
(#67721) |
| `boringssl` | `2ff4b968` | `2ff4b968` (unchanged) | Deliberately older
than gRPC 1.69.0's `b8b3e6e1`. Every later boringssl requires C11
`<stdalign.h>` on MSVC, which the Windows CI SDK (10.0.19041) doesn't
ship. |

## Bazel 8

- `.bazelversion` 7.5.0 → 8.8.1. Bzlmod stays off (`--noenable_bzlmod
--enable_workspace`), so every external repo still comes from WORKSPACE
and there is exactly one copy of protobuf, `rules_java` and
`rules_python`.
- `--noincompatible_disallow_empty_glob`: the root `BUILD.bazel` globs
platform-specific paths that are empty on other platforms.
- `--noincompatible_disallow_ctx_resolve_tools`: the 2021
`rules_proto_grpc` pin still calls `ctx.resolve_tools`.
- **glibc 2.17.** Official Bazel 8 binaries need glibc ≥ 2.25 and can't
start inside the manylinux2014 (CentOS 7) images that build Ray's Linux
wheels. A new wanda image, `ci/docker/bazel-glibc217`, builds
`bazel_nojdk` from the release's dist zip inside
`rayproject/manylinux2014` (devtoolset-10) and ships it with Temurin JDK
21. The ray-core, ray-cpp-core, ray-java and manylinux images put it
behind `bazelisk`. Rebuilding Bazel only happens when `.bazelversion`
changes. Wheels still target manylinux2014, so the user glibc floor is
unchanged.
- `ci/ray_ci/test_bazel_sharding.py` shares one mock workspace across
its tests. Each test used to start a new Bazel server, which on Bazel 8
also re-fetches `rules_python` for autoloads and pushed it past its 60s
timeout.

## Declaration order: the first declaration of a repo wins

Several bumps only take effect because of where they are declared. In
WORKSPACE, a repo keeps its first declaration: a `maybe()` skips a repo
that already exists, and a later plain `http_archive` is ignored.

- **`bazel_skylib` / `rules_cc` are declared at the top of
`WORKSPACE`.** `py_repositories()` (rules_python 0.40.0) declares skylib
**1.3.0** and rules_cc 0.0.13 before `ray_deps_setup()` runs, so the
skylib pin in `ray_deps_setup.bzl` has had no effect since #66207.
- **`rules_java_dependencies()` runs after `ray_deps_setup()`.** It
declares its own `com_google_protobuf` (**29.0-rc2**) through `maybe()`.
If it ran first, it would silently replace Ray's pin.
- **`rules_pkg` is pinned to 0.9.1** before `protobuf_deps()` runs,
which would otherwise declare 1.0.1. The v3.20.3 protobuf that
`rules_proto_grpc` uses loads the root `@rules_pkg//:providers.bzl`
stub, which was deleted in 0.10.0.
- **`rules_proto` 7.1.0 is declared before `grpc_deps()`** for the same
reason.

The versions that actually resolved were verified by reading each
fetched repo's `MODULE.bazel` / `version.json`. `bazel query` does not
catch these swaps.

## Code changes needed by the new versions

- `.bazelrc` defines `PROTOBUF_FUTURE_REMOVE_CREATEMESSAGE`, which
compiles out protobuf's deprecated `Arena::CreateMessage` shim. GCC 10
(the manylinux2014 devtoolset) warns on the shim's own body in every
file that includes `arena.h`, and `-Werror` makes that fatal.
- `JsonPrintOptions::always_print_primitive_fields` →
`always_print_fields_with_no_presence` (`event.cc`, one test). **The
export-event JSON does not change**: unset proto3 `optional` fields were
omitted before and still are.
- `cc_proto_library` loads from
`@com_google_protobuf//bazel:cc_proto_library.bzl` rather than
`@rules_cc` (3 BUILD files).
- gRPC's health service C++ target is `health_cc_grpc` in 1.69 (2 BUILD
files).
- UBSan: GCC rejects abseil's hash containers under the `null`,
`nonnull-attribute` and `returns-nonnull-attribute` checks, so those
three are off. GCC 11 also reports a false `-Wmaybe-uninitialized` in
protobuf 29's generated move-assignment under ubsan; it is no longer
fatal there.

## gRPC 1.69 behaviour changes

**Actor task ordering (real runtime bug, #67718).** gRPC 1.69 leaves a
channel `IDLE` for a moment after its first call starts.
`CoreWorkerClientPool` evicts idle clients, so the client that sent an
actor's first task could be evicted before the second task, which then
went out on a new client with fresh sequence state. The actor ran the
second task first and cancelled the first as stale (`Task canceled due
to stale sequence number`). Fix: `GrpcClient` counts calls in flight and
is only idle when none are. Local repro: 11/20 out of order before, 0/30
after.

**gRPC INFO logs reach the driver (#67719).** gRPC ≥ 1.65 logs through
absl and leaves absl's INFO default alone when `GRPC_VERBOSITY` is
unset, so lines such as `chttp2_transport.cc ... Got goaway` were
forwarded to drivers as `(raylet) ...`. Ray now sets absl's minimum
level to ERROR unless `GRPC_VERBOSITY` is set.

**Windows EventEngine.** gRPC 1.69 turns on the EventEngine client and
listener on Windows (1.58 marked them broken), and they abort at
teardown (`win_socket.cc` "Check failed: is_shutdown_"). They stay off
on Windows, and so does the EventEngine callback CQ: without it,
callback-API code got no polling thread and `pubsub_integration_test`
could never connect. Posix keeps 1.69's defaults.

**Test timing.** gRPC 1.69 makes some existing races easy to hit.
`test_broadcast` (LLM) and the Serve replica-death test now let the
dying replica's "accepted" message go out before it exits. The rest are
in #67717.

## Patches

| Patch | Action |
|---|---|
| `protobuf-bazel7.patch` | **Deleted.** v29.6 has no `exec_tools` left.
|
| gRPC's `third_party/protobuf.patch` | **No longer applied.** It only
touches protobuf's Python package, which Ray doesn't build from Bazel. |
| `grpc-disable-layering-check.patch` | Ported (`gsm` → `csm`; fuzzers
package gone). Without it macOS fails on gRPC's own missing deps. |
| `grpc-configurable-thread-count.patch` | Ported: `cpu.cc` moved to
`src/core/util/linux/`. Behaviour unchanged. |
| `grpc-nextresult-cancelled-init.patch` | Ported. |
| `grpc-python-plugin-no-registered-method.patch` | **New.** gRPC's
Python plugin (from 1.63) emits `_registered_method=True` and
`server.add_registered_method_handlers()`, which need grpcio >= 1.64.
The patch leaves both out, so the `*_pb2_grpc.py` stubs match what the
1.58 plugin generated and keep working with the `grpcio >= 1.42.0` that
`setup.py` allows. Checked on grpcio 1.42.0, 1.62.3, 1.64.3 and 1.75.0;
without the patch the stubs fail on 1.62 and 1.63. |
| `grpc-zlib-fdopen.patch` | Regenerated. The old hunk applied with fuzz
to the wrong `http_archive`. |
| `grpc-cython-copts.patch`, `abseil-cpp-shadow.patch` | Unchanged. |

## What stays the same

- **Runtime protobuf floor for users.** The Python and Java bindings are
still generated by `com_google_protobuf_rules_proto_grpc` (v3.20.3).
- **grpcio floor for users.** Still `grpcio >= 1.42.0`. See
`grpc-python-plugin-no-registered-method.patch` above; CI pins grpcio
1.75, so only a test with an old grpcio shows this.
- **Wheel glibc floor.** Still manylinux2014.
- **WORKSPACE.** Bzlmod is a later step (required by Bazel 9).

## Please review closely

- **gRPC 1.58 → 1.69 is 11 minor versions of core runtime.** Watch
#65984 / #65982 (gRPC fork handling) and #64898 (worker gRPC thread
count). Release perf benchmarks on 1.69 are in the comments: all 13 core
perf tests passed, with no regressions beyond what master nightly
already shows.
- macOS and Windows are verified by CI only.
- `bazel build //...` on Bazel 8 reports conflicting actions for
`//cpp:plus.so` / `//cpp:counter.so` (built in two test configurations).
The targets CI builds are not affected. `//release:requirements_*`
already fails to analyze on master's Bazel 7.5.

## Tests run

| Command | Result |
|---|---|
| Bazel 8.8.1: `bazel build --nobuild //:ray_pkg_zip //:ray_py_proto_zip
//java:gen_ray_java_pkg //cpp:ray_cpp_pkg_zip` | analysis passes |
| Bazel 8.8.1: `bazel build //:ray_py_proto_zip
//src/ray/gcs_rpc_client/tests:gcs_client_test` | build completed
successfully (8,426 actions from cold) |
| Bazel 8.8.1: `bazel build --nobuild -k //...` | passes apart from the
two known issues above |
| Premerge on Bazel 7.5 with every gate unblocked (sanitizers, aarch64,
Windows, macOS) | green: build 75992 |
| Release perf benchmarks (13 core tests) | passed: release build 113271
|
| Premerge on Bazel 8.8.1 with every gate unblocked (sanitizers,
aarch64, Windows, macOS) | green: build 76206 (733 jobs passed, no
retries) |

The Bazel 8 parts were first run in full CI on the PyO3 POC (#66875):
all 14 native images built on Bazel 8 inside CentOS 7, and the remaining
failures were the gRPC ones fixed here.

AI assistance was used for the analysis and for drafting this change.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

---------

Signed-off-by: elliot-barn <[email protected]>
Co-authored-by: Claude Opus 5.5 (1M context) <[email protected]>
@github-actions

Copy link
Copy Markdown

This pull request has been automatically marked as stale because it has not had
any activity for 14 days. It will be closed in another 14 days if no further activity occurs.
Thank you for your contributions.

You can always ask for help on our discussion forum or Ray's public slack channel.

If you'd like to keep this open, just leave any comment, and the stale label will be removed.

@github-actions github-actions Bot added the stale The issue is stale. It will be closed within 7 days unless there are further conversation label Nov 27, 2026

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

go add ONLY when ready to merge, run all tests stale The issue is stale. It will be closed within 7 days unless there are further conversation

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant