Repository navigation
🔓 fix: Keep owner as the Default Mode for API Key Runs - #18448
Open
danny-avila wants to merge 1 commit into
Open
danny-avila wants to merge 1 commit into
danny-avila wants to merge 1 commit into
Conversation
#18377 made `delegated` the default of endpoints.agents.remoteApi.integrations.mode, so on upgrade a run started with a personal API key lost its MCP tools until the operator declared servers and the key's owner granted them. That is a surprise for deployments that never asked for grants. The default is `owner` again: a key run uses the MCP servers its owner can, as before grants existed. `delegated` stays available as an opt-in. The config loader's warning now fires only for an operator who sets `delegated` and declares no server to grant.
This branch has not been 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.
Summary
#18377 made
delegatedthe default ofendpoints.agents.remoteApi.integrations.mode. On upgrade, a run started with a personal API key had every MCP tool call refused until the operator declared the servers keys may be granted and the key's owner granted them. A deployment that never asked for grants would see its API integrations stop using MCP tools with nothing in the response to say why.This PR makes
ownerthe default again. A key run uses the MCP servers its owner can, as before grants existed.delegatedis unchanged and stays available as an opt-in: set the mode, declareintegrations.resources, and owners grant their keys in Settings → API Keys.The config loader's warning from #18377 is kept for the case it still describes: an operator who sets
delegatedand declares no server, which leaves key runs with nothing an owner can grant.Related to #18377, #18280, #13824.
How it works
export function resolveRemoteIntegrations(appConfig?: AppConfig): RemoteIntegrations { const integrations = appConfig?.endpoints?.[EModelEndpoint.agents]?.remoteApi?.integrations; return { - mode: integrations?.mode ?? 'delegated', + mode: integrations?.mode ?? 'owner',Everything that reads the mode goes through
resolveRemoteIntegrations: the grant step on each remote request, the consent service's limits for keys, and the flag onGET /api/api-keysthat shows the "MCP access" button. With the mode unset, none of them does anything.Type of change
Testing
Tested environments/configuration: WSL2, Node.js 24. No external services.
Automated tests:
packages/api/src/apiKeys/grants.spec.ts: with nointegrationsblock, an empty one, ormode: owner, a key run is unrestricted and the view offers nothing; underdelegatedthe existing grant tests apply.packages/api/src/apiKeys/handlers.spec.ts,api/server/routes/__tests__/apiKeys.spec.js: the key list carriesgrants: trueonly underdelegated.api/server/services/ApiKeys/grants.spec.js: the real wiring leaves a key run untouched when the configuration says nothing.packages/api/src/app/loader.spec.ts: the warning fires fordelegatedwith no declared server; it does not fordelegatedwith servers, forowner, for a configuration that uses the remote API and leaves the mode alone, or for one that does not mention the remote API.Putting the default back to
delegated, or the warning's old condition, fails tests.npx tsc --noEmitis clean inpackages/apiandpackages/data-provider.Performance
With the mode unset, a key request no longer reads the key's grant at run start, and MCP tool calls skip the grant check, as before #18377. Nothing is added.
Risk / compatibility
A deployment that upgraded to a build with #18377 and relied on the
delegateddefault goes back to unrestricted key runs unless it setsmode: delegated. Grants already made stay stored on the keys and apply again once the mode is set.No stored-data change.