Expose override_origin on Client.connect() to set gRPC :authority header#3
Merged
serge-wq merged 1 commit intolyft-stable-1.26.0from Apr 29, 2026
Merged
Conversation
Thread a new `override_origin` string parameter from the public Python API (`Client.connect()`) through the Python/Rust bridge down to the Rust Core `ConnectionOptions::override_origin` field, which sets the HTTP/2 `:authority` pseudo-header on every gRPC call. This achieves feature parity with the Go SDK (`client.Options.HostPort`) and unblocks Python workers that connect to a Temporal cluster through an Envoy sidecar: Envoy routes by `:authority`, but without this option the Python SDK always sends `localhost:<port>` as the authority, which Envoy does not recognise as a valid upstream cluster. Changes: - temporalio/bridge/Cargo.toml: add `http = "1"` dep for Uri parsing - temporalio/bridge/src/client.rs: add override_origin field; call .maybe_override_origin() on the ConnectionOptions builder - temporalio/bridge/client.py: add override_origin field to ClientConfig - temporalio/service.py: add override_origin field to ConnectConfig; thread through _to_bridge_config() - temporalio/client.py: add override_origin kwarg to Client.connect() and CloudOperationsClient.connect(); add to ClientConnectConfig TypedDict - tests/test_service.py: unit tests for bridge wiring + integration test using a grpc.aio fake server + error test for invalid URI Co-Authored-By: Claude Sonnet 4.6 (1M context) <noreply@anthropic.com>
heryxpc
approved these changes
Apr 29, 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.
Summary
override_origin: str | None = NonetoClient.connect()(andCloudOperationsClient.connect()), wired throughConnectConfig→ Python bridge → Rust CoreConnectionOptions::override_origin:authoritypseudo-header on every gRPC call, enabling Python workers to connect through an Envoy sidecar that routes by:authorityclient.Options.HostPort) and Rust Core (ConnectionOptions::override_origin)This is a cherry-pick of the same change from
sergiof/override-origin(targeting upstreamtemporalio/sdk-python:main). After internal validation here, we will open the upstream PR.Test plan
test_connect_config_override_origin_forwarded_to_bridge,test_connect_config_override_origin_defaults_to_nonetest_override_origin_end_to_end— spins up agrpc.aiofake WorkflowService, connects withoverride_originset, confirmsGetSystemInfois called and standard gRPC metadata is intacttest_override_origin_invalid_uri_raises— confirms a bad URI string raisesValueErrorbefore any network calltest_client_connect_config_matches_connect_paramsguard passes (TypedDict in sync)override_origin="http://temporal-frontend"and confirm it connects through Envoy to the CloudSec Temporal instance🤖 Generated with Claude Code