Repository navigation
🗓️ feat: Let Any Schedule Be Authorized, With or Without an MCP Server - #18486
Draft
danny-avila wants to merge 1 commit into
Draft
danny-avila wants to merge 1 commit into
danny-avila wants to merge 1 commit into
Conversation
A grant needed at least one MCP tool, so a schedule whose agents use no MCP server, or none the operator declared, had nothing to authorize and its other tools were never gated. A grant can now allow the agents' other tools alone. It has no consent to carry a deadline, so every grant stores its own lifetime; one made before that is read from its consents. A schedule that needs a grant it does not have was refused its MCP calls only. Every tool call is now refused with the same reason until the owner confirms.
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
A schedule's authorization (#18260, #18465) had to allow at least one MCP tool. A schedule whose agents use no MCP server, or none the operator declared, had nothing to authorize: its dialog said "unsupported", and its code execution, web search and actions ran unattended with no owner decision behind them. A schedule that needed an authorization it did not have (#18274) was refused its MCP calls only; its other tools kept running.
After this change any schedule can be authorized, and one that needs an authorization it lacks is refused every tool until the owner confirms.
consent_missing: an MCP call where it is made, any other tool at the run's hook. The run still starts and answers without its tools.Stacked on #18465. Related to #18274, #13824.
How it works
needsGrantis the question #18274 already asks at the first MCP call ("does this schedule need a grant it does not have"), now also asked at the first call of any other tool, once per run. A lookup that fails refuses the call withdependency_unavailable.The tools of a schedule held this way still load, and the refusal happens at the call. That keeps the refusal recorded on the run, so the schedule shows that it needs authorization; dropping the tools at load would leave the owner with worse answers and no explanation.
Type of change
Testing
Tested environments/configuration: WSL2, Node.js 24. Storage tests run against
mongodb-memory-server. No external services.Automated tests:
packages/data-provider/src/types/scheduleConsent.spec.ts: a request that allows only other tools; nothing allowed is rejected; a stored grant with no consents needs a tool and its own deadline;grantLifetimefor a grant with its own lifetime and for one read from its consents.packages/data-schemas/src/methods/scheduleConsent.spec.ts: a grant with no MCP server is refused without its own deadline, not written once past it, stored and read back, and revoked on the grant itself.packages/api/src/schedules/authorization/service.spec.ts: a schedule with no MCP server is offered, granted, expires and is revoked by the grant's own lifetime; a grant that allows nothing is rejected, and one of either kind is enough.packages/api/src/schedules/authorization/enrollment.spec.ts: other tools are offered where no MCP server is declared; a grant that limits MCP tools only offers nothing there and walks no graph.packages/api/src/schedules/authorization/execution.spec.ts: with no grant and one required, a non-MCP tool is refused withconsent_missing, an MCP call and the SDK controls are left to their own checks, the lookup happens once, a failed lookup refuses without leaking the error, and a grant that limits MCP tools only never holds other tools back; a grant with no MCP server loads its other tools until its own deadline.packages/api/src/schedules/authorization/runtime.spec.ts: a granted run that selects no MCP tool has nothing to make ready and connects to nothing.client/src/components/SidePanel/Schedules/__tests__/Consent.spec.tsx: with no MCP server on offer, confirm is disabled until a tool is ticked, and sendsallow: {}with the tools.Eight mutations (the stored lifetime, the offer condition, the nothing-allowed check, the held-run refusal, the undeclared-server offer, the readiness check, the storage revocation and the dialog's count) 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.
Performance
A never-authorized scheduled run now asks whether it needs a grant at its first call of any tool, where before it asked only at its first MCP call: one read of the schedule's grant and one resolution of the consent limits, once per run, and not at all for a run that calls no tool. Runs under a grant pay nothing new. Reading the consent view for a deployment with no declared MCP server now walks the agent graph once to list the other tools, where it used to return early. I did not measure latency before and after.
Risk / compatibility
With consent on, an unauthorized schedule that becomes "required" now loses every tool, not only MCP. That happens when its owner edits it, or when the operator's
requireAfterdate passes. Schedules with no MCP tools were untouched by both before; after this they stop using code execution, web search and actions until the owner authorizes them. Operators who setrequireAftershould expect that.Mixed versions: a grant with no MCP server, or with the new lifetime fields, is unreadable to a replica without this change, which refuses its runs. A grant written by an older replica has no lifetime of its own and is read from its consents.
New schedules are still not authorized at creation. That is the next change.
Schedule consent is off by default.