Repository navigation
🪪 feat: Authorize a Schedule in the Same Step That Creates It - #18489
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
Where consent is on, a new schedule was created unauthorized and stayed exempt until its owner edited it or the operator's deadline passed. The create form now asks what the schedule may use, from the offer for its agent, and the schedule is created with its grant in one write. A schedule created without a choice is marked as needing authorization from the start. The grant dialog's tool list and choice are split out so the form shows the same thing.
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 new schedule was created with no authorization. It ran with every tool its agent has until its owner edited it or the operator'srequireAfterdate passed (#18274), so turning consent on did nothing for schedules created afterwards.After this change a schedule is authorized in the same step that creates it.
Where consent is off, the form and the create request are unchanged.
Stacked on #18486. Related to #18274, #13824.
How it works
The owner's choice is part of the create intent: a retry with the same
clientRequestIdmust repeat it, and a request that omits the field digests exactly as before.Type of change
Testing
Tested environments/configuration: WSL2, Node.js 24. No external services.
Automated tests:
packages/api/src/schedules/authorization/service.spec.ts(a schedule that is authorized as it is created): the draft offer reads no stored schedule and its digest holds for the id the schedule is then given, and differs for another agent; the grant is built for the new schedule with its own lifetime and nothing is stored; a changed offer, nothing allowed, a tool not on offer, and a lifetime past the limit are refused; asking first is refused where a run cannot pause; an owner who may not use the agent gets no offer.packages/api/src/schedules/handlers.spec.ts: the grant is written in the same insert, for the id about to exist, and the choice is not stored as a field; no choice marks the schedule as needing authorization; a refused choice inserts nothing and reports its code; with consent off the choice is ignored and nothing is marked; the choice is part of the create intent and its absence leaves older retries matching.api/server/services/Schedules/consent.spec.js(new): loads the real wiring; the offer handler exists, answers 404 without an agent and 403 for an owner whose role may not use schedules.client/src/components/SidePanel/Schedules/__tests__/ScheduleDialog.spec.tsx: with consent off nothing is asked or sent; with it on the section appears for the picked agent, Create is disabled until something is ticked, and the payload carries the choice; picking another agent starts over, including for a tool both agents share; an agent with nothing to allow creates as before; a failed offer is said, can be retried, and does not block creating.client/src/components/SidePanel/Schedules/__tests__/Consent.spec.tsx,KeyGrant.spec.tsx(existing): unchanged and passing against the split dialog.Eight mutations (the required mark, stripping the choice from the stored fields, the create-intent digest, the offer digest check, the digest's subject, the form's submit condition, the payload, and the per-agent reset) 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 of the form section yet.
Performance
Opening the create form with consent on makes one extra request once an agent is picked: the offer, which walks the agent graph once. Creating a schedule with a choice resolves that offer once more on the server (one owner read, one configuration read, one graph walk) before the insert; creating without one adds nothing. Nothing is added to a run. I did not measure latency before and after.
Risk / compatibility
With consent on, every schedule created from now on is either authorized or held. A client that creates schedules without the new field gets schedules whose tools are refused until the owner authorizes them. Before, such schedules ran unrestricted until edited.
The form does not block creating when the offer cannot be loaded. The schedule is then created as needing authorization, and the form says so.
The create response does not distinguish "created and authorized" from "created, needs authorization". The schedule's card shows the latter.
Schedule consent is off by default.