Repository navigation
fix(adapters): forward prompt_cache_key through openai-chat adapter (#217) - #224
Merged
lidge-jun merged 2 commits intoJul 21, 2026
Merged
Conversation
…217) The Responses parser writes prompt_cache_key to options.promptCacheKey, but the openai-chat adapter's buildRequest() never copied it into the outbound /chat/completions body. OpenAI's Chat Completions API accepts prompt_cache_key as an optional string for prompt-cache affinity grouping. Copy parsed.options.promptCacheKey to body.prompt_cache_key when set, omit when unset. The openai-responses passthrough adapter already preserves it via _rawBody forwarding. Add two tests: one asserting the field is forwarded when present, one asserting it is absent when not provided.
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 5443c923ab
ℹ️ About Codex in GitHub
Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".
The previous unconditional copy forwarded prompt_cache_key to every openai-chat backend. Strict providers (Groq, Cerebras, etc.) reject unknown body fields, so this could break those routed requests. Add an opt-in promptCacheKey boolean flag to OcxProviderConfig and ProviderRegistryEntry, wired through router scalar backfill. The adapter now only forwards body.prompt_cache_key when the provider explicitly opts in. Default off, so no built-in provider is affected. The built-in OpenAI provider uses openai-responses (passthrough), which already preserves prompt_cache_key via _rawBody forwarding. This flag is for user-configured openai-chat providers that document prompt_cache_key support. Tests updated to cover opt-in, opt-out, and unset cases.
2 tasks done
2 tasks done
agentHits
pushed a commit
to agentHits/opencodex
that referenced
this pull request
Sep 17, 2026
…idge-jun#217) (lidge-jun#224) * fix(adapters): forward prompt_cache_key through openai-chat adapter (lidge-jun#217) The Responses parser writes prompt_cache_key to options.promptCacheKey, but the openai-chat adapter's buildRequest() never copied it into the outbound /chat/completions body. OpenAI's Chat Completions API accepts prompt_cache_key as an optional string for prompt-cache affinity grouping. Copy parsed.options.promptCacheKey to body.prompt_cache_key when set, omit when unset. The openai-responses passthrough adapter already preserves it via _rawBody forwarding. Add two tests: one asserting the field is forwarded when present, one asserting it is absent when not provided. * fix(adapters): gate prompt_cache_key behind provider opt-in flag The previous unconditional copy forwarded prompt_cache_key to every openai-chat backend. Strict providers (Groq, Cerebras, etc.) reject unknown body fields, so this could break those routed requests. Add an opt-in promptCacheKey boolean flag to OcxProviderConfig and ProviderRegistryEntry, wired through router scalar backfill. The adapter now only forwards body.prompt_cache_key when the provider explicitly opts in. Default off, so no built-in provider is affected. The built-in OpenAI provider uses openai-responses (passthrough), which already preserves prompt_cache_key via _rawBody forwarding. This flag is for user-configured openai-chat providers that document prompt_cache_key support. Tests updated to cover opt-in, opt-out, and unset cases.
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.
Summary
The Responses parser writes \prompt_cache_key\ to \options.promptCacheKey, but the \openai-chat\ adapter's \�uildRequest()\ never copied it into the outbound /chat/completions\ body. OpenAI's Chat Completions API accepts \prompt_cache_key\ as an optional string for prompt-cache affinity grouping.
Changes
Tests
Fixes #217