Skip to content

fix: drop service_tier for Bedrock Mantle instead of forwarding a field it rejects - #6532

Merged
akshaydeo merged 1 commit into
maximhq:devfrom
zachgersh:gersh/mantle-drop-service-tier
Aug 25, 2026
Merged

fix: drop service_tier for Bedrock Mantle instead of forwarding a field it rejects#6532
akshaydeo merged 1 commit into
maximhq:devfrom
zachgersh:gersh/mantle-drop-service-tier

Conversation

@zachgersh

Copy link
Copy Markdown
Contributor

Summary

Requests carrying service_tier to bedrock_mantle fail with:

'priority' is not supported for 'service_tier' on this model

Mantle's OpenAI-compatible surface does not implement service_tier, but Bifrost forwards it anyway, so every such request 400s.

serviceTierForModel already strips tiers a model doesn't support — but it asks the datasheet and falls back to keeping the tier when no record exists (ServiceTierSupported's fallback=true, core/schemas/modelcaps.go:238). Capabilities resolve against the verbatim Mantle id (openai.gpt-5.6-terra, not gpt-5.6-terra), which generally has no row — so the fallback fires and the field reaches AWS.

Fail-open is the right default for a gateway that shouldn't silently drop params (see #5902, where the opposite behaviour silently downgraded billing tier). It's wrong only when the endpoint rejects the field outright, which is the case here.

Changes

  • Gate on the provider before consulting the datasheet, so the answer doesn't depend on catalog coverage. Mantle accepts no tier at all. This mirrors the existing Gemini handling, which nulls ServiceTier outright (core/providers/openai/chat.go:99).
  • The fix lands in serviceTierForModel, which both ToOpenAIChatRequest and ToOpenAIResponsesRequest call — so chat and Responses are covered by one change.
  • Provider bedrock is included alongside bedrock_mantle: it reaches these converters only through the deprecated in-provider Mantle routing in bedrock/mantle.go (verified — all four openai.HandleOpenAI* call sites in core/providers/bedrock/ are in that file). Every other Bedrock path uses Converse and never touches the OpenAI converters, so the same fix covers the legacy route.

No functionality is lost: the field was producing a 400, and omitting it lets the endpoint serve at its default tier.

Type of change

  • Bug fix

Affected areas

  • Core (Go)
  • Providers/Integrations

How to test

cd core
go test ./providers/openai/ -run 'ServiceTier|Ultrafast' -v
go test ./providers/... ./schemas/...

Three cases added to TestOpenAIConvertersFilterUltrafastByModelCapability, which already exercises both the chat and Responses converters:

Case Provider Model Tier forwarded
drops tier without metadata bedrock_mantle openai.gpt-5.6-terra no
drops tier for bare name bedrock_mantle gpt-5.6-terra no
legacy in-bedrock mantle bedrock openai.gpt-5.4 no

Confirmed they fail without the source change and pass with it; existing cases (OpenAI supported/unsupported, OpenRouter with and without metadata) are unaffected. go build ./..., go vet, and gofmt are clean, and the full ./providers/... + ./schemas/... suites pass.

Reproduced in production behind a governance load-balancer splitting bare gpt-5.x 80/20 between bedrock_mantle and openai: errors appeared on exactly the Mantle share, none on the OpenAI share.

Breaking changes

  • No

Requests that previously 400'd now succeed at the endpoint's default tier. service_tier behaviour for every other provider is untouched.

Related issues

Related to #5902 (closed) — the mirror-image bug, where a missing datasheet row caused service_tier to be silently dropped for the gpt-5.4 family on first-party OpenAI. Same datasheet-driven gating, failing in the opposite direction. That one was fixed with a datasheet update; this one can't be, because no set of catalog rows makes forwarding correct for an endpoint that rejects the field.

A datasheet row publishing service_tiers: [] for Mantle ids would be a reasonable complement, but the provider gate holds regardless of catalog coverage.

Security considerations

None. No auth, secrets, or PII involved — one request parameter is omitted for two provider values.

…ld it rejects

Requests carrying service_tier to bedrock_mantle fail with "'priority' is not
supported for 'service_tier' on this model". Mantle's OpenAI-compatible surface
does not implement service_tier, but Bifrost forwards it anyway.

serviceTierForModel already strips tiers a model does not support, but it asks
the datasheet and falls back to keeping the tier when no record exists
(ServiceTierSupported's fallback=true). Caps resolve against the verbatim Mantle
id — openai.gpt-5.6-terra, not gpt-5.6-terra — which generally has no row, so
the fallback fires and the field reaches AWS.

Gate on the provider before consulting the datasheet: Mantle accepts no tier at
all, so the answer does not depend on catalog coverage. Mirrors the existing
Gemini handling, which nulls ServiceTier outright.

Provider bedrock is included because it reaches these converters only through
the deprecated in-provider Mantle routing in bedrock/mantle.go — every other
Bedrock path uses Converse and never touches the OpenAI converters.

The fix lands in serviceTierForModel, which both ToOpenAIChatRequest and
ToOpenAIResponsesRequest call, so chat and Responses are covered by one change.

Callers lose no functionality: the field was producing a 400, and omitting it
lets the endpoint serve at its default tier.
@coderabbitai

coderabbitai Bot commented Aug 25, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro Plus

Run ID: 24a21cf9-c8b8-4cba-b54b-c469b752b50e

📥 Commits

Reviewing files that changed from the base of the PR and between e2aca4c and c2ddae0.

📒 Files selected for processing (2)
  • core/providers/openai/chat.go
  • core/providers/openai/servicetiercapabilities_test.go

Included review availability: Your plan provides up to 8 included reviews per hour; 7 remain after this review.


📝 Walkthrough

Summary by CodeRabbit

  • Bug Fixes

    • Improved handling of unsupported service tiers for Bedrock and Bedrock Mantle models.
    • Prevented incompatible ultrafast service-tier settings from being sent, including for legacy routing and models without catalog entries.
  • Tests

    • Added coverage to verify correct service-tier handling across Bedrock Mantle endpoint formats.

Walkthrough

Changes

The service-tier converter now omits service_tier for Bedrock Mantle and Bedrock endpoints before model capability checks. Tests cover Mantle-prefixed, bare, and legacy Bedrock routes.

Service-tier rejection logic and validation

Layer / File(s) Summary
Reject service tiers for Bedrock routes
core/providers/openai/chat.go, core/providers/openai/servicetiercapabilities_test.go
Bedrock Mantle and Bedrock endpoints return no service tier before capability fallback logic. Tests verify unsupported endpoints and models without catalog metadata.

Estimated code review effort: 2 (Simple) | ~10 minutes

Merge Risk: ⚪ Minimal · up to c2dda

This localized fix stops an unsupported request parameter from being sent to the affected provider while preserving other providers' behavior; no actionable merge-blocking risk remains after normal checks and review.

Suggested reviewers: tejasghatte, akshaydeo

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 75.00% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 4 functions across 2 files. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly and concisely describes the main fix: removing the rejected service_tier field for Bedrock Mantle.
Description check ✅ Passed The description explains the problem, implementation, affected providers, testing steps, behavior impact, related issue, and security considerations. It omits the template checklist, but the required …
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
Full details: Description check

Explanation

The description explains the problem, implementation, affected providers, testing steps, behavior impact, related issue, and security considerations. It omits the template checklist, but the required technical information is otherwise complete.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

Warning

Your free Security trial is over. An organization admin can activate billing to continue.


Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

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

@akshaydeo
akshaydeo merged commit e192fe4 into maximhq:dev Aug 25, 2026
5 checks passed
akhsaul pushed a commit to akhsaul/bifrost that referenced this pull request Aug 27, 2026
…ld it rejects (maximhq#6532)

Requests carrying service_tier to bedrock_mantle fail with "'priority' is not
supported for 'service_tier' on this model". Mantle's OpenAI-compatible surface
does not implement service_tier, but Bifrost forwards it anyway.

serviceTierForModel already strips tiers a model does not support, but it asks
the datasheet and falls back to keeping the tier when no record exists
(ServiceTierSupported's fallback=true). Caps resolve against the verbatim Mantle
id — openai.gpt-5.6-terra, not gpt-5.6-terra — which generally has no row, so
the fallback fires and the field reaches AWS.

Gate on the provider before consulting the datasheet: Mantle accepts no tier at
all, so the answer does not depend on catalog coverage. Mirrors the existing
Gemini handling, which nulls ServiceTier outright.

Provider bedrock is included because it reaches these converters only through
the deprecated in-provider Mantle routing in bedrock/mantle.go — every other
Bedrock path uses Converse and never touches the OpenAI converters.

The fix lands in serviceTierForModel, which both ToOpenAIChatRequest and
ToOpenAIResponsesRequest call, so chat and Responses are covered by one change.

Callers lose no functionality: the field was producing a 400, and omitting it
lets the endpoint serve at its default tier.
occcat pushed a commit to occcat/bifrost that referenced this pull request Sep 2, 2026
…ld it rejects (maximhq#6532)

Requests carrying service_tier to bedrock_mantle fail with "'priority' is not
supported for 'service_tier' on this model". Mantle's OpenAI-compatible surface
does not implement service_tier, but Bifrost forwards it anyway.

serviceTierForModel already strips tiers a model does not support, but it asks
the datasheet and falls back to keeping the tier when no record exists
(ServiceTierSupported's fallback=true). Caps resolve against the verbatim Mantle
id — openai.gpt-5.6-terra, not gpt-5.6-terra — which generally has no row, so
the fallback fires and the field reaches AWS.

Gate on the provider before consulting the datasheet: Mantle accepts no tier at
all, so the answer does not depend on catalog coverage. Mirrors the existing
Gemini handling, which nulls ServiceTier outright.

Provider bedrock is included because it reaches these converters only through
the deprecated in-provider Mantle routing in bedrock/mantle.go — every other
Bedrock path uses Converse and never touches the OpenAI converters.

The fix lands in serviceTierForModel, which both ToOpenAIChatRequest and
ToOpenAIResponsesRequest call, so chat and Responses are covered by one change.

Callers lose no functionality: the field was producing a 400, and omitting it
lets the endpoint serve at its default tier.
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.

2 participants