Skip to content

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

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

OmarMcAdam merged 1 commit into
devfrom
bedrock-issue-5705-v2

Conversation

@OmarMcAdam

Copy link
Copy Markdown
Member

Fixes #5705. Reapplies #5730, which was reverted in #5732 because its test failed the spec-boundary ratchet.

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 lists the env name → SDK option pairs that the bundled AI SDKs read.
  • runtimeProviderSdkOptions() in provider-credentials.ts binds each delivered scoped name as {env:LPR_…}, so secrets stay out of the config file. Desktop gets the bindings through toRuntimeProviderEnv(), and worker materialization reuses it.
  • bedrockCredentialError() rejects a changed Bedrock credential without a valid AWS_REGION (invalid_api_keys).

What else changed?

  • The Unit tests job in ci-tests.yml now runs the new test scripts of @openwork-ee/utils and @openwork-ee/den-api, using the pinned OpenCode on PATH.

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

No E2E. These are unit tests, run in the Unit tests job against the pinned OpenCode binary:

  • ee/apps/den-api/test/provider-credentials.test.ts, before → after: a Bedrock provider with only scoped env names never reaches Bedrock → it arrives SigV4-signed for its own key and region, or with its own bearer token.
  • ee/packages/utils/src/ai-sdk-env-settings.test.ts: the env → option list must equal the pairs extracted from that binary.

…env names

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]>
@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 10:03pm UTC
openwork-den Ready Ready Preview Oct 6, 2026 10:03pm UTC
openwork-diagnostics Ready Ready Preview Oct 6, 2026 10:03pm UTC
openwork-landing Ready Ready Preview, v0 Oct 6, 2026 10:03pm UTC

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

github-actions Bot commented Oct 6, 2026 •

Copy link
Copy Markdown
Contributor

OpenWork evidence

Status Commit Preview Updated
🟢 Ready · evidence passed e25f6be Open preview 2026-10-06 22:07:25 UTC

Run details · Open the preview to inspect evidence and sandbox options.

@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 e25f6be80fb30e8d451144d528164a4156cf118e 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 e25f6be80fb3 · Warden run · Updates after every Warden run.

This branch was successfully deployed

5 active and 1 inactive deployments
Evidence / PR 5733 — e25f6be8 Deployed Oct 6, 2026 by github-actions[bot]
Preview – openwork-landing — e25f6be8 Deployed Oct 6, 2026 by vercel[bot]
Preview – openwork-app — e25f6be8 Deployed Oct 6, 2026 by vercel[bot]
Preview – openwork-den — e25f6be8 Deployed Oct 6, 2026 by vercel[bot]
Preview – openwork-diagnostics — e25f6be8 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

1 participant