feat: upstream spec sync - #572
Open
howardjohn wants to merge 4 commits into
Open
Conversation
This was referenced Jul 10, 2026
Owner
|
Please see openai/openai-openapi#557 |
Contributor
Author
|
@64bit thanks! I updated back to the github repo. Still failing a few test but working on it. |
michaelfeil
reviewed
Jul 17, 2026
| Medium, | ||
| High, | ||
| Xhigh, | ||
| Max, |
howardjohn
added a commit
to agentgateway/agentgateway
that referenced
this pull request
Aug 4, 2026
Fixes #2503 ## Summary Add provider-level OpenAI inline moderation configuration and inject it into OpenAI chat completions and Responses requests. This follows the same provider-config pattern as Bedrock guardrails, where guardrail configuration is set by the gateway rather than trusted from the client. ```yaml backends: - ai: provider: openAI: model: gpt-5 moderation: # optional; defaults to omni-moderation-latest model: omni-moderation-latest policy: input: { mode: block } # or score output: { mode: score } ``` The config structs match the shape proposed in [async-openai#572](64bit/async-openai#572). No dependency bump is needed because agentgateway already renders its own OpenAI request types. This PR wires `openAI.moderation` through: - local config and generated schema docs - xDS/proto - Kubernetes API, CRD, and controller translation - OpenAI request rendering for chat completions and Responses Request injection happens during OpenAI request rendering before final serialization. Translated request flows such as Anthropic-format client to OpenAI backend are still covered by exposing typed translated OpenAI requests from the conversion layer. ## Behavior - `openAI.moderation.model` defaults to `omni-moderation-latest` when omitted, including local config, xDS/proto decode, Kubernetes CRD defaulting, and controller translation. - Gateway-configured moderation overrides any client-supplied `moderation` field, so clients cannot weaken the configured guardrail. - Client-supplied `moderation` passes through unchanged when gateway moderation is not configured, including unknown fields and future OpenAI parameter shapes. - Moderation results are preserved on passthrough OpenAI response flows, including non-streaming and streaming responses. - Existing external `/v1/moderations` prompt guard behavior is unchanged. - `Passthrough` and `Detect` routes are not modified, consistent with other body-mutating LLM features. Known out-of-scope gap: translated response flows do not surface OpenAI moderation results back into non-OpenAI response formats in this PR. ## Notes for reviewers - When moderation is not configured, OpenAI requests keep the direct serialization path. - When moderation is configured, the gateway inserts the moderation object before final serialization; it no longer does a rendered-body serialize -> parse -> serialize round trip. - Local config moderation modes remain lower-case (`score` / `block`) to match the OpenAI shape; Kubernetes API enum values use `Score` / `Block` per repo convention and are translated to proto enum values by the controller. - Most of the `api/resource.pb.go` diff is generated churn from adding a nested proto enum, which renumbers subsequent enum indexes. ## Testing New tests cover: - local config deserialization and defaulting - controller golden output and defaulting - request injection for completions, Responses, and translated request flows - client override behavior - unknown client-field passthrough - non-streaming response preservation - streaming response chunk preservation Validation run after rebasing onto current `upstream/main` (`a1d420a3`): - `make generate-apis` - `git diff --exit-code -- api/resource.pb.go api/resource_json.gen.go controller/api/v1alpha1/agentgateway/zz_generated.deepcopy.go controller/install/helm/agentgateway-crds/templates/agentgateway.dev_agentgatewaybackends.yaml` - `git diff --check upstream/main..HEAD` - `python3 -m json.tool schema/config.json` - `go build ./controller/pkg/syncer/backend` - `go vet ./controller/pkg/syncer/backend` - `go test ./controller/api/v1alpha1/agentgateway -run TestNonExistent -count=0` - `go test ./controller/pkg/syncer/backend -run TestBuildAIBackend/Valid_OpenAI_backend_with_inline_moderation -count=1` - `go test ./controller/pkg/syncer/backend -count=1` - `make -C controller analyze` --------- Signed-off-by: GuruduGanesh <ganesh.gurudu@gmail.com> Signed-off-by: John Howard <john.howard@solo.io> Co-authored-by: John Howard <john.howard@solo.io>
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.
Following the standard flow for the new sync. They seemed to change the openapi spec substantially as part of some structure change, hence the massive yaml diff. I spot checked all of the chat and responses changes and they look correct based on recent additions (explicit cache points, inline moderation, and
Maxreasoning)