Skip to content

fix(proxy): apply per-PK request overrides on the raw-HTTP handlers (responses/rerank/audio) - #649

Merged
jarvis9443 merged 1 commit into
mainfrom
fix/raw-handler-pk-overrides
Jun 25, 2026
Merged

fix(proxy): apply per-PK request overrides on the raw-HTTP handlers (responses/rerank/audio)#649
jarvis9443 merged 1 commit into
mainfrom
fix/raw-handler-pk-overrides

Conversation

@jarvis9443

Copy link
Copy Markdown
Contributor

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:

  • the /v1/responses verbatim-OpenAI path (all Codex traffic),
  • /v1/rerank,
  • /v1/audio/*.

So an operator's configured default_headers / param_renames / default_body_fields / param_constraints silently did nothing on those surfaces.

Fix

Apply the same override pipeline these paths' siblings already 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 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_headers override 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. Full aisix-proxy suite green (488), clippy + fmt clean.

Completes the per-PK override parity started in #648. Origin: cross-API consistency audit after AISIX-Cloud#867.

#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.
@coderabbitai

coderabbitai Bot commented Jun 25, 2026

Copy link
Copy Markdown

Warning

Review limit reached

@jarvis9443, we couldn't start this review because you've reached your PR review rate limit.

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 @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

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 configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: 1c1650d9-7752-498f-83cb-dd2294f3d4d9

📥 Commits

Reviewing files that changed from the base of the PR and between 69ed914 and 9b22413.

📒 Files selected for processing (3)
  • crates/aisix-proxy/src/audio.rs
  • crates/aisix-proxy/src/rerank.rs
  • crates/aisix-proxy/src/responses.rs
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch fix/raw-handler-pk-overrides

Comment @coderabbitai help to get the list of available commands.

@jarvis9443
jarvis9443 merged commit 09e52c4 into main Jun 25, 2026
10 checks passed
@jarvis9443
jarvis9443 deleted the fix/raw-handler-pk-overrides branch June 25, 2026 10:03
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant