Expose all gRPC transport-layer options for worker connections — Closes #41#124
Merged
conradbzura merged 3 commits intowool-labs:mainfrom Mar 26, 2026
Merged
Conversation
conradbzura
added a commit
to conradbzura/wool
that referenced
this pull request
Mar 26, 2026
Remove options from WorkerFactory protocol and default factory to match the pool's actual calling convention — users bake options into their factory via partial() or a lambda. Add field comments to ChannelConfig proto and renumber connection to field 8. Switch new keepalive tests to mocker.patch.object style per test guide.
a55b736 to
a20c003
Compare
conradbzura
commented
Mar 26, 2026
conradbzura
commented
Mar 26, 2026
conradbzura
commented
Mar 26, 2026
conradbzura
commented
Mar 26, 2026
a20c003 to
ea0afc4
Compare
conradbzura
commented
Mar 26, 2026
ea0afc4 to
00e73e4
Compare
8746fad to
0e131d4
Compare
conradbzura
commented
Mar 26, 2026
conradbzura
commented
Mar 26, 2026
Workers now advertise their gRPC channel configuration (keepalive intervals, message sizes) via a new ChannelConfig protobuf message embedded in WorkerMetadata. Clients read the advertised settings when connecting, removing the need to pass options through WorkerProxy and WorkerPool — options are baked into the worker factory instead. BREAKING CHANGE: WorkerProxy, WorkerPool, and WorkerFactory no longer accept an options parameter.
Cover keepalive option validation, ChannelConfig round-tripping through protobuf, keepalive channel options in WorkerConnection, server-side keepalive options in WorkerProcess, and the updated WorkerProxy and WorkerPool signatures. Integration conftest gains a KEEPALIVE options variant and uses partial() to bake options into the worker factory.
0e131d4 to
107fa00
Compare
Workers now advertise their gRPC transport configuration via ChannelOptions in WorkerMetadata. Clients read these settings from discovery events and configure their channels to match automatically — no separate client-side configuration needed.
f9f7ca4 to
92f1394
Compare
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.
Summary
Expose all gRPC HTTP/2 transport-layer options and adopt a self-describing worker model where workers advertise their connection configuration via
WorkerMetadataso clients connect with compatible settings automatically. Introduce a two-tier options model:ChannelOptionsholds advertised settings (message sizes, keepalive, concurrency, compression) serialized in aChannelOptionsprotobuf message, whileWorkerOptionscomposesChannelOptionswith server-only settings (ping enforcement, connection lifecycle). Remove theoptionsandlimitparameters fromWorkerProxy,WorkerPool, andWorkerConnection— clients derive all connection settings from discovered worker metadata.Closes #41
Proposed changes
New ChannelOptions protobuf message
Add a
ChannelOptionsmessage towire.protowith fields for message sizes, keepalive, max pings without data, max concurrent streams, and compression algorithm. Embed it as an optionalconnectionfield onWorkerMetadataso workers advertise their channel configuration over the wire.Split WorkerOptions into ChannelOptions + WorkerOptions
Replace the flat
WorkerOptionsdataclass with two frozen dataclasses inworker/base.py:ChannelOptions— advertised settings: message sizes, keepalive (time, timeout, permit-without-calls), max pings without data, max concurrent streams, and compression (grpc.Compressionenum). Default to gRPC's own defaults.WorkerOptions— composes aChannelOptionsinstance with server-only settings:http2_min_recv_ping_interval_without_data_ms,max_ping_strikes, and optional lifecycle options (max_connection_idle_ms,max_connection_age_ms,max_connection_age_grace_ms). Validate thatkeepalive_time_ms >= http2_min_recv_ping_interval_without_data_msin__post_init__.Move WorkerMetadata to worker/metadata.py
Move
WorkerMetadatafromdiscovery/base.pyinto a dedicatedworker/metadata.pymodule.WorkerMetadatais worker configuration — it belongs in the worker subpackage, not discovery. The discovery module imports it from the new location.Make WorkerMetadata.options non-optional
Change
WorkerMetadata.optionsfromChannelOptions | NonetoChannelOptionswith a default ofChannelOptions(). Workers always advertise their transport configuration;to_protobuf()always serializes the connection field;from_protobuf()returns defaultChannelOptions()for legacy protobufs without a connection field.Self-describing workers via WorkerMetadata
Workers serialize their
ChannelOptionsinto the protobufChannelOptionssub-message; clients reconstruct it on deserialization. The proxy's_worker_sentinelreadsevent.metadata.optionsdirectly from discovery events when creatingWorkerConnectioninstances, making configuration automatic.Channel factory passes all advertised options
Update
_channel_factoryinconnection.pyto include allChannelOptionsfields in the gRPC channel options list. Usemax_concurrent_streamsto size the per-channel concurrency semaphore, replacing the removedlimitparameter.Server-side options in WorkerProcess
Update
WorkerProcess._serve()to pass all options togrpc.aio.server(): advertised options fromChannelOptions, plus server-only options fromWorkerOptions. Lifecycle options (max_connection_idle_ms,max_connection_age_ms,max_connection_age_grace_ms) are conditionally included only when not None.Remove options from WorkerProxy and WorkerPool
Remove the
optionsparameter fromWorkerProxy.__init__,WorkerPool.__init__,WorkerFactory, and__reduce__. Remove thelimitparameter fromWorkerConnection.__init__. The proxy's_worker_sentinelreadsevent.metadata.optionsdirectly from discovery events, making configuration automatic.Test cases
TestChannelOptionsChannelOptionsis instantiatedTestChannelOptionsChannelOptionsis instantiatedTestChannelOptionsChannelOptionsis instantiatedTestChannelOptionsChannelOptionsis instantiatedTestChannelOptionsChannelOptionsis instantiatedTestChannelOptionsChannelOptionsis instantiatedTestChannelOptionsChannelOptionsis instantiatedTestWorkerOptionsWorkerOptionsis instantiatedTestWorkerOptionsWorkerOptionsis instantiatedTestWorkerOptionsWorkerOptionsis instantiatedTestWorkerOptionsWorkerOptionsis instantiatedTestWorkerOptionsWorkerOptionsis instantiatedTestWorkerOptionsWorkerOptionsis instantiatedTestWorkerOptionsWorkerOptionsis instantiatedTestWorkerOptionsWorkerOptionsis instantiatedTestWorkerMetadatato_protobuf()is calledTestWorkerMetadatato_protobuf()thenfrom_protobuf()TestWorkerMetadatato_protobuf()thenfrom_protobuf()TestWorkerMetadatato_protobuf()thenfrom_protobuf()TestWorkerConnectionTestWorkerConnectionTestWorkerConnectionTestWorkerProcessrun()is calledTestWorkerProcessrun()is calledTestWorkerProcessrun()is calledTestWorkerProcessrun()is calledTestWorkerProcessrun()executesTestWorkerProxyTestWorkerProxyTestWorkerProxyTestWorkerPoolTestPoolCompositiontest_dispatch_hypothesis