Enforce managed model provider selection and definitions (#44650)

## What changed

- Support `model_provider` and `model_providers` in managed requirements. Required selection overrides local and session configuration; each required provider definition replaces the corresponding local entry, including its authentication and headers.
- Merge provider requirement fragments before validation, preserving source-relative `auth.cwd` paths. Reject invalid cloud provider definitions before replacing the cached bundle, including unsupported Bedrock overrides.
- Expose `modelProvider` and `modelProviders` through the configuration requirements API and generated schemas. Reject writes to managed provider settings and omit their local origins, including for provider IDs containing dots.

## Testing

Add tests for requirement precedence, authentication fragment merging, path resolution, cloud cache preservation, and read-only configuration RPCs. Integration tests verify that model discovery and inference use the required gateway and ChatGPT authentication without leaking local headers, and that provider requirements survive configuration rebuilds.

GitOrigin-RevId: d1448604d4ef5662ebb5df7b693712d3b8ad6d54
This commit is contained in:
alexsong-oai
2026-09-10 21:26:47 +00:00
committed by copyberry
parent 60825b4988
commit 1aaa453ce2
34 changed files with 998 additions and 41 deletions

View File

@@ -11309,6 +11309,20 @@ class ConfigRequirements(BaseModel):
in_app_browser: Annotated[InAppBrowserRequirements | None, Field(alias="inAppBrowser")] = None
log_dir: Annotated[str | None, Field(alias="logDir")] = None
model_catalog_json: Annotated[str | None, Field(alias="modelCatalogJson")] = None
model_provider: Annotated[
str | None,
Field(
alias="modelProvider",
description="Exact provider selection required by managed policy.",
),
] = None
model_providers: Annotated[
dict[str, Any] | None,
Field(
alias="modelProviders",
description="Complete required provider definitions, using config.toml field names.",
),
] = None
models: ModelsRequirements | None = None
sqlite_home: Annotated[str | None, Field(alias="sqliteHome")] = None
windows_sandbox_private_desktop: Annotated[