Repository navigation
Define model provider validation once - #522
Merged
Merged
Conversation
internal/modelprovider's Provider.Validate is now the only provider rule. It owns the base URL check, including the HTTPS and IDNA host rule that contracts/agents-api/v1 kept separately, the anthropic base path, the protocol vocabulary, the API key and the token limits, and returns a typed FieldError naming the rejected field. One parameter admits plain http to a loopback IP address: Core and the agent host's upstream admission and gateway reject it, and harnessconfig.Prepare accepts it for the credential gateway listener a view hands its Harness. v1.ModelProviderInput.Validate maps the field to its existing public code and message, so the error catalog is unchanged. Deleted: v1's model_provider_admission.go and its copies of the key and limit checks, Protocol.ValidBasePath, Registry.SupportsProtocol, the Codex adapter's re-check of a validated provider, and the literal 16384 in the Core error details, which now reads modelprovider.MaxAPIKeyLength. model-execution.md states the rule once, including the loopback http mode, and core-errors.md links to it.
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.
internal/modelproviderowns the only model-provider rule, and Core and the Runtime both apply it.Provider.Validate(loopbackHTTP bool)checks the base URL (HTTPS with the IDNA host rule moved fromv1, plus the anthropic base path), protocol, API key and token limits, and returns a typed*FieldError. Only the Harness preparation of the credential gateway's listener passestrue. Core admission, agent-host admission and the gateway's upstream relay all reject plainhttp.v1.ModelProviderInput.Validatemaps the rejected field to the existing public codes and messages.model_provider_admission.go,Protocol.ValidBasePath,Registry.SupportsProtocoland the Codex config writer's re-check are deleted.model-execution.md(+zh) states the rule once, andcore-errors.mdlinks to it.Not a wire change, so
proto.Versionstays the same. The TypeScript copies inpackages/agents-clientand Web stay for main's audit item 30-P2.Checks:
modelprovidertable test (each rule, both loopback modes),v1,harnessconfig, gateway, codex, agenthost, Coreapi(TestCoreErrorCatalog) andexecution; darwin/windows daemon builds;make check-names check-docs check-ci. Coordinator review (small lane).Need help on this PR? Tag
@codesmith-botwith what you need. Autofix is disabled.