Repository navigation
fix(desktop): enforce "Only models you provide" from AI Gateway - #5433
Merged
Merged
Conversation
Enforce allowCustomProviders and allowZenModel from the member's desktop policy while every other desktop policy key stays suspended. The server keeps the last verified policy per sign-in, reads it in the background, and never waits on Den, so loading or failing to load the policy never blocks startup, sign-in, or chat. With no known policy the desktop stays open. Signing out clears it. Engine sign-ins and sends are checked locally against the known policy, and the engine only lists the organization's providers, plus Zen when allowed. Orgs without the policy see no change.
Contributor
|
The latest updates on your projects. Learn more about Vercel for GitHub.
1 Skipped Deployment
|
Contributor
OpenWork evidence
Run details · Open the preview to inspect evidence and sandbox options. |
Sends are only read when the member's known policy limits providers, so members without the policy never pay for the check.
…roviders With the organization allowing only managed providers and Zen off, a member still sees the organization's Gateway model and gets an answer through the real Gateway on both engines. On v1 the engine allow-list holds only the Gateway provider.
Den's "Free starter model (Auto)" switch is stored as allowZenModel. On allows OpenWork's free Auto and OpenCode Zen, off blocks both, whether or not members may add their own providers. The app, server and engine read one shared list of those providers. The AI Gateway dialog now saves the switch in both modes, and both Den screens describe it the same way.
…cess The AI Gateway's "Who can use models" setting is stored in the default desktop policy. Name the enforcement after that setting so it stands on its own while every other desktop policy stays off, and rename the e2e specs to model-access-picker and model-access-gateway.
Free Auto is not on dev, so the free starter model switch covers OpenCode Zen only. Free Auto adds its provider to the same list in its own change. The Den models page keeps its original switch label.
The PR now prevents custom models when the AI Gateway is set to "Only models you provide" (allowCustomProviders: false) and nothing else. allowZenModel stays off with the old desktop policies, so OpenCode Zen is unchanged, and the Den screens are left as they are on dev.
reachjalil
added a commit
that referenced
this pull request
Oct 2, 2026
…xture Since #5433 installing an identity reads Den policy without waiting for it, so checking for that read right after the 204 raced and failed at random.
reachjalil
added a commit
that referenced
this pull request
Oct 2, 2026
…xture Since #5433 installing an identity reads Den policy without waiting for it, so checking for that read right after the 204 raced and failed at random.
reachjalil
added a commit
that referenced
this pull request
Oct 3, 2026
…xture Since #5433 installing an identity reads Den policy without waiting for it, so checking for that read right after the 204 raced and failed at random.
benjaminshafii
pushed a commit
that referenced
this pull request
Oct 3, 2026
* fix(app): restore AI Providers row layout and footer after the Auto picker Organization provider rows put the name and status at the far right because the provider icon became a separate child of a justify-between row. Group the icon with the text, move "Managed in Den" into the section title as a pill, drop the duplicate "AI Providers" heading by putting Connect a provider on the "On this device" header, keep the Connect a provider footer stacked so the organization line stops wrapping, and share one Auto meta line between Settings and the sheet. * feat(app): redesign AI Providers and Connect a provider to match the design Settings › AI Providers now follows the AI Providers design: the page header carries Connect a provider, both sections use one bordered list of rows (tile, name, status, monospace id and meta line), organization rows show who Den grants them to and whether the key is shared or per member, the sync footer sits inside the list, and signed-out members see a "No organization yet" card. Connect a provider gets a visible description, sentence-case groups with counts, one subtitle per provider that says how it connects, a single Connect action, a footer with the organization and keyboard hints, wrapping instead of truncated subtitles, and a capped height so long lists scroll inside it. Built-in OpenCode Zen without a key of its own is offered under Available to add instead of being listed as connected. The desktop now reads Den's provider access and credential mode, which the usable-provider list already returns. * test(evals): align first-send spec with the current chat chrome and failed-send recovery The mobile chrome probe looked for the sidebar toggle inside the session pane, but it renders in the chat column beside it, so the count was always zero and the overflow check could never fail. Scope both to the sidebar inset. Since #5167 a rejected first send stays in the conversation with Retry instead of moving the prompt back into the composer. Assert that: one user message, the inline error and Retry sending, no session and no model request. * test(evals): bring the first-send spec up to date with the current app The spec still described the app from before #5164, #5167 and #5196: - First send: since #5167 the sent message shows at once in a provisional conversation and stays there until the session exists. The slow-creation and handoff steps now assert that (one user message, no flicker, one creation and no prompt before release) instead of an unchanged hero with no user row. The transition sampler records the provisional conversation. - Mobile sidebar: Escape closes the Chat actions menu, then the sidebar; wait for each layer to finish closing instead of pressing twice at once. - Model picker: since #5196 it opens straight onto its searchable list; the "Model" drill-in is gone. On v2, Connect more providers falls back to Settings › AI Providers, so the spec continues from Connect a provider there and returns with Back to app. - While the first send is pending the dock is read-only, so the editor no longer keeps focus; its position is still checked. - The New task heading is "What do you need done?" again (#5483). * fix(chat): keep a new mobile turn at the top on OpenCode v2 On phones a sent message is pinned to the top of the transcript with space reserved for its answer. The controller tracked the turn by the ID the composer generated, but OpenCode v2 gives the message its own ID, so the optimistic row is replaced (or never rendered) and the turn was dropped: no space was reserved and the new turn sat below the top. When the tracked ID is not on screen, follow the newest user turn that was not already there when the message was sent. * test(evals): wait for the background Den policy read in the outage fixture Since #5433 installing an identity reads Den policy without waiting for it, so checking for that read right after the 204 raced and failed at random. * fix(app): drop status words from Connect a provider and capitalize its sections Connected providers show how they connect and no action; only providers not yet added offer Connect. OpenWork Models drops Included, Free, No account needed and the weekly limit line, here and in Settings. Section labels read ON THIS DEVICE and AVAILABLE TO ADD, as in the design. Evidence: evals/specs/connect-provider-dialog.e2e.test.ts * test(evals): record what the Connect a provider spec proves so the evidence report is complete * fix(app): keep the design's provider filter placeholder in Connect a provider The search field reads Filter providers by name or ID again (Model selector B2, D2), so the live provider spec needs no change. * test(evals): wait for the desktop header to return before checking it After resizing from phone to desktop the spec only waited for the shell height, then checked the header at once; the title can render a frame later. * test(evals): describe the visible Retry text in the failed-send screenshot claim The button reads 'Retry'; 'Retry sending' is its accessible label, which the role assertion above already checks. Signed-off-by: Benjamin Shafii <[email protected]> --------- Signed-off-by: Benjamin Shafii <[email protected]> Co-authored-by: ben <[email protected]>
This branch was successfully deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What is this about?
On the AI Gateway page in Den, Who can use models lets an admin pick Only models you provide, so members cannot add their own provider keys. This PR makes the desktop and web app respect that choice.
What problem does it solve?
Den saves the choice, but the app ignores it. Members can still add, pick and use their own API keys.
What was the situation before?
The choice is stored as
allowCustomProviders: falsein the organization's default desktop policy. #5131 switched off every desktop policy check, because loading them could block startup and chat, and that switched this off too.How is this implemented?
Only
allowCustomProvidersis enforced, as the AI Gateway's model access. The old desktop policies stay off, includingallowZenModel, so OpenCode Zen is left as it is today.lpr_,ipr_(AI Gateway) andopenworkmodels. Adding a personal provider shows the existing notice.enabled_providerslists only the allowed providers.It never blocks or slows anything:
Known gap: a change reaches the desktop at its next start or sign-in.
What else changed?
session-model-catalogcases expected Zen to be hidden. They now expect it unchanged, and the file passes (it fails on dev).Release note
When your organization chooses "Only models you provide" in AI Gateway, members can no longer add or use their own API keys in OpenWork.
Evidence
model-access-picker: on dev the member's own key shows, which fails. On this branch only the organization's model shows, which passes.model-access-gateway: with the setting on, a member still picks the organization's AI Gateway model and gets an answer through the real Gateway (v1 on this commit, v2 on an earlier one).