Skip to content

Support the protobuf worker protocol in order to support RBE - #1887

Open
mauriciogg wants to merge 3 commits into
bazelbuild:mainfrom
mauriciogg:proto-worker-protocol
Open

Support the protobuf worker protocol in order to support RBE#1887
mauriciogg wants to merge 3 commits into
bazelbuild:mainfrom
mauriciogg:proto-worker-protocol

Conversation

@mauriciogg

Copy link
Copy Markdown
Contributor

Support the protobuf worker protocol in order to support RBE

Our RBE environment only supports protobuf as worker protocol so we need this in orde to enable RBE for our iOS builds. requires-worker-protocol is still json so this is a noop unless explcitly overriden in command line

mauriciogg and others added 3 commits August 11, 2026 14:20
The persistent worker only spoke newline-delimited JSON, and the compile
actions declared requires-worker-protocol=json accordingly. That
execution requirement is client-side only: remote persistent worker
runners (e.g. EngFlow) always speak Bazel's original length-delimited
protobuf encoding. Worse, when an action declares the JSON protocol,
Bazel silently omits the persistentWorkerKey platform property from
remote execution requests, so Swift actions can never use remote
persistent workers at all.

Teach the worker the protobuf wire format, auto-detected from the first
byte of the first request: JSON requests begin with '{', protobuf frames
begin with a varint message length. The proto messages are parsed with
generated code checked in alongside a verbatim copy of Bazel's
worker_protocol.proto (regeneration instructions in tools/worker/BUILD),
so building the worker does not require a protoc toolchain. With the
worker bilingual, worker-enabled actions now declare
requires-worker-protocol=proto - Bazel's local workers fully support the
proto protocol for singleplex workers, and remote runners can now route
Swift compiles to persistent workers.
@keith

keith commented Aug 11, 2026

Copy link
Copy Markdown
Member

does this mean your remote exec provider doesn't support this even with bazelbuild/bazel#30641 ? (or --remote_default_exec_properties=persistentWorkerProtocol=json for testing now)

@keith keith left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

IIRC moving to json was primarily to remove the protobuf compile, i think we should gate this behind a starlark bool_flag so there's no penalty to users who aren't using this

Comment thread tools/worker/BUILD
}),
deps = [
"@nlohmann_json//:json",
"@protobuf//:protobuf",

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

I always assumed that if we were building this building protoc was kinda fine, how much do we save by doing it this checked in way?

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants