Allow provider selection for gateway OAuth reads and logins (#59819)

## Why

Gateway OAuth reads and logins previously used only the current provider, preventing clients from authorizing another configured provider without changing the default.

## What changed

- Add optional `modelProvider` params to `account/gatewayOAuth/read` and `account/gatewayOAuth/login`, preserving current-provider behavior for omitted or null params and selectors.
- Validate explicit providers against current managed policy without changing the default or any thread's provider.
- Retain readiness state across providers and send `account/gatewayOAuth/changed` notifications for every configured provider sharing the changed credential.
- Update protocol schemas, TypeScript types, Python models, and documentation.

## Testing

Add coverage for non-default provider login, retained readiness when alternating providers, notifications for shared credentials without starting login, and legacy TypeScript request compatibility.

GitOrigin-RevId: cfd472c322b821fe36b8c133a8de774f4ba48534
This commit is contained in:
Abhinav
2026-11-06 04:02:11 +00:00
committed by copyberry
parent a142c90e26
commit aece559654
22 changed files with 561 additions and 71 deletions
@@ -1850,7 +1850,14 @@
"type": "string"
},
"params": {
"type": "null"
"anyOf": [
{
"$ref": "#/definitions/v2/GatewayOAuthReadParams"
},
{
"type": "null"
}
]
}
},
"required": [
@@ -1873,7 +1880,14 @@
"type": "string"
},
"params": {
"type": "null"
"anyOf": [
{
"$ref": "#/definitions/v2/GatewayOAuthLoginParams"
},
{
"type": "null"
}
]
}
},
"required": [
@@ -13177,11 +13191,37 @@
"title": "GatewayOAuthChangedNotification",
"type": "object"
},
"GatewayOAuthLoginParams": {
"description": "Authorize a configured provider without changing the default or any thread's provider.",
"properties": {
"modelProvider": {
"description": "Defaults to the current provider when omitted.",
"type": [
"string",
"null"
]
}
},
"type": "object"
},
"GatewayOAuthLoginResponse": {
"$schema": "http://json-schema.org/draft-07/schema#",
"title": "GatewayOAuthLoginResponse",
"type": "object"
},
"GatewayOAuthReadParams": {
"description": "Read credential readiness for a configured provider without starting browser login.",
"properties": {
"modelProvider": {
"description": "Defaults to the current provider when omitted.",
"type": [
"string",
"null"
]
}
},
"type": "object"
},
"GatewayOAuthReadResponse": {
"$schema": "http://json-schema.org/draft-07/schema#",
"description": "Current effective gateway policy and credential readiness; never contains credentials.",
@@ -16886,6 +16926,30 @@
],
"type": "string"
},
"NullableGatewayOAuthLoginParams": {
"$schema": "http://json-schema.org/draft-07/schema#",
"anyOf": [
{
"$ref": "#/definitions/v2/GatewayOAuthLoginParams"
},
{
"type": "null"
}
],
"title": "Nullable_GatewayOAuthLoginParams"
},
"NullableGatewayOAuthReadParams": {
"$schema": "http://json-schema.org/draft-07/schema#",
"anyOf": [
{
"$ref": "#/definitions/v2/GatewayOAuthReadParams"
},
{
"type": "null"
}
],
"title": "Nullable_GatewayOAuthReadParams"
},
"NullableGetAccountRateLimitsParams": {
"$schema": "http://json-schema.org/draft-07/schema#",
"anyOf": [