fix(provider-openai): remove X-Aisix-Bridge outbound diagnostic header - #380
Conversation
The header was added in AISIX-Cloud#368 as an e2e probe to detect
Hub.register typos — e.g. `OpenAiBridge::new().with_name("grop")`
registered under `Provider::Groq` would manifest as the wrong
header value on the captured outbound request.
After Phase A clean cut (#375 closing AISIX-Cloud#417), 11 of the
14 OpenAI-adapter providers (groq / mistral / togetherai /
fireworks-ai / perplexity / moonshotai / alibaba / zhipuai /
baseten / huggingface / cerebras) no longer have a distinguishable
per-vendor `with_name()` identity — they all share the OpenAI
family bridge with uniform name "openai". The typo signal is no
longer testable for them.
The 3 remaining specialized bridges (google / deepseek / cohere)
do still carry distinct `with_name` labels, and removing the
header drops their typo-detection too. The user-driven design call
(per AISIX-Cloud#468 thread) is that operator-side diagnostics are
already covered by the DP's `tracing::info!` `bridge=<name>` field
on dispatch + chunk-stream spans — surfacing the same identity via
the upstream wire was a duplicate signal whose narrow remaining
value (3 of 14 providers) doesn't justify the per-request header
overhead, the customer-facing override-protection plumbing in
`overrides.rs::RESERVED_DEFAULT_HEADERS`, or the four in-crate
tests pinning behavior.
Changes:
- build_request_headers: drop bridge_name parameter + insert
- 4 inline header() call sites removed with their let setup
- build_chunk_stream keeps bridge_name (tracing::warn! span field,
NOT outbound header)
- 4 in-crate tests removed:
chat_default_headers_cannot_override_x_aisix_bridge
chat_emits_x_aisix_bridge_openai_for_default_bridge
chat_emits_x_aisix_bridge_for_with_name_variant
chat_stream_emits_x_aisix_bridge_for_with_name_variant
- RESERVED_DEFAULT_HEADERS: drop "x-aisix-bridge" entry
Verified:
- cargo build --workspace clean
- cargo test -p aisix-provider-openai -> 85 passed
Pairs with AISIX-Cloud#468 which drops the corresponding e2e
assertions on the test side. AISIX-Cloud#468 is forward-compatible
with header absence; this PR removes the header at the source.
ℹ️ Recent review info⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Free Run ID: 📒 Files selected for processing (2)
💤 Files with no reviewable changes (1)
📝 WalkthroughWalkthroughThe PR removes the ChangesDiagnostic Header Removal
Estimated code review effort🎯 2 (Simple) | ⏱️ ~12 minutes Note 🎁 Summarized by CodeRabbit FreeYour organization has reached its limit of developer seats under the Pro Plan. For new users, CodeRabbit will generate a high-level summary and a walkthrough for each pull request. For a comprehensive line-by-line review, please add seats to your subscription by visiting https://app.coderabbit.ai/login.If you believe this is a mistake and have available seats, please assign one to the pull request author through the subscription management page using the link above. Comment |
There was a problem hiding this comment.
Pull request overview
Removes the X-Aisix-Bridge diagnostic header from outbound requests in aisix-provider-openai, aligning with the Phase A “family bridge” shift where most OpenAI-adapter providers no longer have distinct per-vendor bridge names and bridge identity is already available via tracing spans.
Changes:
- Drops
x-aisix-bridgeinsertion fromOpenAiBridgeoutbound request building (including chat + non-chat paths shown in the diff). - Removes
x-aisix-bridgefromRESERVED_DEFAULT_HEADERS. - Deletes the in-crate unit tests that asserted
x-aisix-bridgeemission / non-overridable behavior.
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 1 comment.
| File | Description |
|---|---|
| crates/aisix-provider-openai/src/overrides.rs | Removes x-aisix-bridge from the reserved header denylist used by apply_default_headers. |
| crates/aisix-provider-openai/src/bridge.rs | Stops emitting x-aisix-bridge on outbound requests and removes tests tied to the header contract. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| /// spans. Customer default_headers can no longer set this header | ||
| /// (per overrides.rs allowlist, also pruned), upstream APIs don't | ||
| /// read it, and the original #368 catch-Hub-typo motivation became | ||
| /// untestable for the family-keyed providers. |
Pulls in #380 (remove X-Aisix-Bridge outbound diagnostic header) which merged after this branch was created. Conflict in crates/aisix-provider-openai/src/bridge.rs resolved by taking main's deletion side at every hunk — #380 removes the `x-aisix-bridge` header + its `bridge_name` parameter / locals / tests entirely, which is a superset of the per-vendor → canonical-bridge-name change this PR introduced. Net result: no x-aisix-bridge handling left in the bridge. Also strips `x-aisix-bridge` from the RESERVED_DEFAULT_HEADERS allowlist in overrides.rs (carried in from main's #380). cargo fmt + clippy --all-targets -- -D warnings + test --workspace all green after merge.
fix(provider-openai): remove X-Aisix-Bridge outbound diagnostic header
The header was added in AISIX-Cloud#368 as an e2e probe to detect
Hub.register typos — e.g.
OpenAiBridge::new().with_name("grop")registered under
Provider::Groqwould manifest as the wrongheader value on the captured outbound request.
After Phase A clean cut (#375 closing AISIX-Cloud#417), 11 of the
14 OpenAI-adapter providers (groq / mistral / togetherai /
fireworks-ai / perplexity / moonshotai / alibaba / zhipuai /
baseten / huggingface / cerebras) no longer have a distinguishable
per-vendor
with_name()identity — they all share the OpenAIfamily bridge with uniform name "openai". The typo signal is no
longer testable for them.
The 3 remaining specialized bridges (google / deepseek / cohere)
do still carry distinct
with_namelabels, and removing theheader drops their typo-detection too. The user-driven design call
(per AISIX-Cloud#468 thread) is that operator-side diagnostics are
already covered by the DP's
tracing::info!bridge=<name>fieldon dispatch + chunk-stream spans — surfacing the same identity via
the upstream wire was a duplicate signal whose narrow remaining
value (3 of 14 providers) doesn't justify the per-request header
overhead, the customer-facing override-protection plumbing in
overrides.rs::RESERVED_DEFAULT_HEADERS, or the four in-cratetests pinning behavior.
Changes:
NOT outbound header)
chat_default_headers_cannot_override_x_aisix_bridge
chat_emits_x_aisix_bridge_openai_for_default_bridge
chat_emits_x_aisix_bridge_for_with_name_variant
chat_stream_emits_x_aisix_bridge_for_with_name_variant
Verified:
Pairs with AISIX-Cloud#468 which drops the corresponding e2e
assertions on the test side. AISIX-Cloud#468 is forward-compatible
with header absence; this PR removes the header at the source.
Pairs with api7/AISIX-Cloud#468 which drops the corresponding e2e assertions on the test side. AISIX-Cloud#468 is forward-compatible with header absence; this PR removes the header at the source.
Summary by CodeRabbit
Refactor
Tests