fix(proxy): apply per-PK request overrides on the raw-HTTP handlers (responses/rerank/audio) - #649
Conversation
#648 wired per-PK request overrides into the OpenAI bridge methods (embed/complete/generate_image). The handlers that bypass the bridge and build their upstream request directly still dropped them: the /v1/responses verbatim-OpenAI path (all Codex traffic), /v1/rerank, and /v1/audio/*. So an operator's configured default_headers / param_renames / default_body_fields / param_constraints silently did nothing on those surfaces. Apply the same override pipeline these paths' siblings use (the OpenAI bridge's chat() and the /v1/messages passthrough), via the public aisix_provider_openai::overrides helpers: - /v1/responses verbatim path and /v1/rerank: body overrides (renames → constraints → defaults) + default_headers. - /v1/audio/speech (JSON): body overrides + default_headers. - /v1/audio/transcriptions + /translations (multipart): default_headers only — the body is a multipart form, so the JSON body-field overrides don't apply; Content-Type stays owned by the multipart encoder. Bridge-owned auth/content-type/request-id headers are inserted first, so apply_default_headers (skip-if-present + reserved blacklist) can never clobber auth. Each is a no-op when the PK carries no overrides. Per-handler tests assert a configured default_body_fields + default_headers reach the upstream (wiremock body + header matchers); each fails before the fix (overrides dropped → mock unmatched → non-200) and passes after. Completes the per-PK override parity started in #648.
|
Warning Review limit reached
More reviews will be available in 26 minutes and 24 seconds. Learn how PR review limits work. Your organization has used up its prepaid credits, and credit purchases are no longer available. Enable the review add-on in the billing tab to keep reviews running — you're only billed for reviews past your plan's rate limits ($0.25/file). ⌛ How to resolve this issue?After more reviews become available, a review can be triggered using the To avoid repeated limits, reduce automatic review volume by pausing incremental auto-reviews earlier, using label-based review opt-in, excluding WIP or generated PR titles, or requesting reviews manually when the PR is ready. If your team needs uninterrupted high-volume reviews, an organization admin can enable usage-based credits. 🚦 How do rate limits work?CodeRabbit enforces per-developer PR review limits for each organization. Most developers receive the normal plan review availability. For paid Pro and Pro+ PR reviews, CodeRabbit uses adaptive limits for sustained high-volume activity. When a developer's recent PR review activity reaches the 95th percentile or higher among CodeRabbit users, additional reviews become available more gradually as earlier reviews age out of the rolling window. Please see our Fair Usage Limits Policy for further information. ℹ️ Review info⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (3)
✨ Finishing Touches🧪 Generate unit tests (beta)
Comment |
Problem
#648 wired per-PK request overrides (
param_renames/param_constraints/default_body_fields/default_headers) into the OpenAI bridge methods (embed/complete/generate_image). But several handlers bypass the bridge and build their upstream HTTP request directly, and those still dropped every override:/v1/responsesverbatim-OpenAI path (all Codex traffic),/v1/rerank,/v1/audio/*.So an operator's configured
default_headers/param_renames/default_body_fields/param_constraintssilently did nothing on those surfaces.Fix
Apply the same override pipeline these paths' siblings already use (the OpenAI bridge's
chat()and the/v1/messagespassthrough), via the publicaisix_provider_openai::overrides::*helpers:/v1/responsesverbatim path and/v1/rerank: body overrides (renames → constraints → defaults) +default_headers./v1/audio/speech(JSON): body overrides +default_headers./v1/audio/transcriptions+/translations(multipart):default_headersonly — the body is a multipart form, so the JSON body-field overrides don't apply;Content-Typestays owned by the multipart encoder.Bridge-owned auth / content-type / request-id headers are inserted first, so
apply_default_headers(skip-if-present + reserved blacklist) can never clobber auth. Each call is a no-op when the PK carries no overrides, so behavior is unchanged for the common case.Tests
Per-handler tests configure a
default_body_fields+default_headersoverride and assert both reach the upstream (wiremock body + header matchers; multipart asserts the header only). Each fails before the fix (overrides dropped → mock unmatched → non-200) and passes after. Fullaisix-proxysuite green (488), clippy + fmt clean.Completes the per-PK override parity started in #648. Origin: cross-API consistency audit after AISIX-Cloud#867.