Skip to content

feat: add Bedrock Mantle inference engine support for gpt-oss models via OpenAI-compatible SSE endpoint - #3489

Merged
akshaydeo merged 1 commit into
devfrom
05-14-feat_add_support_for_bedrock_mantle
May 15, 2026
Merged

feat: add Bedrock Mantle inference engine support for gpt-oss models via OpenAI-compatible SSE endpoint#3489
akshaydeo merged 1 commit into
devfrom
05-14-feat_add_support_for_bedrock_mantle

Conversation

@BearTS

@BearTS BearTS commented May 14, 2026

Copy link
Copy Markdown
Contributor

Summary

Adds support for routing gpt-oss model requests through the AWS Bedrock Mantle inference endpoint (bedrock-mantle.{region}.api.aws). These are OpenAI-compatible models hosted on Bedrock that require a different endpoint and request/response format than standard Bedrock models.

Changes

  • Added isMantleModel and mantleModelID helpers to detect and transform gpt-oss model identifiers for the Mantle endpoint.
  • Added signAWSRequestFromKey as a convenience wrapper around signAWSRequest that reads credentials from a BedrockKeyConfig, falling back to the default AWS credential chain when no config is provided.
  • Added completeMantleRequest and makeMantleStreamingRequest to handle non-streaming and SSE streaming HTTP requests to the Mantle endpoint. Both support Bearer token auth (via key.Value) or SigV4 signing as a fallback.
  • Added chatCompletionViaMantle, chatCompletionStreamViaMantle, responsesViaMantle, and responsesStreamViaMantle to convert Bifrost requests into OpenAI-compatible payloads and route them to the Mantle endpoint.
  • Injected Mantle routing checks at the top of ChatCompletion, ChatCompletionStream, Responses, and ResponsesStream so that any gpt-oss model is transparently redirected before the standard Bedrock path executes.
  • Mantle streaming uses SSE (text/event-stream) rather than AWS EventStream binary framing, with full support for idle timeouts, cancellation, usage accumulation, and terminal chunk emission.

Type of change

  • Bug fix
  • Feature
  • Refactor
  • Documentation
  • Chore/CI

Affected areas

  • Core (Go)
  • Transports (HTTP)
  • Providers/Integrations
  • Plugins
  • UI (React)
  • Docs

How to test

go test ./core/providers/bedrock/...

To validate end-to-end, configure a Bedrock key and send a request with a gpt-oss model (e.g. gpt-oss-mini). Verify the request is routed to bedrock-mantle.{region}.api.aws/v1/chat/completions and that both streaming and non-streaming responses are returned correctly.

For SigV4 auth, omit key.Value and ensure BedrockKeyConfig credentials or the default AWS credential chain (env vars, IAM role, instance profile) are available.

Breaking changes

  • Yes
  • No

Related issues

Security considerations

  • SigV4 request signing is applied to Mantle requests when no Bearer token is present, using the same credential resolution path as standard Bedrock requests.
  • When BedrockKeyConfig is nil, signing falls back to the default AWS credential chain, which may pick up ambient credentials (env vars, instance profile). This is intentional and consistent with existing Bedrock behavior.

Checklist

  • I read docs/contributing/README.md and followed the guidelines
  • I added/updated tests where appropriate
  • I updated documentation where needed
  • I verified builds succeed (Go and UI)
  • I verified the CI pipeline passes locally if applicable

@coderabbitai

coderabbitai Bot commented May 14, 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: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: d430390e-971c-42a4-9b47-d81dac93536d

📥 Commits

Reviewing files that changed from the base of the PR and between 0bfa0e0 and 67cab70.

📒 Files selected for processing (3)
  • core/providers/bedrock/bedrock.go
  • core/providers/bedrock/mantle.go
  • core/providers/bedrock/types.go
🚧 Files skipped from review as they are similar to previous changes (2)
  • core/providers/bedrock/bedrock.go
  • core/providers/bedrock/mantle.go

📝 Walkthrough

Summary by CodeRabbit

  • New Features
    • Added support for Bedrock “Mantle” (gpt-oss family) via OpenAI‑compatible endpoints.
    • Mantle models are routed to dedicated handlers for streaming and non‑streaming chat and responses.
    • Supports AWS SigV4 signing for Mantle requests, including event‑stream signing when no bearer token is used.
    • Uses Mantle‑optimized HTTP clients and pre‑warmed connections for improved reliability and performance.

Walkthrough

Routes gpt-oss (Mantle) models to Mantle handlers by adding fasthttp Mantle clients, a sign-from-key wrapper, model detection and Mantle URL builders, plus non-streaming and streaming Mantle handlers that delegate to existing OpenAI-compatible handlers.

Changes

Bedrock Mantle Routing

Layer / File(s) Summary
Provider struct and Mantle HTTP clients
core/providers/bedrock/bedrock.go
Adds mantleClient and mantleStreamingClient to BedrockProvider and configures them in NewBedrockProvider (timeouts, pooling, proxy/dialer/TLS) and preserves response-pool pre-warming.
AWS signing and model routing entry points
core/providers/bedrock/bedrock.go
Adds signAWSRequestFromKey to sign requests from optional *schemas.BedrockKeyConfig. Core methods ChatCompletion, ChatCompletionStream, Responses, ResponsesStream short-circuit Mantle models to Mantle handlers.
Mantle transport and model normalization
core/providers/bedrock/mantle.go, core/providers/bedrock/types.go
Helpers detect/normalize gpt-oss* model names, build regional Mantle base URLs, and compute SigV4 headers by signing the exact request bytes + Accept header; adds bedrockMantleSigningService constant and scopes bedrockSigningService doc comment.
Non-streaming chat completions and responses
core/providers/bedrock/mantle.go
chatCompletionViaMantle and responsesViaMantle precompute JSON body bytes when SigV4 is used, overlay SigV4 headers into extra headers (or use Bearer), and delegate to existing OpenAI-compatible non-streaming handlers using the Mantle URL.
Streaming chat completions and responses
core/providers/bedrock/mantle.go
chatCompletionStreamViaMantle and responsesStreamViaMantle support Bearer or SigV4 auth, pre-sign event-stream bytes for SigV4, pass SigV4 headers as authHeader, inject request-body converters, and delegate to existing streaming handlers while preserving signed-byte equivalence.

Sequence Diagram(s)

sequenceDiagram
  participant Client as Client
  participant BedrockProvider as BedrockProvider
  participant Router as isMantleModel
  participant Signer as mantleSigV4Headers
  participant Mantle as BedrockMantle
  participant OpenAI as OpenAIHandler
  Client->>BedrockProvider: ChatCompletion/Responses(request)
  BedrockProvider->>Router: Check model string
  alt Mantle model (gpt-oss)
    Router->>Signer: Pre-sign exact request bytes + Accept
    Signer->>Mantle: POST with SigV4 headers (Authorization, X-Amz-Date, x-amz-content-sha256, Accept, X-Amz-Security-Token?)
    Mantle->>OpenAI: Return OpenAI-compatible JSON or SSE stream
    OpenAI->>Client: Parsed response / stream chunks
  else Non-Mantle
    BedrockProvider->>OpenAI: Route to standard Bedrock runtime handlers
  end
Loading
sequenceDiagram
  participant StreamingHandler as StreamingHandler
  participant Signer as mantleSigV4Headers
  participant MantleSSE as MantleSSE
  participant Chunker as StreamChunkPipeline
  StreamingHandler->>Signer: Sign event-stream bytes with Accept: text/event-stream
  Signer->>MantleSSE: Open SSE stream with SigV4 headers
  loop Per SSE Line
    MantleSSE->>StreamingHandler: data/event line
    StreamingHandler->>Chunker: Parse and emit incremental chunk
  end
  StreamingHandler->>Chunker: Emit terminal chunk (finish reason + usage)
Loading

Estimated code review effort

🎯 4 (Complex) | ⏱️ ~45 minutes

Poem

🐰 I boiled bytes and signed them neat,
Mantle gates opened to my little feat,
Streams crinkle like morning hay,
Models hop along the lane today,
✨ carrot-signed, we sing and greet. ✨

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Title check ✅ Passed The PR title accurately and specifically describes the main feature—adding Bedrock Mantle support for gpt-oss models with OpenAI-compatible SSE endpoint, which aligns perfectly with the core changes across all modified files.
Description check ✅ Passed The PR description provides comprehensive detail on the feature, changes, affected areas, testing instructions, and security considerations. All required template sections are addressed with substantive, well-structured content.
Docstring Coverage ✅ Passed Docstring coverage is 100.00% which is sufficient. The required threshold is 80.00%.
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.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch 05-14-feat_add_support_for_bedrock_mantle

Warning

There were issues while running some tools. Please review the errors and either fix the tool's configuration or disable the tool if it's a critical failure.

🔧 golangci-lint (2.12.2)

level=error msg="[linters_context] typechecking error: pattern ./...: directory prefix . does not contain main module or its selected dependencies"

Tip

💬 Introducing Slack Agent: The best way for teams to turn conversations into code.

Slack Agent is built on CodeRabbit's deep understanding of your code, so your team can collaborate across the entire SDLC without losing context.

  • Generate code and open pull requests
  • Plan features and break down work
  • Investigate incidents and troubleshoot customer tickets together
  • Automate recurring tasks and respond to alerts with triggers
  • Summarize progress and report instantly

Built for teams:

  • Shared memory across your entire org—no repeating context
  • Per-thread sandboxes to safely plan and execute work
  • Governance built-in—scoped access, auditability, and budget controls

One agent for your entire SDLC. Right inside Slack.

👉 Get started


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

BearTS commented May 14, 2026

Copy link
Copy Markdown
Contributor Author

@BearTS BearTS changed the title feat: add support for bedrock mantle feat: add Bedrock Mantle inference engine support for gpt-oss models via OpenAI-compatible SSE endpoint May 14, 2026
@BearTS
BearTS marked this pull request as ready for review May 14, 2026 08:25
@greptile-apps

greptile-apps Bot commented May 14, 2026

Copy link
Copy Markdown
Contributor

Confidence Score: 5/5

The change is well-scoped and safe to merge; Mantle routing only engages for models containing gpt-oss and all entry points check operation permissions first.

The core routing, SigV4 signing, and streaming delegation are all logically sound. Several issues from earlier rounds have been addressed. The remaining finding is a defensive hygiene concern rather than a current breakage.

core/providers/bedrock/mantle.go — the isMantleModel predicate deserves a tighter definition to avoid accidental routing of future model names that contain gpt-oss.

Important Files Changed

Filename Overview
core/providers/bedrock/mantle.go New file implementing Mantle endpoint routing for gpt-oss models; addresses several earlier review issues but isMantleModel uses an overly broad substring match
core/providers/bedrock/bedrock.go Adds fasthttp Mantle clients and injects isMantleModel routing checks at the top of all four request handlers; structural changes are minimal and consistent
core/providers/bedrock/types.go Adds bedrockMantleSigningService constant alongside existing bedrockSigningService; clean, focused change

Reviews (9): Last reviewed commit: "feat: add support for bedrock mantle" | Re-trigger Greptile

Comment thread core/providers/bedrock/mantle.go Outdated
Comment thread core/providers/bedrock/mantle.go Outdated
Comment thread core/providers/bedrock/mantle.go Outdated

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 3

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@core/providers/bedrock/mantle.go`:
- Around line 346-357: When handling readErr from sseReader.ReadDataLine() in
the mantle stream loop (and the analogous branch in responsesStreamViaMantle),
check isStreamTransportError(readErr) first and treat such errors as non-Bifrost
transport failures (i.e., set IsBifrostError=false / allow retry semantics)
instead of immediately calling providerUtils.ProcessAndSendError; only call
ProcessAndSendError for non-transport errors. Update the branch that currently
sets schemas.BifrostContextKeyStreamEndIndicator and calls
provider.logger.Warn/ProcessAndSendError to first call
isStreamTransportError(readErr) and return after marking or delegating so
executeRequestWithRetries can retry transport failures.
- Around line 22-25: The predicate in isMantleModel currently only checks
bareModel for the "gpt-oss" prefix and misses documented normalized IDs like
"openai.gpt-oss-120b"; update isMantleModel (which calls
parseBedrockRegionAndModel) to return true when bareModel starts with either
"gpt-oss" OR "openai.gpt-oss" (e.g., use strings.HasPrefix(bareModel, "gpt-oss")
|| strings.HasPrefix(bareModel, "openai.gpt-oss")) so both legacy and normalized
Mantle model IDs are routed through the Mantle path.
- Line 60: Add a new constant named bedrockMantleSigningService =
"bedrock-mantle" (in types.go) and update the two calls to signAWSRequestFromKey
in mantle.go that currently pass bedrockSigningService ("bedrock") so they
instead pass bedrockMantleSigningService; specifically, replace usages where
signAWSRequestFromKey(ctx, req, key.BedrockKeyConfig, region,
bedrockSigningService) is invoked (both occurrences) so Mantle requests are
SigV4-signed with the "bedrock-mantle" service name.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: f1dfb778-2ada-4fe3-a42c-c47c35902a74

📥 Commits

Reviewing files that changed from the base of the PR and between e0990b3 and 4779623.

📒 Files selected for processing (2)
  • core/providers/bedrock/bedrock.go
  • core/providers/bedrock/mantle.go

Comment thread core/providers/bedrock/mantle.go
Comment thread core/providers/bedrock/mantle.go Outdated
Comment thread core/providers/bedrock/mantle.go Outdated
@BearTS
BearTS force-pushed the 05-14-feat_add_support_for_bedrock_mantle branch from 4779623 to 6f272ba Compare May 14, 2026 09:47

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

♻️ Duplicate comments (2)
core/providers/bedrock/mantle.go (2)

40-65: ⚠️ Potential issue | 🔴 Critical | ⚡ Quick win

Use dedicated bedrockMantleSigningService constant for Mantle SigV4 signing.

Line 52 signs Mantle requests with bedrockSigningService ("bedrock"), but AWS Bedrock Mantle requires the service name "bedrock-mantle" in the SigV4 credential scope. Using the wrong service name will cause signature verification failures when relying on AWS credentials.

Suggested fix

In types.go, add:

 const bedrockSigningService = "bedrock"
+const bedrockMantleSigningService = "bedrock-mantle"

In mantle.go line 52:

-	if bifrostErr := signAWSRequestFromKey(ctx, req, key.BedrockKeyConfig, region, bedrockSigningService); bifrostErr != nil {
+	if bifrostErr := signAWSRequestFromKey(ctx, req, key.BedrockKeyConfig, region, bedrockMantleSigningService); bifrostErr != nil {
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@core/providers/bedrock/mantle.go` around lines 40 - 65, Change Mantle SigV4
signing to use a dedicated service name: add a new constant
bedrockMantleSigningService = "bedrock-mantle" (e.g., in types.go) and update
the call in mantleSigV4Headers to pass bedrockMantleSigningService instead of
bedrockSigningService when calling signAWSRequestFromKey; ensure any references
to the Mantle signing service use the new constant so the SigV4 credential scope
is "bedrock-mantle".

17-19: ⚠️ Potential issue | 🟠 Major | ⚡ Quick win

Use bare model extraction for precise Mantle model detection.

strings.Contains(model, "gpt-oss") will incorrectly match model IDs like "my-custom-gpt-oss-model" or "gpt-ossified". Extract the bare model first (via parseBedrockRegionAndModel) and check prefixes to avoid false positives.

Suggested fix
 func isMantleModel(model string) bool {
-	return strings.Contains(model, "gpt-oss")
+	_, bareModel := parseBedrockRegionAndModel(model)
+	return strings.HasPrefix(bareModel, "gpt-oss") ||
+		strings.HasPrefix(bareModel, "openai.gpt-oss")
 }
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@core/providers/bedrock/mantle.go` around lines 17 - 19, Update isMantleModel
to first extract the bare model via parseBedrockRegionAndModel and then check
the bare model using a prefix check (e.g., strings.HasPrefix) instead of
strings.Contains; specifically, call parseBedrockRegionAndModel(model) to get
the stripped model identifier (use the returned bareModel variable) and return
strings.HasPrefix(bareModel, "gpt-oss") so names like "my-custom-gpt-oss-model"
or "gpt-ossified" no longer match incorrectly.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Duplicate comments:
In `@core/providers/bedrock/mantle.go`:
- Around line 40-65: Change Mantle SigV4 signing to use a dedicated service
name: add a new constant bedrockMantleSigningService = "bedrock-mantle" (e.g.,
in types.go) and update the call in mantleSigV4Headers to pass
bedrockMantleSigningService instead of bedrockSigningService when calling
signAWSRequestFromKey; ensure any references to the Mantle signing service use
the new constant so the SigV4 credential scope is "bedrock-mantle".
- Around line 17-19: Update isMantleModel to first extract the bare model via
parseBedrockRegionAndModel and then check the bare model using a prefix check
(e.g., strings.HasPrefix) instead of strings.Contains; specifically, call
parseBedrockRegionAndModel(model) to get the stripped model identifier (use the
returned bareModel variable) and return strings.HasPrefix(bareModel, "gpt-oss")
so names like "my-custom-gpt-oss-model" or "gpt-ossified" no longer match
incorrectly.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: f64b3fb9-11b8-4462-b259-246d8a74a4d9

📥 Commits

Reviewing files that changed from the base of the PR and between 4779623 and 6f272ba.

📒 Files selected for processing (2)
  • core/providers/bedrock/bedrock.go
  • core/providers/bedrock/mantle.go
🚧 Files skipped from review as they are similar to previous changes (1)
  • core/providers/bedrock/bedrock.go

Comment thread core/providers/bedrock/mantle.go Outdated
@BearTS
BearTS force-pushed the 05-14-feat_add_support_for_bedrock_mantle branch from 6f272ba to f4e4400 Compare May 14, 2026 10:04
coderabbitai[bot]
coderabbitai Bot previously approved these changes May 14, 2026
Comment thread core/providers/bedrock/mantle.go Outdated
@BearTS
BearTS force-pushed the 05-14-feat_add_support_for_bedrock_mantle branch from f4e4400 to 7cc0f0e Compare May 14, 2026 10:23
coderabbitai[bot]
coderabbitai Bot previously approved these changes May 14, 2026
@BearTS
BearTS force-pushed the 05-14-feat_add_support_for_bedrock_mantle branch from 7cc0f0e to 3234b6a Compare May 14, 2026 10:51

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 2

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@core/providers/bedrock/bedrock.go`:
- Around line 31-40: The BedrockProvider currently declares mantleClient and
mantleStreamingClient as *fasthttp.Client which violates the net/http + HTTP/2
guideline; replace those fasthttp.Client fields with *http.Client (or reuse the
provider's existing client/streamingClient) and ensure Mantle requests use the
same net/http.Transport configured with ForceAttemptHTTP2=true and
MaxConnsPerHost pulled from NetworkConfig; update any code that constructs or
uses mantleClient/mantleStreamingClient to build them from the same Transport
used for client/streamingClient so Mantle shares the net/http stack rather than
a fasthttp one.

In `@core/providers/bedrock/mantle.go`:
- Around line 86-97: The call to the shared OpenAI handler
openai.HandleOpenAIChatCompletionRequest is passing a hardcoded schemas.Bedrock
which collapses custom provider aliases; replace that argument with
provider.GetProviderKey() (call the method on the same provider instance used in
the call) so the downstream handlers receive the real provider key string. Do
the same replacement for the other delegated OpenAI handler invocations in this
file that currently pass schemas.Bedrock (e.g., the other openai.HandleOpenAI...
calls around the other request/response delegations) so all error/response
contexts reflect the configured provider key.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: ccedee5d-c0ea-4063-a262-7c14c60b11e4

📥 Commits

Reviewing files that changed from the base of the PR and between 7cc0f0e and 3234b6a.

📒 Files selected for processing (3)
  • core/providers/bedrock/bedrock.go
  • core/providers/bedrock/mantle.go
  • core/providers/bedrock/types.go
🚧 Files skipped from review as they are similar to previous changes (1)
  • core/providers/bedrock/types.go

Comment thread core/providers/bedrock/bedrock.go
Comment thread core/providers/bedrock/mantle.go
@BearTS
BearTS force-pushed the 05-14-feat_add_support_for_bedrock_mantle branch from 3234b6a to 4ef1562 Compare May 14, 2026 11:04
Comment thread core/providers/bedrock/mantle.go
@akshaydeo
akshaydeo requested a review from a team as a code owner May 14, 2026 12:51
@BearTS
BearTS force-pushed the 05-14-feat_add_support_for_bedrock_mantle branch from 4ef1562 to 52b9150 Compare May 14, 2026 12:58
coderabbitai[bot]
coderabbitai Bot previously approved these changes May 14, 2026
Comment thread core/providers/bedrock/mantle.go
@BearTS
BearTS force-pushed the 05-14-feat_add_support_for_bedrock_mantle branch from 52b9150 to 0bfa0e0 Compare May 14, 2026 18:26
coderabbitai[bot]
coderabbitai Bot previously approved these changes May 14, 2026
@akshaydeo
akshaydeo dismissed coderabbitai[bot]’s stale review May 15, 2026 05:59

The merge-base changed after approval.

@BearTS
BearTS force-pushed the 05-14-feat_add_support_for_bedrock_mantle branch from 0bfa0e0 to 67cab70 Compare May 15, 2026 08:00

akshaydeo commented May 15, 2026

Copy link
Copy Markdown
Contributor

Merge activity

  • May 15, 1:10 PM UTC: A user started a stack merge that includes this pull request via Graphite.
  • May 15, 1:10 PM UTC: @akshaydeo merged this pull request with Graphite.

@akshaydeo
akshaydeo merged commit 199a020 into dev May 15, 2026
8 of 10 checks passed
@akshaydeo
akshaydeo deleted the 05-14-feat_add_support_for_bedrock_mantle branch May 15, 2026 13:10
akshaydeo pushed a commit that referenced this pull request May 15, 2026
…s via OpenAI-compatible SSE endpoint (#3489)

## Summary

Adds support for routing `gpt-oss` model requests through the AWS Bedrock Mantle inference endpoint (`bedrock-mantle.{region}.api.aws`). These are OpenAI-compatible models hosted on Bedrock that require a different endpoint and request/response format than standard Bedrock models.

## Changes

- Added `isMantleModel` and `mantleModelID` helpers to detect and transform `gpt-oss` model identifiers for the Mantle endpoint.
- Added `signAWSRequestFromKey` as a convenience wrapper around `signAWSRequest` that reads credentials from a `BedrockKeyConfig`, falling back to the default AWS credential chain when no config is provided.
- Added `completeMantleRequest` and `makeMantleStreamingRequest` to handle non-streaming and SSE streaming HTTP requests to the Mantle endpoint. Both support Bearer token auth (via `key.Value`) or SigV4 signing as a fallback.
- Added `chatCompletionViaMantle`, `chatCompletionStreamViaMantle`, `responsesViaMantle`, and `responsesStreamViaMantle` to convert Bifrost requests into OpenAI-compatible payloads and route them to the Mantle endpoint.
- Injected Mantle routing checks at the top of `ChatCompletion`, `ChatCompletionStream`, `Responses`, and `ResponsesStream` so that any `gpt-oss` model is transparently redirected before the standard Bedrock path executes.
- Mantle streaming uses SSE (`text/event-stream`) rather than AWS EventStream binary framing, with full support for idle timeouts, cancellation, usage accumulation, and terminal chunk emission.

## Type of change

- [ ] Bug fix
- [x] Feature
- [ ] Refactor
- [ ] Documentation
- [ ] Chore/CI

## Affected areas

- [x] Core (Go)
- [ ] Transports (HTTP)
- [x] Providers/Integrations
- [ ] Plugins
- [ ] UI (React)
- [ ] Docs

## How to test

```sh
go test ./core/providers/bedrock/...
```

To validate end-to-end, configure a Bedrock key and send a request with a `gpt-oss` model (e.g. `gpt-oss-mini`). Verify the request is routed to `bedrock-mantle.{region}.api.aws/v1/chat/completions` and that both streaming and non-streaming responses are returned correctly.

For SigV4 auth, omit `key.Value` and ensure `BedrockKeyConfig` credentials or the default AWS credential chain (env vars, IAM role, instance profile) are available.

## Breaking changes

- [ ] Yes
- [x] No

## Related issues

## Security considerations

- SigV4 request signing is applied to Mantle requests when no Bearer token is present, using the same credential resolution path as standard Bedrock requests.
- When `BedrockKeyConfig` is `nil`, signing falls back to the default AWS credential chain, which may pick up ambient credentials (env vars, instance profile). This is intentional and consistent with existing Bedrock behavior.

## Checklist

- [ ] I read `docs/contributing/README.md` and followed the guidelines
- [ ] I added/updated tests where appropriate
- [ ] I updated documentation where needed
- [ ] I verified builds succeed (Go and UI)
- [ ] I verified the CI pipeline passes locally if applicable
@coderabbitai coderabbitai Bot mentioned this pull request May 18, 2026
18 tasks
akshaydeo pushed a commit that referenced this pull request May 20, 2026
…s via OpenAI-compatible SSE endpoint (#3489)

## Summary

Adds support for routing `gpt-oss` model requests through the AWS Bedrock Mantle inference endpoint (`bedrock-mantle.{region}.api.aws`). These are OpenAI-compatible models hosted on Bedrock that require a different endpoint and request/response format than standard Bedrock models.

## Changes

- Added `isMantleModel` and `mantleModelID` helpers to detect and transform `gpt-oss` model identifiers for the Mantle endpoint.
- Added `signAWSRequestFromKey` as a convenience wrapper around `signAWSRequest` that reads credentials from a `BedrockKeyConfig`, falling back to the default AWS credential chain when no config is provided.
- Added `completeMantleRequest` and `makeMantleStreamingRequest` to handle non-streaming and SSE streaming HTTP requests to the Mantle endpoint. Both support Bearer token auth (via `key.Value`) or SigV4 signing as a fallback.
- Added `chatCompletionViaMantle`, `chatCompletionStreamViaMantle`, `responsesViaMantle`, and `responsesStreamViaMantle` to convert Bifrost requests into OpenAI-compatible payloads and route them to the Mantle endpoint.
- Injected Mantle routing checks at the top of `ChatCompletion`, `ChatCompletionStream`, `Responses`, and `ResponsesStream` so that any `gpt-oss` model is transparently redirected before the standard Bedrock path executes.
- Mantle streaming uses SSE (`text/event-stream`) rather than AWS EventStream binary framing, with full support for idle timeouts, cancellation, usage accumulation, and terminal chunk emission.

## Type of change

- [ ] Bug fix
- [x] Feature
- [ ] Refactor
- [ ] Documentation
- [ ] Chore/CI

## Affected areas

- [x] Core (Go)
- [ ] Transports (HTTP)
- [x] Providers/Integrations
- [ ] Plugins
- [ ] UI (React)
- [ ] Docs

## How to test

```sh
go test ./core/providers/bedrock/...
```

To validate end-to-end, configure a Bedrock key and send a request with a `gpt-oss` model (e.g. `gpt-oss-mini`). Verify the request is routed to `bedrock-mantle.{region}.api.aws/v1/chat/completions` and that both streaming and non-streaming responses are returned correctly.

For SigV4 auth, omit `key.Value` and ensure `BedrockKeyConfig` credentials or the default AWS credential chain (env vars, IAM role, instance profile) are available.

## Breaking changes

- [ ] Yes
- [x] No

## Related issues

## Security considerations

- SigV4 request signing is applied to Mantle requests when no Bearer token is present, using the same credential resolution path as standard Bedrock requests.
- When `BedrockKeyConfig` is `nil`, signing falls back to the default AWS credential chain, which may pick up ambient credentials (env vars, instance profile). This is intentional and consistent with existing Bedrock behavior.

## Checklist

- [ ] I read `docs/contributing/README.md` and followed the guidelines
- [ ] I added/updated tests where appropriate
- [ ] I updated documentation where needed
- [ ] I verified builds succeed (Go and UI)
- [ ] I verified the CI pipeline passes locally if applicable
@akshaydeo akshaydeo mentioned this pull request May 20, 2026
18 tasks
akshaydeo added a commit that referenced this pull request May 20, 2026
## Summary

This PR cuts the `v1.5.11` / `v1.3.11` release across core, framework, and all plugins, and introduces a new Claude skill (`release-checklist`) for pre-release migration safety auditing.

## Changes

- **`release-checklist` skill** — Adds `.claude/skills/release-checklist/SKILL.md`, a read-only pre-release audit tool that scans Go-defined database migrations changed in a release for high-scale deadlock/lock-contention risks and boot-time-blocking operations. It produces a structured `PASS`/`WARN`/`FAIL` report with a concrete remediation plan per finding. The skill is designed to grow via an extensible Checks Registry.
- **Version bumps** — `core` → `1.5.11`, `framework` → `1.3.11`, `transports` → `1.5.3`, `plugins/governance` → `1.5.11`, `plugins/logging` → `1.5.11`, `plugins/semanticcache` → `1.5.11`, `plugins/otel` → `1.2.11`, `plugins/maxim` → `1.6.11`, `plugins/prompts` → `1.0.11`, and remaining plugins bumped accordingly.
- **Changelogs populated** — All per-package changelogs updated with the full set of features and fixes shipping in this release.

Key highlights in this release:
- Temporary access tokens for scoped, time-limited API access
- MCP per-user OAuth flow refactor
- Bedrock Mantle inference engine support
- Azure Realtime provider with enriched session tracking
- Direct access control (DAC) and virtual key rotation
- Cluster-aware log metadata and per-node usage aggregation
- Feature flag framework
- Config-hash-based file value override of DB on restart
- Semantic cache plugin rewrite
- Numerous streaming stability, Bedrock, Anthropic, and Gemini fixes
- AWS SDK and dependency security updates

## Type of change

- [ ] Bug fix
- [ ] Feature
- [ ] Refactor
- [ ] Documentation
- [x] Chore/CI

## Affected areas

- [x] Core (Go)
- [x] Transports (HTTP)
- [x] Providers/Integrations
- [x] Plugins
- [x] UI (React)
- [ ] Docs

## How to test

```sh
# Verify version files reflect the new release
cat core/version          # expect 1.5.11
cat framework/version     # expect 1.3.11
cat transports/version    # expect 1.5.3

# Core/Transports
go test ./...
```

To exercise the new `release-checklist` skill, invoke it via Claude with:
```
/release-checklist origin/dev...HEAD
```
Expected output: a structured report with `PASS`/`WARN`/`FAIL` per check and a Remediation Plan table for any findings.

## Screenshots/Recordings

N/A

## Breaking changes

- [ ] Yes
- [x] No

## Related issues

#3603, #3565, #3489, #3334, #3335, #3435, #3554, #3590, #3444, #3198, #3581, #3610, #3599, #3567, #3382, #3461 and others listed in the changelogs.

## Security considerations

- AWS SDK and dependency security updates are included (#3461).
- `FullyRedacted()` for proxy passwords and `MarshalForStorage()` for `ProxyConfig` prevent partial secret leakage in API responses (#3445).
- The `release-checklist` skill is strictly read-only and never modifies files.

## Checklist

- [x] I read `docs/contributing/README.md` and followed the guidelines
- [x] I added/updated tests where appropriate
- [x] I updated documentation where needed
- [x] I verified builds succeed (Go and UI)
- [ ] I verified the CI pipeline passes locally if applicable
@akshaydeo akshaydeo mentioned this pull request May 20, 2026
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