Repository navigation
🧰 feat: Let a Schedule's Owner Authorize Each of the Agent's Tools, or Everything at Once - #18465
Draft
danny-avila wants to merge 2 commits into
Draft
danny-avila wants to merge 2 commits into
danny-avila wants to merge 2 commits into
Conversation
…r Everything at Once A schedule's grant could only be offered for an agent whose tools were all MCP tools. An agent that also had code execution, web search, file search or an action could not be authorized at all, and once its owner edited the schedule or the operator's deadline passed its MCP tools stayed refused with no way out. Each of an agent's other tools is now its own item in the offer, allowed or left out like an MCP tool. The grant stores the ones the owner allowed, per agent. Under a grant, one the owner left out is not loaded for the run and does not stop it; one the owner allowed loads and runs, with the code environment's tools all allowed by code execution. The dialog lists them in their own group and gains one control that allows every server and tool at once. An API key's grant still limits MCP tools only.
…cation An MCP call is checked against the stored grant when it is made. The agents' other tools have no such call, so a grant that had expired or been revoked still loaded and allowed them. The run now holds them to the grant it read when it started: none loads from a revoked grant, and they stop at the grant's deadline.
1 task done
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
With
interface.schedules.mcpConsent.enabledon, a schedule's owner authorizes the tools it may use while they are away. That authorization could only be offered for an agent whose tools were all MCP tools. An agent that also had code execution, web search, file search or an action could not be authorized at all: the offer failed, and a run of a schedule that had a grant was refused outright if its agent gained such a tool. Once the owner edited such a schedule, or the operator's deadline passed (#18274), its MCP tools stayed refused with nothing the owner could do.After this change each of an agent's other tools is its own item in the offer, allowed or left out exactly like an MCP tool, and the dialog has one control that allows every server and tool at once.
A grant still needs at least one MCP tool. A schedule whose agents use no MCP server has nothing to authorize and runs as before. An API key's grant (#18280) is unchanged and limits MCP tools only.
Related to #18260, #18274, #13824.
How it works
What counts as an item is the agent's own tool list: code execution, web search, file search, each action by its key, and any other tool the agent carries. The SDK's own controls (subagent, tool search, ask-user-question, handoffs) are not items and always load.
A grant made before this change lists none of these tools, so under it none of them loads until the owner confirms again. Such a grant could only have been made for an agent that had no such tools.
Type of change
Testing
Tested environments/configuration: WSL2, Node.js 24. Storage tests run against
mongodb-memory-server. No external services.Automated tests:
packages/api/src/schedules/authorization/enrollment.spec.ts: an agent with other tools is offered a grant; each tool is listed per agent, the SDK controls are not; both halves of the offer come from one walk; a grant that limits MCP tools only offers none.packages/api/src/schedules/authorization/service.spec.ts(the agents' tools that are not MCP tools): offered once each with nothing allowed at first; stored for every agent that has them; nothing stored when none is allowed; a tool not on offer is rejected without writing; a confirmation that does not say keeps the stored choice for tools still on offer; a confirmation is bound to the tools the owner was shown.packages/api/src/schedules/authorization/execution.spec.ts: under a grant a run loads the MCP tools and the other tools the owner allowed, per agent, and the SDK controls; none of the other tools when none was allowed; all of them under a grant that limits MCP tools only; the run hook allows an allowed tool, allows the code environment's tools only with code execution, and refuses a tool the owner left out or was never offered; once the grant has run out or been revoked the other tools neither load nor are allowed.packages/api/src/schedules/authorization/runtime.spec.ts: a run is not refused because its agent has other tools; one that selects no MCP tool still is.packages/api/src/agents/__tests__/initialize.test.ts: the initializer asks the loader only for the tools the owner allowed, MCP or not.packages/data-provider/src/types/scheduleConsent.spec.ts,packages/data-schemas/src/methods/scheduleConsent.spec.ts: the request and stored shapes; a grant without the field reads as before; the choice survives revocation.client/src/components/SidePanel/Schedules/__tests__/Consent.spec.tsx: each other tool is its own box, named for built-in tools and shown by key otherwise; only ticked ones are sent; "Allow everything" ticks and sends every server, tool and other tool; the stored choice pre-fills, and is named when there is nothing to confirm.Eleven mutations (the load filter, the deadline and revocation check, the hook, the code-tool rule, the offer check, the carry-over, the digest, the MCP-only option, the readiness check, and the two dialog behaviours) each fail a test.
npx tsc --noEmitis clean inpackages/api,packages/data-schemas,packages/data-providerandclient.Not verified: in a browser, or against a running server. There are no screenshots yet of the new group and button.
Performance
Reading the consent view resolves the offer once: the MCP half and the other-tools half share one walk of the agent graph, one owner read and one configuration read. Confirming adds nothing. During a run the grant's other tools are a per-agent set built when the grant is attached, so loading and each tool call add set lookups only. No database or network call is added to a run. I did not measure latency before and after.
Risk / compatibility
Under a grant, an agent's other tools now load only if the owner allowed them. Before, an agent with such tools could not hold a grant, so no working schedule loses a tool it was using.
Revoking during a run stops the other tools from the next run, not at once. An MCP call is checked against the stored grant when it is made; the other tools have no such check, so a run holds them to the grant it read when it started. They stop at the grant's deadline, and a grant already revoked or expired when the run starts allows none.
A run is no longer refused because its agent gained another tool after the grant was made. The tool is left out until the owner confirms again.
Not items yet: tools that do not come from the agent's tool list, such as skills and memory. Under a grant they are still refused with
tool_policy_denied, as before.An "all tools on this server" selection and stdio servers still cannot be authorized, as before.
Mixed versions: the stored grant gains one optional field and the stored schema is strict, so a replica without this change reads a grant that lists other tools as incompatible and refuses its runs, as for the earlier consent fields.
Schedule consent is off by default.