Draft
Conversation
Co-authored-by: jeet1995 <16476407+jeet1995@users.noreply.github.com>
Copilot
AI
changed the title
[WIP] Enable automatic use of thin client in gateway mode
Auto-enable thin client under gateway mode
Feb 24, 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.
When using
gatewayMode(), the SDK should transparently route data-plane requests through the thin client proxy (port 10250) when the account's gateway metadata indicates thin client endpoints are available — with no new public API required.Changes
Configs.java: FlippedDEFAULT_THINCLIENT_ENABLEDfromfalse→true. Thin client is now opt-out viaCOSMOS.THINCLIENT_ENABLED=false(system property) orCOSMOS_THINCLIENT_ENABLED=false(env var).RxDocumentClientImpl.java:useThinClient. The condition is now simplyisThinClientEnabled() && GATEWAY mode. Runtime availability is already gated byuseThinClientStoreModel()→hasThinClientReadLocations().thinClientReactorHttpClient(HTTP/2 force-enabled) created ininit()only whenuseThinClient=true. The existingreactorHttpClientused by the gateway proxy retains HTTP/1.1 — the two are fully separate.thinClientHttpClient()preserves any user-suppliedHttp2ConnectionConfigpool/stream settings while forcingenabled=true.close()shuts downthinClientReactorHttpClientwhen it was created.addUserAgentSuffix()now uses theuseThinClientinstance flag (more accurate than re-readingConfigs.isThinClientEnabled()).ConfigsTests.java: UpdatedthinClientEnabledTest— default is nowtrue; test verifies opt-out withfalse.Routing behavior
The
THINCLIENT_OPT_INheader is sent on the database account metadata request so the gateway returns thin client endpoint locations, whichGlobalEndpointManagerthen uses to sethasThinClientReadLocations.Original prompt
🔒 GitHub Advanced Security automatically protects Copilot coding agent pull requests. You can protect all pull requests by enabling Advanced Security for your repositories. Learn more about Advanced Security.