From 216aae5a141ccfc2d29d3a177ee91d454d0ef64a Mon Sep 17 00:00:00 2001
From: Danny Avila
Date: Thu, 19 Nov 2026 13:19:57 -0500
Subject: [PATCH] =?UTF-8?q?=F0=9F=94=95=20feat:=20Let=20an=20Owner=20Stop?=
=?UTF-8?q?=20Per-Use=20Approval=20Under=20a=20Whole-Agent=20Authorization?=
=?UTF-8?q?=20(#18534)?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
With the whole agent ticked the dialog only named the tools a schedule still asked
about. For a server its agents select as a whole there is no tool box to untick, so
the owner had no way to stop it short of revoking. The note is now a checkbox.
---
client/src/components/MCP/GrantTools.tsx | 47 +++++++++++++++----
.../Schedules/__tests__/Consent.spec.tsx | 23 ++++++++-
client/src/locales/en/translation.json | 2 +-
3 files changed, 62 insertions(+), 10 deletions(-)
diff --git a/client/src/components/MCP/GrantTools.tsx b/client/src/components/MCP/GrantTools.tsx
index 36c3454f33..98a9722971 100644
--- a/client/src/components/MCP/GrantTools.tsx
+++ b/client/src/components/MCP/GrantTools.tsx
@@ -95,11 +95,17 @@ export interface GrantChoice {
standing: boolean;
/** The whole agent is chosen: nothing is ticked one by one, and nothing added later is left out. */
everything: boolean;
+ /**
+ * Under the whole agent: the tools the stored grant asks about stay asked about. Unticked,
+ * the confirmation says so, and they run unattended.
+ */
+ keepsAsking: boolean;
/** Something is allowed, so there is a grant to confirm. */
some: boolean;
/** What a confirmation sends for this choice. */
request: Pick;
setEverything: (everything: boolean) => void;
+ setKeepsAsking: (keeps: boolean) => void;
setTools: (serverName: string, tools: string[]) => void;
setAsking: (serverName: string, tools: string[]) => void;
setOther: (tools: string[]) => void;
@@ -156,6 +162,13 @@ export function useGrantChoice(data: ScheduleMCPConsentView | undefined): GrantC
standing &&
((editedWhole?.revision === data?.revision ? editedWhole?.value : undefined) ??
(data?.revision == null ? true : data.everything));
+ /** Null until the owner changes it, with the grant it was changed against. */
+ const [editedKeeps, setEditedKeeps] = useState<{
+ revision: string | null;
+ value: boolean;
+ } | null>(null);
+ const keepsAsking =
+ (editedKeeps?.revision === data?.revision ? editedKeeps?.value : undefined) ?? true;
/** A grant allows something: an MCP tool, or one of the other tools. */
const chosenCount =
Object.values(choice).reduce((count, tools) => count + tools.length, 0) + other.length;
@@ -202,17 +215,23 @@ export function useGrantChoice(data: ScheduleMCPConsentView | undefined): GrantC
count: chosenCount,
standing,
everything,
+ keepsAsking,
some: everything || chosenCount > 0,
- // The whole agent names nothing. Otherwise `ask` and `tools` are always sent: left out,
- // the server would keep what the stored grant asks about and the other tools it allows.
- request: everything ? { allow: {}, everything: true } : { allow: choice, ask, tools: other },
+ // The whole agent names nothing, and says nothing about asking unless the owner stops it:
+ // left out, the server keeps what the stored grant asks about. Otherwise `ask` and `tools`
+ // are always sent, since left out the server would keep the stored grant's choice of both.
+ request: everything
+ ? { allow: {}, everything: true, ...(!keepsAsking && { ask: {} }) }
+ : { allow: choice, ask, tools: other },
setEverything: (value: boolean) => setEditedWhole({ revision: data?.revision ?? null, value }),
+ setKeepsAsking: (value: boolean) => setEditedKeeps({ revision: data?.revision ?? null, value }),
setTools,
setAsking,
setOther,
allowEverything,
reset: () => {
setEditedWhole(null);
+ setEditedKeeps(null);
setEdited(null);
setEditedAsking(null);
setEditedOther(null);
@@ -239,10 +258,13 @@ export default function GrantTools({
const noteId = useId();
const otherId = useId();
const wholeId = useId();
+ const keepId = useId();
const {
standing,
everything,
setEverything,
+ keepsAsking,
+ setKeepsAsking,
choice,
ask,
asking,
@@ -285,11 +307,20 @@ export default function GrantTools({
{localize('com_ui_schedule_consent_everything_note')}
)}
diff --git a/client/src/components/SidePanel/Schedules/__tests__/Consent.spec.tsx b/client/src/components/SidePanel/Schedules/__tests__/Consent.spec.tsx
index 81a4ab486b..022f64aafe 100644
--- a/client/src/components/SidePanel/Schedules/__tests__/Consent.spec.tsx
+++ b/client/src/components/SidePanel/Schedules/__tests__/Consent.spec.tsx
@@ -371,13 +371,34 @@ describe('a grant that can be made for the whole agent', () => {
jest.mocked(dataService.confirmScheduleMCPConsent).mockResolvedValue(asked);
display();
expect(await whole()).toBeChecked();
- expect(screen.getByText('com_ui_schedule_consent_everything_asking')).toBeVisible();
+ const keep = screen.getByRole('checkbox', {
+ name: 'com_ui_schedule_consent_everything_asking',
+ });
+ expect(keep).toBeChecked();
await userEvent.click(confirm());
await waitFor(() => expect(dataService.confirmScheduleMCPConsent).toHaveBeenCalled());
// Left out, the server keeps what the stored grant asks about.
expect(jest.mocked(dataService.confirmScheduleMCPConsent).mock.calls[0][1]).not.toHaveProperty(
'ask',
);
+ // The owner stops it, here, with the whole agent still ticked.
+ await userEvent.click(keep);
+ await userEvent.click(confirm());
+ await waitFor(() => expect(dataService.confirmScheduleMCPConsent).toHaveBeenCalledTimes(2));
+ expect(jest.mocked(dataService.confirmScheduleMCPConsent).mock.calls[1][1]).toMatchObject({
+ allow: {},
+ everything: true,
+ ask: {},
+ });
+ });
+
+ it('offers nothing to keep asking about where the grant asks about nothing', async () => {
+ jest.mocked(dataService.getScheduleMCPConsent).mockResolvedValue(standing);
+ display();
+ expect(await whole()).toBeChecked();
+ expect(
+ screen.queryByRole('checkbox', { name: 'com_ui_schedule_consent_everything_asking' }),
+ ).not.toBeInTheDocument();
});
it('starts a stored grant from what it is', async () => {
diff --git a/client/src/locales/en/translation.json b/client/src/locales/en/translation.json
index d0d7bd394f..970c67d680 100644
--- a/client/src/locales/en/translation.json
+++ b/client/src/locales/en/translation.json
@@ -3948,7 +3948,7 @@
"com_ui_schedule_consent_everything": "Run the whole agent",
"com_ui_schedule_consent_everything_note": "Everything this agent can use, including tools, skills and servers added to it later. Untick to choose tool by tool.",
"com_ui_schedule_consent_everything_allowed": "Allowed: the whole agent, including what is added to it later.",
- "com_ui_schedule_consent_everything_asking": "You are still asked before each use of: {{tools}}",
+ "com_ui_schedule_consent_everything_asking": "Ask me before each use of: {{tools}}",
"com_ui_schedule_authorize_title": "What this schedule may use",
"com_ui_schedule_authorize_changed": "What this schedule may use has changed. Review your choices and create it again.",
"com_ui_schedule_authorize_unavailable": "What this schedule may use could not be loaded. You can create it and authorize it afterwards; until then none of its tools will run.",