Skip to content

fix(den-api): pass BYOK provider settings to the AI SDK - #5730

Merged
OmarMcAdam merged 1 commit into
devfrom
bedrock-issue-5705
Oct 6, 2026
Merged

OmarMcAdam merged 1 commit into
devfrom
bedrock-issue-5705

Conversation

@OmarMcAdam

Copy link
Copy Markdown
Member

Fixes #5705

What is this about?

Bring-your-own-key catalog providers with several settings, such as Amazon Bedrock, now get their region and credentials on desktop and cloud workers.

What problem does it solve?

Every chat with a BYOK Amazon Bedrock model failed, even with a valid region saved.

What was the situation before?

Den delivers these settings under provider-scoped names (LPR_<tag>_AWS_REGION). The AI SDK only reads the bare names (AWS_REGION), so every request failed with "AWS region setting is missing".

How is this implemented?

  • @openwork-ee/utils/ai-sdk-env-settings: the env name → SDK option pairs the bundled AI SDKs read (AWS_REGION → region, …).
  • runtimeProviderSdkOptions() in provider-credentials.ts binds each delivered scoped name of a multi-env catalog provider as {env:LPR_…}. OpenCode resolves that when it loads the config, so secrets stay out of the config file. toRuntimeProviderEnv() applies it for desktop, and worker materialization reuses it.
  • Saving a changed Bedrock credential without a valid AWS_REGION now returns invalid_api_keys.

What else changed?

none

Release note

Amazon Bedrock providers added under Bring your own keys now work in chat instead of failing with "AWS region setting is missing".

Evidence

evals/specs/byok-provider-sdk-settings.test.ts, against the pinned OpenCode binary:

  • Wire test, before → after: a Bedrock provider with only scoped env names never reaches Bedrock → its request arrives SigV4-signed for its own key and region, or with its own bearer token.
  • Drift test: the env → option list must equal the pairs extracted from that binary.

…env names

Catalog providers leave Den under provider-scoped env names
(LPR_<tag>_AWS_REGION) since #4281. OpenCode hands a provider's credential
to its SDK only when the provider declares a single env name, so for
multi-env providers such as Amazon Bedrock the SDK fell back to the bare
names (AWS_REGION, AWS_ACCESS_KEY_ID, ...), which no longer exist. Every
chat failed with "AWS region setting is missing".

Den now binds each delivered env name that a bundled SDK reads to that
SDK option as an {env:RUNTIME_NAME} reference, for desktop connect
payloads and cloud workers alike. The env -> option list lives in
@openwork-ee/utils/ai-sdk-env-settings and a spec checks it against the
pairs extracted from the pinned OpenCode binary.

Saving a changed Bedrock credential without a valid AWS_REGION is now
rejected instead of failing on every request.

Fixes #5705

Signed-off-by: Omar McAdam <[email protected]>
@OmarMcAdam
OmarMcAdam enabled auto-merge (squash) October 6, 2026 21:43
@vercel

vercel Bot commented Oct 6, 2026 •

Copy link
Copy Markdown
Contributor

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated
openwork-app Ready Ready Preview Oct 6, 2026 9:45pm UTC
openwork-den Ready Ready Preview Oct 6, 2026 9:45pm UTC
openwork-diagnostics Ready Ready Preview Oct 6, 2026 9:45pm UTC
openwork-landing Ready Ready Preview, v0 Oct 6, 2026 9:45pm UTC

@OmarMcAdam
OmarMcAdam temporarily deployed to pr-internal-specs October 6, 2026 21:44 — with GitHub Actions Inactive
@github-actions

github-actions Bot commented Oct 6, 2026 •

Copy link
Copy Markdown
Contributor

OpenWork evidence

Status Commit Preview Updated
🟡 Updating evidence 6e57299 View run 2026-10-06 21:45:00 UTC

A preview for this commit is being prepared.

@diff-warden diff-warden 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.

Warden clearance. Complete security and confidentiality review of 6e57299d0adc36f83896efe9f8d00116b98958a7 found no high or medium security findings and no confidentiality findings. Any new push dismisses this approval. Analysis run

@diff-warden

diff-warden Bot commented Oct 6, 2026

Copy link
Copy Markdown
Contributor

Warden: approved

No high or medium security findings and no confidentiality findings.

Reviewed 6e57299d0adc · Warden run · Updates after every Warden run.

@OmarMcAdam
OmarMcAdam merged commit f7f2e09 into dev Oct 6, 2026
27 of 30 checks passed
OmarMcAdam added a commit that referenced this pull request Oct 6, 2026
…env names (#5733)

Reapplies #5730 (reverted in #5732) with its tests moved out of
evals/specs, where the spec-boundary ratchet rejects unit tests.

Catalog providers leave Den under provider-scoped env names
(LPR_<tag>_AWS_REGION) since #4281. OpenCode hands a provider's credential
to its SDK only when the provider declares a single env name, so for
multi-env providers such as Amazon Bedrock the SDK fell back to the bare
names (AWS_REGION, AWS_ACCESS_KEY_ID, ...), which no longer exist. Every
chat failed with "AWS region setting is missing".

Den now binds each delivered env name that a bundled SDK reads to that
SDK option as an {env:RUNTIME_NAME} reference, for desktop connect
payloads and cloud workers alike. The env -> option list lives in
@openwork-ee/utils/ai-sdk-env-settings.

Saving a changed Bedrock credential without a valid AWS_REGION is now
rejected instead of failing on every request.

Tests are colocated and run in the Unit tests job against the pinned
OpenCode on PATH: a drift test compares the list with the pairs extracted
from that binary, and a wire test proves scoped-only Bedrock credentials
reach the provider with their own region and keys.

Fixes #5705

Signed-off-by: Omar McAdam <[email protected]>
@raul-gherman-modaoperandi

raul-gherman-modaoperandi commented Oct 12, 2026 •

Copy link
Copy Markdown

@OmarMcAdam please see #5705 as per my last comment, it is not fixed, regardless of: deploy-from-scratch, combos of models (global, us, gymnastics...)

This branch was successfully deployed

4 active and 1 inactive deployments
Preview – openwork-landing — 6e57299d Deployed Oct 6, 2026 by vercel[bot]
Preview – openwork-den — 6e57299d Deployed Oct 6, 2026 by vercel[bot]
Preview – openwork-app — 6e57299d Deployed Oct 6, 2026 by vercel[bot]
Preview – openwork-diagnostics — 6e57299d Deployed Oct 6, 2026 by vercel[bot]
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.

[Bug]: Bring-Your-Own-Key Amazon Bedrock providers fail with "AWS region setting is missing" for every model, even with a correctly configured region

2 participants