Repository navigation
fix(den-api): scope catalog providers' env names to the provider row - #4281
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
Test evidence — granted-cloud-providers-appear-automatically-in-settings-and-the-model-picker — 2/2 screenshots passed · 6 assertions✅ 2/2 screenshots passed · 6 assertions · 12 expectations passed · 0 failed · 0 pending
ℹ️ ASSERTION — 1. The granted provider connected without an import actionSettings state: {"connected":true,"importButton":false}
✅ PASS — 2. The Cloud providers page shows Automatic Team Models as Connected
ℹ️ ASSERTION — 3. The organization credential is stored only under OpenWork's env namespaceOPENWORK_AUTO_IMPORT_PROVIDER_API_KEY holds the organization credential; bare AUTO_IMPORT_PROVIDER_API_KEY is absent.
ℹ️ ASSERTION — 4. The server-side sync settled with the provider materializedlastRun: applied; reloadPending: false; skipped: []
ℹ️ ASSERTION — 5. The organization model reaches the picker within 3 Sync now refreshesThe model was in the picker on the first read after import.
ℹ️ ASSERTION — 6. The automatically imported provider contributes exactly its assigned modelSelectable models: [{"id":"automatic-proof-model","name":"Automatic Proof Model","providerName":"Automatic Team Models","selected":true,"selectable":true}]; models offered under Automatic Team Models: ["automatic-proof-model"]
✅ PASS — 7. The open Models picker shows automatic-proof-model from the organization provider
ℹ️ ASSERTION — 8. A bare key the member set with a different value survives the next syncAfter a applied sync, AUTO_IMPORT_PROVIDER_API_KEY still holds the member's value and OPENWORK_AUTO_IMPORT_PROVIDER_API_KEY still holds the organization credential.
Test run created 2026-09-01T22:20:26.522Z · Source: |
There was a problem hiding this comment.
Warden security clearance: clear. No blocking findings (security or desktop↔den sync) in this diff (68d4a9a99a56c191810d5a84b238de51df2f540f). Automated clearance satisfies the required-review gate only — a human still reviews and merges. Analysis run
There was a problem hiding this comment.
Warden security clearance: clear. No blocking findings (security or desktop↔den sync) in this diff (5bf9cc61e31ae635b81eb649e0c9d9127ea80ae7). Automated clearance satisfies the required-review gate only — a human still reviews and merges. Analysis run
5bf9cc6 to
1ac2de8
Compare
1ac2de8 to
be5e3b5
Compare
There was a problem hiding this comment.
Warden security clearance: clear. No blocking findings (security or desktop↔den sync) in this diff (be5e3b58e8b3035d81f038d205cbc045e8cb81c3). Automated clearance satisfies the required-review gate only — a human still reviews and merges. Analysis run
Den provider rows created from the models.dev catalog declare their credential env name straight from the catalog (OPENAI_API_KEY, ANTHROPIC_API_KEY, ...). OpenWork materialized the organization credential under that exact name on members' machines and cloud workers. The desktop shell injects the user env store into the engine, and OpenCode treats a well-known env name as global provider config, so one organization OpenAI provider switched on OpenCode's whole built-in OpenAI catalog next to the scoped lpr_* provider, shadowed any OPENAI_API_KEY the member had set themselves, and two rows for the same vendor shared one credential slot. Catalog providers now leave Den under a provider-scoped name: `LPR_<last five characters of the row id>_<declared name>`, e.g. `LPR_120JV_OPENAI_API_KEY`. The rename is applied where a provider leaves Den (the connect payload every desktop consumes and the cloud worker materializer), so every consumer picks it up without changes. - The name is a pure function of the row id: nothing is stored, no migration runs, re-syncs are idempotent, and reverting this commit simply returns the bare names on the next sync. - Only `source: "models_dev"` rows are affected. Custom providers keep exactly the env names their organization declared, and the hosted OpenWork provider keeps OPENWORK_API_KEY. - The tag is a prefix, so credential-shaped suffixes (`_API_KEY`, `_ACCESS_KEY_ID`) still drive primary-credential selection for multi-env providers such as Azure. - Provider responses gain an additive `runtimeEnvKeys` list; the Den editor shows the exact names members' machines read, and the desktop provider list prefers them when present.
be5e3b5 to
f71f056
Compare
There was a problem hiding this comment.
Warden security clearance: clear. No blocking findings (security or desktop↔den sync) in this diff (f71f056008924e00847e48ab9c0781c1246c16a0). Automated clearance satisfies the required-review gate only — a human still reviews and merges. Analysis run
…env names (#5730) 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]>
…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]>
Problem
Den provider rows created from the models.dev catalog declare their credential env name straight from the catalog (
OPENAI_API_KEY,ANTHROPIC_API_KEY, …). OpenWork materialized the organization credential under that exact name on members' machines and cloud workers. The desktop shell injects the user env store into the engine, and OpenCode treats a well-known env name as global provider config, so:lpr_*provider;OPENAI_API_KEYthe member had set themselves;The change
Catalog providers now leave Den under a provider-scoped env name:
sourcemodels_dev(catalog)LPR_120JV_OPENAI_API_KEYcustomopenwork(hosted)OPENWORK_API_KEYThe rename happens in one place, where a provider leaves Den: the
/connectpayload every desktop consumes (providerConfig.envand theapiKeysmap) and the cloud-worker materializer. Desktop server, desktop app, and worker consumers need no logic changes; they use the names they are given.Why this shape
noop), and reverting this PR returns bare names on the next sync. Existing catalog rows move to the scoped name on their next sync through the same owned-key cleanup that already handles env changes._API_KEY/_ACCESS_KEY_IDsuffix (three copies: den-api, desktop server, desktop app). A prefix keeps Azure'sLPR_…_AZURE_API_KEYranked aboveLPR_…_AZURE_RESOURCE_NAMEwithout touching any of them.runtimeEnvKeyslist. The Den editor shows the exact names members' machines read under the credential fields; the desktop provider list prefers them when present and falls back for older Den servers.Proof
pnpm evals:pr specs/cloud-provider-env-namespacing.test.ts— app-less spec: a catalog row and a custom row go through den-api's transform and the desktopCloudProviderSync; asserts the scoped name in the provider block and env store, the custom name untouched, the member's ownOPENAI_API_KEYnever overwritten, the engine still receiving the org credential via/auth, a repeat sync asnoop, and sign-out removing only what OpenWork wrote.bun test test/provider-credentials.test.ts test/cloud-provider-materialization.test.tsinee/apps/den-api— 54 pass, including a new custom-provider case and the pure-function rule (determinism, ranking, no mutation of the stored input).pnpm evals:pr specs/spec-impact.test.ts,tscforee/apps/den-api,ee/apps/den-web,apps/app— green.Known edge
A catalog provider with no credential stored in Den, satisfied today by a member's locally saved bare
OPENAI_API_KEY, now looks forLPR_…_OPENAI_API_KEYinstead. The Den editor and desktop provider list show that exact name. This is the intended single rule (catalog → scoped, always) rather than a value-dependent exception.