Skip to content

Open-source Grok Bot alternative with a virtual machine that bots can use

fix(approvals): stop five causes of "Always allow" asking again (#6163)

Milind Soni7c14288f7920
diff --git a/docs/agents-tool-bridge.md b/docs/agents-tool-bridge.md
index e0b0daf98b..9c8a3d60e5 100644
--- a/docs/agents-tool-bridge.md
+++ b/docs/agents-tool-bridge.md
@@ -88,7 +88,7 @@ name can be read by OpenMausBot too:
| API models: OpenAI-compatible, Cerebras, Greenference, ModelGo, Grok API, Groq, Meta, MiniMax, Mistral | Yes | The chat runtime never asks for the agents server (`server/drivers/chat-mcp-tools.ts:371`) and reads no configuration of the person's about a tool. |
| Codex, including the ChatGPT plan | No | Codex reads a layered configuration of its own: `config.toml` under `CODEX_HOME` or `~/.codex`, a Company engine's own home under OpenMausBot's data, a trusted project's `.codex/config.toml`, `/etc/codex/config.toml` and `/etc/codex/managed_config.toml`; and it has `PreToolUse` and `PermissionRequest` hooks of its own. Any of these can take a rule about a tool by name, and this version does not examine them. |
| Pi | No | pi is launched with `-e` for OpenMausBot's extension and nothing that keeps the person's own extensions out (`server/drivers/pi.ts`, `PI_ARGS`), in the person's home. Pi loads the extensions it finds there, and an extension's `tool_call` handler can block a call by the name it sees, as OpenMausBot's own does (`server/drivers/pi-mcp-extension.ts`). This version does not examine them. |
-| ACP agents: Grok, Kimi, Droid, Cursor, Antigravity, OpenCode, Qwen, Hermes, Cline, Gemini, custom | No | They keep their own permissions. "Always allow this session" hands the agent its own remembered approval ([approval levels](approval-levels.md)); given once for a harmless `use_tool` call it would cover every hidden tool. A reviewer would also lose the read-only marks the hidden reads carry, and Grok has native tools named `use_tool` and `search_tool`. |
+| ACP agents: Grok, Kimi, Droid, Cursor, Antigravity, OpenCode, Qwen, Hermes, Cline, Gemini, custom | No | They keep their own permissions. "Allow for this session" hands the agent its own remembered approval ([approval levels](approval-levels.md)); given once for a harmless `use_tool` call it would cover every hidden tool. A reviewer would also lose the read-only marks the hidden reads carry, and Grok has native tools named `use_tool` and `search_tool`. |
| Muse Code, and any engine not named above | No | Not shown to qualify. |
If the decision itself fails (a file it reads throws, a record it is handed
diff --git a/docs/approval-levels.md b/docs/approval-levels.md
index bdda53800e..5c9f4c47d1 100644
--- a/docs/approval-levels.md
+++ b/docs/approval-levels.md
@@ -193,7 +193,8 @@ with it. Questions and missing credentials still reach you.
## Answering a request
Approve or deny requests in the conversation to let the bot continue. **Allow
-once** answers this request only. **Always allow this session** hands the
+once** answers this request only. **Allow for this session** (the button says
+so, because nothing is saved) hands the
provider its own remembered approval: Claude receives its suggested permission
rules, and ACP agents such as Grok receive their `allow_always` option, or the
driver repeats your answer for that exact operation until the native session
@@ -207,13 +208,18 @@ the same room asks again.
For a read-shaped tool from a configured custom MCP server, the card also
offers **Always allow**. This is an explicit standing grant for that exact bot,
provider instance, MCP server, tool name, and current server configuration. A
-different tool still asks; editing the server command, URL, headers, or
-credentials invalidates the grant. It is not offered for create/update/delete
+different tool still asks; editing the server command, arguments, variables,
+URL or headers invalidates the grant. A key kept in the Vault is part of that
+configuration by its reference, not its value, so giving the Vault item a new
+value keeps the grant, and so does restarting the server. Switching the bot to
+Full access leaves its grants saved, unused, for when it goes back to Ask. It
+is not offered for create/update/delete
tools, computer control, a sandbox change, an unconfigured server, or a guest's
turn. A custom MCP server controls its own tool names, so only remember tools
from a server you trust. The grant applies to the bot's current and future
conversations, including newly delegated work. Saved entries are visible and
-revocable in the bot's Access settings.
+revocable in the bot's Access settings; removing one there takes it from every
+conversation of the bot at once, a running turn included.
The harness's own agents tools (coordinating teammates, threads, memory) never
ask on Claude, Codex or API models: OpenMausBot authorizes each of those
diff --git a/docs/cloud-pro.md b/docs/cloud-pro.md
index 0b16236b22..0047afadcb 100644
--- a/docs/cloud-pro.md
+++ b/docs/cloud-pro.md
@@ -969,7 +969,7 @@ On the Cloud home (`server/shared-computers.ts`, `server/index.ts`):
| --- | --- |
| Claude Code (2.1.257 or newer) | `--restricted` and only Read, Grep, Glob, Edit, Write and WebSearch: no Bash, PowerShell or WebFetch; reads outside its folder refused outright (`blockReadsOutsideWorkingDirectories`, plus deny rules); the folder's own `.mcp.json` and settings never load; only the harness's own MCP tools are pre-allowed, every other call asks the owner. The session's `init` must list no command-running tool, or the turn stops. An older Claude Code refuses. |
| Codex / ChatGPT (codex-cli 0.159) | no environment (`environments: []`: no `exec_command`, `apply_patch` or `view_image`, and calls to them are refused), `features.shell_tool`, `unified_exec` and `view_image` off and web search disabled, proven in `config/read` before the turn starts, or the turn refuses. |
- | API models (OpenAI-compatible, MiniMax, Mistral, Grok API) | no shell or file tool on the machine at all; only the harness's own agents tools are pre-allowed, every other MCP call asks the owner, and no owner's "Always allow this session" applies or is kept. |
+ | API models (OpenAI-compatible, MiniMax, Mistral, Grok API) | no shell or file tool on the machine at all; only the harness's own agents tools are pre-allowed, every other MCP call asks the owner, and no owner's "Allow for this session" applies or is kept. |
| Cursor, Qwen, Gemini, Hermes, Pi, OpenCode, Grok Build, Antigravity, Droid, Kimi, a custom ACP engine, Boat | refused: each runs its own shell or reads files outside its folder without asking in Ask (Qwen, Gemini, OpenCode and Pi could have it switched off; that needs a separate process per guest conversation, a follow-up). |
- Everything the owner's own devices write carries one owner identity, so
pairing a device again (or revoking one) never makes the owner's earlier
diff --git a/docs/verification/safety-floor.md b/docs/verification/safety-floor.md
index 5bf8f46256..5497268802 100644
--- a/docs/verification/safety-floor.md
+++ b/docs/verification/safety-floor.md
@@ -64,7 +64,7 @@ pnpm exec vitest run server/auto-approve.test.ts server/command-allowlist.e2e.te
record the answer. Codex at Full access accepts a request inside the
driver; with the floor on it raises a never-list command as a request
instead, carrying the exact command, and goes on accepting every other one.
- An ACP agent's kept "Always allow this session" repeats for an ordinary
+ An ACP agent's kept "Allow for this session" repeats for an ordinary
command and asks again for a never-list one, and a legacy full-auto
instance does not answer one by itself. Two cases join the driver to the
fold's own check: a Codex request with no working directory and an ACP
diff --git a/server/always-allow.test.ts b/server/always-allow.test.ts
index a3321a0f36..25c3fa2af0 100644
--- a/server/always-allow.test.ts
+++ b/server/always-allow.test.ts
@@ -1,6 +1,9 @@
-import { describe, expect, it } from "vitest";
+import { existsSync, mkdtempSync, rmSync } from "node:fs";
+import { tmpdir } from "node:os";
+import { join } from "node:path";
+import { afterEach, describe, expect, it, vi } from "vitest";
-import { MAX_ALWAYS_ALLOW, withAlwaysAllowKey } from "./always-allow.ts";
+import { dropRemovedGrants, MAX_ALWAYS_ALLOW, recoverThreadGrantsOnce, rewriteGrantLists, withAlwaysAllowKey, type GrantRewrite } from "./always-allow.ts";
const full = Array.from({ length: MAX_ALWAYS_ALLOW }, (_, i) => `provider-tool:claude:linear:tool_${i}:0123456789abcdef`);
@@ -20,3 +23,92 @@ describe("adding an Always allow grant", () => {
expect(withAlwaysAllowKey(full, full[7])).toEqual(full);
});
});
+
+describe("recovering a bot's grants from its threads", () => {
+ const dirs: string[] = [];
+ afterEach(() => { for (const dir of dirs.splice(0)) rmSync(dir, { recursive: true, force: true }); });
+ const folder = () => { const dir = mkdtempSync(join(tmpdir(), "omb-always-allow-")); dirs.push(dir); return dir; };
+ const inThreads = Array.from({ length: 30 }, (_, i) => `provider-tool:claude:notes:read_${i}:0123456789abcdef`);
+
+ it("adds a thread's tool grants to the bot's own, each once, never its shell grants, and says nothing while there is room", () => {
+ const log = vi.fn();
+ const bot = { id: "bot-1", alwaysAllow: ["Read", inThreads[0]!], tasks: [{ alwaysAllow: [inThreads[2]!, "Bash:git status"] }, { alwaysAllow: [inThreads[1]!, inThreads[0]!] }, {}] };
+ const untouched = { id: "bot-2", alwaysAllow: ["Read"], tasks: [{ alwaysAllow: ["Bash:ls"] }] };
+ expect(recoverThreadGrantsOnce(folder(), [bot, untouched], log)).toBe(true);
+ expect(bot.alwaysAllow).toEqual(["Read", inThreads[0], inThreads[2], inThreads[1]]);
+ expect(bot.tasks[0]!.alwaysAllow).toEqual([inThreads[2], "Bash:git status"]);
+ expect(untouched).toEqual({ id: "bot-2", alwaysAllow: ["Read"], tasks: [{ alwaysAllow: ["Bash:ls"] }] });
+ expect(log).not.toHaveBeenCalled();
+ });
+
+ it("runs once for a data folder, so a grant removed since is not brought back from a thread that still holds a copy", () => {
+ const dir = folder();
+ const bot = { id: "bot-1", alwaysAllow: [] as string[], tasks: [{ alwaysAllow: [inThreads[0]!] }] };
+ expect(recoverThreadGrantsOnce(dir, [bot])).toBe(true);
+ expect(bot.alwaysAllow).toEqual([inThreads[0]]);
+ expect(existsSync(join(dir, "always-allow-recovered"))).toBe(true);
+ bot.alwaysAllow = [];
+ expect(recoverThreadGrantsOnce(dir, [bot]), "the next start").toBe(false);
+ expect(bot.alwaysAllow).toEqual([]);
+ expect(recoverThreadGrantsOnce(folder(), [{ id: "bot-3", alwaysAllow: ["Read"], tasks: [] }]), "nothing to recover is still marked done").toBe(false);
+ });
+
+ it("keeps every grant the bot already has when its threads hold more than fit, says how many were kept once, and leaves no thread allowing the rest", () => {
+ const log = vi.fn();
+ const dir = folder();
+ const own = full.slice(10);
+ const bot = { id: "bot-1", alwaysAllow: [...own], tasks: [{ alwaysAllow: [...inThreads.slice(0, 15), "Bash:ls"] }, { alwaysAllow: inThreads.slice(15) }] };
+ expect(recoverThreadGrantsOnce(dir, [bot], log)).toBe(true);
+ expect(bot.alwaysAllow).toEqual([...own, ...inThreads.slice(0, 10)]);
+ expect(bot.tasks[0]!.alwaysAllow, "what did not fit asks again in its thread too; its shell grant stays").toEqual([...inThreads.slice(0, 10), "Bash:ls"]);
+ expect(bot.tasks[1]!.alwaysAllow).toEqual([]);
+ expect(log).toHaveBeenCalledExactlyOnceWith("[always-allow] bot bot-1: kept 200 of 220 always-allowed tools (the limit is 200); the other 20 ask again.");
+ expect(recoverThreadGrantsOnce(dir, [bot], log)).toBe(false);
+ expect(log).toHaveBeenCalledOnce();
+ });
+
+ it("keeps the newest of a list that was already past the limit", () => {
+ const log = vi.fn();
+ const bot = { id: "bot-1", alwaysAllow: [...inThreads.slice(0, 5), ...full], tasks: [{ alwaysAllow: inThreads.slice(0, 6) }] };
+ expect(recoverThreadGrantsOnce(folder(), [bot], log)).toBe(true);
+ expect(bot.alwaysAllow).toEqual(full);
+ expect(bot.tasks[0]!.alwaysAllow).toEqual([]);
+ expect(log).toHaveBeenCalledExactlyOnceWith("[always-allow] bot bot-1: kept 200 of 206 always-allowed tools (the limit is 200); the other 6 ask again.");
+ });
+});
+
+describe("removing a grant in Settings", () => {
+ const fixture = () => {
+ const bot = { id: "iris", alwaysAllow: ["A", "B", "C"], tasks: [{ alwaysAllow: ["A", "B", "Bash:ls"] }, { alwaysAllow: ["C"] }, { alwaysAllow: [] as string[] }, {}] as Array<{ alwaysAllow?: string[] }> };
+ const saves = vi.fn();
+ const store = { bot: (id: string) => (id === "iris" ? bot : null), rewriteGrants: (id: string, rewrite: GrantRewrite, removal?: boolean) => id === "iris" && rewriteGrantLists(bot, rewrite, saves, removal) };
+ return { bot, saves, store };
+ };
+
+ it("takes it from every thread of the bot and its running turns in one save, and from no other bot's turn", () => {
+ const { bot, saves, store } = fixture();
+ const turns = [{ id: "iris", alwaysAllow: ["B", "C"] }, { id: "paul", alwaysAllow: ["B"] }, { id: "iris" }];
+ dropRemovedGrants(store, turns, "iris", ["A", "C"]);
+ expect(bot).toEqual({ id: "iris", alwaysAllow: ["A", "C"], tasks: [{ alwaysAllow: ["A", "Bash:ls"] }, { alwaysAllow: ["C"] }, { alwaysAllow: [] }, {}] });
+ expect(turns).toEqual([{ id: "iris", alwaysAllow: ["C"] }, { id: "paul", alwaysAllow: ["B"] }, { id: "iris" }]);
+ expect(saves).toHaveBeenCalledOnce();
+ });
+
+ it("does nothing when the new list only adds or reorders", () => {
+ const { bot, saves, store } = fixture();
+ dropRemovedGrants(store, [], "iris", ["C", "B", "A", "D"]);
+ dropRemovedGrants(store, [], "nobody", []);
+ expect(bot.tasks[0]!.alwaysAllow).toEqual(["A", "B", "Bash:ls"]);
+ expect(saves).not.toHaveBeenCalled();
+ });
+
+ it("keeps the removal in force, in threads and running turns, when it could not be saved", () => {
+ const { bot, saves, store } = fixture();
+ saves.mockImplementation(() => { throw new Error("fixture disk full"); });
+ const turns = [{ id: "iris", alwaysAllow: ["A", "B"] }];
+ expect(() => dropRemovedGrants(store, turns, "iris", ["C"])).toThrow("fixture disk full");
+ expect(bot.alwaysAllow).toEqual(["C"]);
+ expect(bot.tasks.map((task) => task.alwaysAllow)).toEqual([["Bash:ls"], ["C"], [], undefined]);
+ expect(turns[0]!.alwaysAllow).toEqual([]);
+ });
+});
diff --git a/server/always-allow.ts b/server/always-allow.ts
index 36696d4a36..eca3b32746 100644
--- a/server/always-allow.ts
+++ b/server/always-allow.ts
@@ -1,5 +1,11 @@
// A bot's (and each of its threads') "Always allow" list has a fixed size. A grant past it is refused, never dropped,
// so the approval card that asked to remember it stays waiting instead of being allowed as if it had been saved.
+// The bot's own list is the one the person sees and edits in Settings; each thread holds a copy that its turns read.
+import { existsSync, mkdirSync } from "node:fs";
+import { join } from "node:path";
+
+import { writeFileAtomic } from "./atomic.ts";
+
export const MAX_ALWAYS_ALLOW = 200;
/** `keys` with `key` added (once), or null when there is no room for it. */
@@ -7,3 +13,78 @@ export function withAlwaysAllowKey(keys: readonly string[] | undefined, key: str
const next = [...new Set([...(keys ?? []), key])];
return next.length > MAX_ALWAYS_ALLOW ? null : next;
}
+
+interface GrantHolder { alwaysAllow?: string[] }
+interface GrantBot extends GrantHolder { id: string; tasks?: GrantHolder[] }
+/** Answers the list as it should be, or null to leave it as it is. */
+export type GrantRewrite = (keys: readonly string[]) => string[] | null;
+
+/** Rewrites a bot's own list and each of its threads' in memory, then saves once; false when no list changed. A failed
+ * save puts every list back, unless the change takes grants away: a removal stays in force though it could not be saved. */
+export function rewriteGrantLists(bot: GrantBot, rewrite: GrantRewrite, save: () => void, removal = false): boolean {
+ const holders = [bot, ...(bot.tasks ?? [])].filter((holder) => holder.alwaysAllow !== undefined);
+ const before = holders.map((holder) => holder.alwaysAllow!);
+ const next = before.map(rewrite);
+ if (next.every((keys) => keys === null)) return false;
+ holders.forEach((holder, index) => { if (next[index]) holder.alwaysAllow = next[index]!; });
+ try {
+ save();
+ } catch (error) {
+ if (!removal) holders.forEach((holder, index) => { holder.alwaysAllow = before[index]!; });
+ throw error;
+ }
+ return true;
+}
+
+/** The person took grants off the bot's list in Settings: `next` is the list they left. Each one goes from every thread of
+ * the bot too, in the same save, and from any turn of it now running, so no thread keeps allowing what they removed. */
+export function dropRemovedGrants(
+ store: { bot(id: string): GrantHolder | null | undefined; rewriteGrants(botId: string, rewrite: GrantRewrite, removal?: boolean): boolean },
+ turns: Iterable<GrantHolder & { id: string }>, botId: string, next: readonly string[],
+): void {
+ const removed = new Set((store.bot(botId)?.alwaysAllow ?? []).filter((key) => !next.includes(key)));
+ if (!removed.size) return;
+ const without: GrantRewrite = (keys) => (keys.some((key) => removed.has(key)) ? keys.filter((key) => !removed.has(key)) : null);
+ try {
+ store.rewriteGrants(botId, without, true);
+ } finally {
+ for (const turn of turns) if (turn.id === botId && turn.alwaysAllow) turn.alwaysAllow = without(turn.alwaysAllow) ?? turn.alwaysAllow;
+ }
+}
+
+const TOOL_GRANT = "provider-tool:";
+const RECOVERED_FILE = "always-allow-recovered";
+
+/** Once per data folder: an early version saved an MCP tool grant on the thread it was given in only, so each bot's own
+ * list takes those in (newest thread first), never a thread's shell or session grants. Its own come first, as they are
+ * the ones in force; past the limit the newest of its own stay, one line says how many were kept, and the tool grants
+ * that did not fit leave the threads too, so nothing the person cannot see in Settings stays allowed. It runs once: run
+ * at every start, it would bring back any grant the person had since removed while a thread still held a copy.
+ * True when a list changed. */
+export function recoverThreadGrantsOnce(dataDir: string, bots: readonly GrantBot[], log: (line: string) => void = console.warn): boolean {
+ const marker = join(dataDir, RECOVERED_FILE);
+ if (existsSync(marker)) return false;
+ let changed = false;
+ for (const bot of bots) {
+ const own = [...new Set(bot.alwaysAllow ?? [])];
+ const all = [...new Set([...own, ...(bot.tasks ?? []).flatMap((task) => (task.alwaysAllow ?? []).filter((key) => key.startsWith(TOOL_GRANT)))])];
+ if (all.length === own.length) continue;
+ const kept = all.length <= MAX_ALWAYS_ALLOW ? all : own.length >= MAX_ALWAYS_ALLOW ? own.slice(-MAX_ALWAYS_ALLOW) : all.slice(0, MAX_ALWAYS_ALLOW);
+ if (kept.length < all.length) {
+ log(`[always-allow] bot ${bot.id}: kept ${kept.length} of ${all.length} always-allowed tools (the limit is ${MAX_ALWAYS_ALLOW}); the other ${all.length - kept.length} ask again.`);
+ const stays = new Set(kept);
+ for (const task of bot.tasks ?? []) {
+ if (task.alwaysAllow?.some((key) => key.startsWith(TOOL_GRANT) && !stays.has(key))) task.alwaysAllow = task.alwaysAllow.filter((key) => !key.startsWith(TOOL_GRANT) || stays.has(key));
+ }
+ }
+ bot.alwaysAllow = kept;
+ changed = true;
+ }
+ try {
+ mkdirSync(dataDir, { recursive: true });
+ writeFileAtomic(marker, JSON.stringify({ recoveredAt: Date.now() }), { mode: 0o600 });
+ } catch {
+ // Not marked: the next start recovers again, which changes nothing that this start did not.
+ }
+ return changed;
+}
diff --git a/server/host/mcp-servers-host.test.ts b/server/host/mcp-servers-host.test.ts
index d1b021db3e..5aac60a20d 100644
--- a/server/host/mcp-servers-host.test.ts
+++ b/server/host/mcp-servers-host.test.ts
@@ -1,11 +1,13 @@
+import { createHash } from "node:crypto";
import { existsSync, mkdirSync, mkdtempSync, rmSync, writeFileSync } from "node:fs";
import { tmpdir } from "node:os";
import { join } from "node:path";
-import { afterEach, expect, it } from "vitest";
+import { afterEach, expect, it, vi } from "vitest";
import type { AppConfig } from "../config.ts";
import { mcpServerConfigHash } from "../mcp-app-catalog.ts";
import { McpOAuthManager } from "../mcp-oauth.ts";
+import { providerToolAllowKey } from "../provider-tool-allow.ts";
import { VaultStore } from "../vault-store.ts";
import { createMcpKeys } from "../vault/mcp-keys.ts";
import { claimedNotice, createMcpServersHost, startCheckTimeout } from "./mcp-servers-host.ts";
@@ -187,6 +189,100 @@ it("starts a server with its key read from the Vault, tells a bot the item keeps
expect(told.join()).not.toContain("doesn't start");
});
+it("ties a saved grant to the server as config.json holds it: a restart or a new key value keeps it, a changed server ends it", async () => {
+ const data = mkdtempSync(join(tmpdir(), "omb-mcp-host-"));
+ dirs.push(data);
+ const vault = new VaultStore({ dataDir: data });
+ const secret = vault.saveSecret({ name: "Stripe secret key", value: "sk_fake-first", source: "card", bots: "all" });
+ vault.grantMcpKeys("stripe", [secret.id]);
+ const keys = createMcpKeys({ store: vault, linked: { fresh: async () => {}, byId: () => null } });
+ const cfg = { mcpServers: {
+ stripe: { command: "npx", args: ["stripe-mcp"], env: { STRIPE_KEY: `vault:${secret.id}` }, enabled: true },
+ twin: { command: "npx", args: ["stripe-mcp"], env: { STRIPE_KEY: "plain" }, enabled: true },
+ } } as unknown as AppConfig;
+ const saved = new Map<string, string[]>();
+ const host = createMcpServersHost({
+ dataDir: data, cfg: () => cfg, persist: (next) => { cfg.mcpServers = next; }, bots: () => [IRIS, PAUL], startsServers: () => true, boxed: () => false, policy: (servers) => servers,
+ tell: () => {}, keys, start: async () => ({ ok: true }),
+ moveGrants: (bot, move) => { goneOver.push(bot.id); const next = move(saved.get(bot.id) ?? []); if (next) saved.set(bot.id, next); },
+ });
+ const goneOver: string[] = [];
+ const key = (bot: typeof IRIS, server = "stripe", tool = "list_charges") => providerToolAllowKey("claude", `mcp__${server}__${tool}`, host.grantSpecs(host.mounted(bot))[server]);
+ /** What earlier versions saved: the fingerprint of the server as started, key value and restart count included. */
+ const earlier = (bot: typeof IRIS) => `provider-tool:claude:stripe:list_charges:${createHash("sha256").update(JSON.stringify(host.mounted(bot).stripe)).digest("hex").slice(0, 16)}`;
+ await host.prepare(IRIS);
+ const first = key(IRIS)!;
+ expect(first).toMatch(/^provider-tool:claude:stripe:list_charges:[a-f0-9]{16}$/);
+ expect(JSON.stringify(host.grantSpecs(host.mounted(IRIS)))).not.toContain("sk_fake");
+ expect(JSON.stringify(host.grantSpecs(host.mounted(IRIS)))).toContain(`vault:${secret.id}`);
+ expect(key(PAUL), "the same server is the same grant key for each bot, which keeps its own list").toBe(first);
+ expect(key(IRIS, "twin"), "another server, though started by the same command, has its own").not.toBe(first);
+ expect(key(IRIS, "stripe", "list_refunds")).not.toBe(first);
+
+ const beforeRestart = earlier(IRIS);
+ expect(beforeRestart).not.toBe(first);
+ saved.set(IRIS.id, [beforeRestart, "Bash:git status"]);
+ saved.set(PAUL.id, [beforeRestart]);
+ host.health.changed("stripe");
+ host.health.changed("stripe");
+ expect((host.mounted(IRIS).stripe as { env: Record<string, string> }).env.OMB_MCP_RESTART, "the restart still reaches the engine").toBe("2");
+ expect(earlier(IRIS), "the old key changed with every restart").not.toBe(beforeRestart);
+ expect(key(IRIS)).toBe(first);
+ expect(host.grantSpecs(host.mounted(IRIS)).stripe).not.toHaveProperty("env.OMB_MCP_RESTART");
+
+ vault.updateSecret(secret.id, { value: "sk_fake-rotated" });
+ host.keyChanged(secret.id);
+ expect((host.mounted(IRIS).stripe as { env: Record<string, string> }).env.STRIPE_KEY).toBe("sk_fake-rotated");
+ expect(key(IRIS), "a new key value is the same server").toBe(first);
+ // A grant saved under the first key value cannot be told apart from one for another server now, so it is left as it is.
+ await host.prepare(IRIS);
+ expect(saved.get(IRIS.id)).toEqual([beforeRestart, "Bash:git status"]);
+ // One saved under today's value, at a restart count from before, moves when the bot's next turn starts: this bot's only.
+ vault.updateSecret(secret.id, { value: "sk_fake-first" });
+ await host.prepare(IRIS);
+ expect(saved.get(IRIS.id)).toEqual([first, "Bash:git status"]);
+ expect(saved.get(PAUL.id)).toEqual([beforeRestart]);
+ expect(JSON.stringify([...saved])).not.toContain("sk_fake");
+ // A turn whose servers are as they were at the bot's last one goes over nothing: no hashing of its keys, no save.
+ const before = goneOver.length;
+ await host.prepare(IRIS);
+ await host.prepare(IRIS);
+ expect(goneOver.length).toBe(before);
+ host.health.changed("stripe");
+ await host.prepare(IRIS);
+ expect(goneOver.slice(before), "servers changed: once more, for that bot").toEqual([IRIS.id]);
+ await host.prepare(PAUL);
+ await host.prepare(PAUL);
+ expect(goneOver.slice(before)).toEqual([IRIS.id, PAUL.id]);
+ expect(saved.get(PAUL.id), "and Paul's own turn moves Paul's").toEqual([first]);
+
+ (cfg.mcpServers!.stripe as { args: string[] }).args = ["stripe-mcp", "--live"];
+ expect(key(IRIS), "changed arguments are another server").not.toBe(first);
+ (cfg.mcpServers!.stripe as { args: string[] }).args = ["stripe-mcp"];
+ expect(key(IRIS)).toBe(first);
+ (cfg.mcpServers!.stripe as { command: string }).command = "node";
+ expect(key(IRIS), "so is a changed command").not.toBe(first);
+ (cfg.mcpServers!.stripe as { command: string }).command = "npx";
+ (cfg.mcpServers!.stripe as { env: Record<string, string> }).env.STRIPE_ACCOUNT = "acct_other";
+ expect(key(IRIS), "and a changed variable").not.toBe(first);
+});
+
+it("keeps a turn starting when its bot's grants cannot be saved in their new form", async () => {
+ const cfg = { mcpServers: { plain: { command: "npx", args: ["plain-mcp"], env: {}, enabled: true } } } as unknown as AppConfig;
+ const data = mkdtempSync(join(tmpdir(), "omb-mcp-host-"));
+ dirs.push(data);
+ const host = createMcpServersHost({
+ dataDir: data, cfg: () => cfg, persist: () => {}, bots: () => [IRIS], startsServers: () => true, boxed: () => false, policy: (servers) => servers, tell: () => {},
+ start: async () => ({ ok: true }), moveGrants: () => { throw new Error("fixture disk full"); },
+ });
+ const logged = vi.spyOn(console, "error").mockImplementation(() => {});
+ await expect(host.prepare(IRIS)).resolves.toBeUndefined();
+ expect(logged).toHaveBeenCalledExactlyOnceWith("[mcp] Could not move this bot's saved tool permissions to their new form.");
+ await host.prepare(IRIS);
+ expect(logged, "a failed move is tried again at the next turn").toHaveBeenCalledTimes(2);
+ logged.mockRestore();
+});
+
it("forgets which Vault items a server could read when its bot's own server goes with the bot", () => {
const data = mkdtempSync(join(tmpdir(), "omb-mcp-host-"));
dirs.push(data);
diff --git a/server/host/mcp-servers-host.ts b/server/host/mcp-servers-host.ts
index ae609e5cb4..7bb7267878 100644
--- a/server/host/mcp-servers-host.ts
+++ b/server/host/mcp-servers-host.ts
@@ -9,13 +9,14 @@ import { customMcpServers } from "../config.ts";
import type { McpServerSpec, StdioMcpSpec } from "../contracts.ts";
import { addBotMcpServer, claimBotMcpServers, keepForBot, withoutBotMcpServers, type BotKept, type BotMcpServerAdd } from "../mcp-bot-servers.ts";
import { MCP_RESTART_ENV } from "../mcp-app-catalog.ts";
+import { grantMover, grantServersMark, storedGrantSpec, type GrantServer } from "../mcp-grant-spec.ts";
import { createMcpHealth, nameList, toolLabel, type McpHealthDeps } from "../mcp-health.ts";
import { probeMcpServer } from "../mcp-probe.ts";
import { isRemoteMcpServer, parseStoredMcpServer, type StoredStdioMcpServer } from "../mcp-registry.ts";
import type { McpKeys } from "../vault/mcp-keys.ts";
import { canUseMcpServer } from "../../shared/tool-scope.ts";
-type Bot = { id: string; name: string; mcpServers?: string[]; toolScope?: unknown };
+type Bot = { id: string; name: string; mcpServers?: string[]; toolScope?: unknown; alwaysAllow?: string[] };
/** A server left out of a bot's turns, with why; `key`: its Vault key is off, as against it not starting. */
export type McpServerOff = { name: string; error: string; key?: true };
@@ -37,6 +38,8 @@ export interface McpServersHostDeps {
keys?: McpKeys;
/** Drops a server's sign-in: its tokens and any sign-in still open. */
forgetSignIn?(name: string): void;
+ /** Rewrites the bot's saved "Always allow" grants with `move`, which answers null when it changes nothing. */
+ moveGrants?(bot: Bot, move: (keys: readonly string[]) => string[] | null): void;
}
const CLAIMED_FILE = (dataDir: string) => join(dataDir, "mcp-bot-servers.json");
@@ -119,11 +122,36 @@ export function createMcpServersHost(deps: McpServersHostDeps) {
const restarts = new Map<string, number>();
const health = { ...checks, changed(name: string): void { restarts.set(name, (restarts.get(name) ?? 0) + 1); checks.changed(name); } };
+ const mounted = (bot: Bot): Record<string, McpServerSpec> => withRestarts(health.usable(bot.id, keyed(bot).servers), restarts);
+ /** `servers` as a saved "Always allow" names them (mcp-grant-spec.ts): no Vault key's value and no restart count. */
+ const grantSpecs = (servers: Record<string, McpServerSpec>): Record<string, McpServerSpec> => {
+ const stored = deps.cfg().mcpServers ?? {};
+ return Object.fromEntries(Object.entries(servers).map(([name, server]) => [name, storedGrantSpec(name, stored[name]) ?? server]));
+ };
+ /** Grants an earlier version tied to a key's value or a restart count move to the server as it is named now: once for
+ * a bot's servers as they are, so a turn whose servers have not changed since does none of this. A failed save changes
+ * nothing: the next turn tries again, and until then those tools ask as they did. */
+ const movedFor = new Map<string, string>();
+ const moveGrants = (bot: Bot): void => {
+ if (!deps.moveGrants) return;
+ const started = mounted(bot), names = grantSpecs(started);
+ const servers: Record<string, GrantServer> = Object.fromEntries(Object.keys(started).map((name) => [name, { names: names[name]!, started: started[name]! }]));
+ const mark = grantServersMark(servers);
+ if (movedFor.get(bot.id) === mark) return;
+ try {
+ deps.moveGrants(bot, grantMover(servers));
+ movedFor.set(bot.id, mark);
+ } catch {
+ console.error("[mcp] Could not move this bot's saved tool permissions to their new form.");
+ }
+ };
+
return {
health,
/** How Test starts a command server: as the turns of its bot, or of any bot. */
probeAs: (server: { bot?: string }) => (server.bot ? asBot(server.bot) : {}),
- mounted: (bot: Bot): Record<string, McpServerSpec> => withRestarts(health.usable(bot.id, keyed(bot).servers), restarts),
+ mounted,
+ grantSpecs,
/** The servers set for this bot, started or not: who a change to one reaches. */
given: (bot: Bot): string[] => Object.keys(configured(bot)),
/** Before a turn: any Vault key its servers read from a linked password manager, and the first start checks. */
@@ -135,6 +163,7 @@ export function createMcpServersHost(deps: McpServersHostDeps) {
}
}
await health.prepare(bot.id, started(bot));
+ moveGrants(bot);
},
off: (bot: Bot): McpServerOff[] => [...health.off(bot.id, started(bot)), ...keyed(bot).off.filter(({ name }) => canUseMcpServer(bot.toolScope, name))],
listing: <T extends { name: string }>(server: T): T & { offFor?: string[]; keyOff?: true } => {
diff --git a/server/independent-task-store.test.ts b/server/independent-task-store.test.ts
index 8513fd9521..053d74b67d 100644
--- a/server/independent-task-store.test.ts
+++ b/server/independent-task-store.test.ts
@@ -42,6 +42,30 @@ describe("independent bot task state", () => {
expect(new Store(selection).tasks(bot.id).every(task => task.approvalMode === "ask")).toBe(true);
});
+ it("keeps a bot's saved grants through Full access, so going back to Ask does not ask for each again", () => {
+ const store = new Store(selection);
+ const bot = store.createBot({}, { seedMessages: false });
+ const grants = ["provider-tool:claude:linear:list_issues:0123456789abcdef", "provider-tool:claude:notes:get_note:fedcba9876543210"];
+ store.patchBot(bot.id, { approvalMode: "ask", autoApprove: false, alwaysAllow: grants });
+ const first = bot.threadId;
+ store.patchTask(bot.id, first, { alwaysAllow: grants });
+ const sibling = store.createTask(bot.id, "Sibling")!;
+ store.patchTask(bot.id, sibling.threadId, { alwaysAllow: [grants[0]!] });
+
+ store.setAllThreadApprovalMode(bot.id, "full");
+ expect(approvalModeFor(store.bot(bot.id)!)).toBe("full");
+ expect(store.bot(bot.id)?.alwaysAllow, "unused at Full access, but still saved").toEqual(grants);
+ expect(savedBots().find((saved) => saved.id === bot.id)?.alwaysAllow).toEqual(grants);
+
+ const restarted = new Store(selection);
+ restarted.setAllThreadApprovalMode(bot.id, "ask");
+ expect(approvalModeFor(restarted.bot(bot.id)!)).toBe("ask");
+ expect(restarted.bot(bot.id)?.alwaysAllow).toEqual(grants);
+ expect(restarted.projectBotForTask(bot.id, first)?.alwaysAllow).toEqual(grants);
+ expect(restarted.projectBotForTask(bot.id, sibling.threadId)?.alwaysAllow, "each thread keeps its own list, no wider than before").toEqual([grants[0]]);
+ expect(new Store(selection).bot(bot.id)?.alwaysAllow).toEqual(grants);
+ });
+
it("refreshes one thread's permissions from the bot default and leaves the rest", () => {
const store = new Store(selection);
const bot = store.createBot({}, { seedMessages: false });
diff --git a/server/index.test.ts b/server/index.test.ts
index 7f09ba12d5..12fafeba0d 100644
--- a/server/index.test.ts
+++ b/server/index.test.ts
@@ -7882,7 +7882,7 @@ describe("harness HTTP API", () => {
expect(team.status, mode).toBe(200);
expect(team.body.bot, mode).toMatchObject({ approvalMode: mode, autoApprove: mode === "auto" });
expect(levels(team.body.bot), mode).toEqual([mode, mode, mode]);
- expect(team.body.bot.alwaysAllow, mode).toEqual(mode === "full" ? [] : ["Read"]);
+ expect(team.body.bot.alwaysAllow, `${mode}: saved grants stay at every level, unused at Full access`).toEqual(["Read"]);
const saved = (await api("GET", "/api/bots?messages=0")).body.bots.find((entry: { id: string }) => entry.id === bot.id);
expect(levels(saved), mode).toEqual([mode, mode, mode]);
if (mode === "auto") expect(await permissionModeOf(bot.id, opened[0]!)).toBe("auto");
@@ -9389,6 +9389,82 @@ describe("harness HTTP API", () => {
}
});
+ it("keeps an always-allowed MCP read after its server is restarted, for that tool on that server only, until it is removed in Settings", async () => {
+ const bot = (await api("POST", "/api/bots", { name: "Wren" })).body.bot;
+ const conns: Socket[] = [];
+ try {
+ expect((await api("POST", "/api/mcp/servers", { name: "ledger", command: process.execPath, args: ["--experimental-strip-types", FAKE_MCP_SERVER] })).status).toBe(201);
+ expect((await api("PATCH", "/api/mcp/servers/ledger", { enabled: true })).status).toBe(200);
+ expect((await api("PATCH", `/api/bots/${bot.id}`, { modelSelection: { instanceId: "claude", model: "claude-haiku-4-5" }, approvalMode: "auto" })).status).toBe(200);
+ rmSync(fakeClaudeDump, { force: true });
+ expect((await api("POST", `/api/bots/${bot.id}/messages`, { text: "read my ledger" })).status).toBe(202);
+ const dump = z.object({ mcpConfig: z.object({ mcpServers: z.object({ ogb: z.object({ args: z.array(z.string()) }) }) }) }).parse(await readJsonFileWhenReady(fakeClaudeDump));
+ const raise = async (id: string, summary: string, tool: string) => {
+ const conn = connect(dump.mcpConfig.mcpServers.ogb.args[1]);
+ conns.push(conn);
+ const answered = new Promise<{ behavior: string }>((resolve) => {
+ let buf = "";
+ conn.on("data", (chunk) => {
+ buf += chunk;
+ const nl = buf.indexOf("\n");
+ if (nl !== -1) resolve(JSON.parse(buf.slice(0, nl)));
+ });
+ });
+ await new Promise<void>((resolve, reject) => { conn.on("connect", resolve); conn.on("error", reject); });
+ conn.write(JSON.stringify({ t: "ask", id, tool, input: { command: summary } }) + "\n");
+ return answered;
+ };
+ type Card = { subtitle: string; requestId?: string; allowKey?: string };
+ const cards = async (): Promise<Card[]> => (await api("GET", "/api/bots?messages=40")).body.bots
+ .find((candidate: { id: string }) => candidate.id === bot.id).messages.flatMap((m: { card?: Card }) => (m.card ? [m.card] : []));
+ const card = async (summary: string): Promise<Card> => {
+ await expect.poll(async () => (await cards()).find((shown) => shown.subtitle === summary)).toBeTruthy();
+ return (await cards()).find((shown) => shown.subtitle === summary)!;
+ };
+
+ const first = raise("ask-entries-1", "list entries", "mcp__ledger__list_entries");
+ const asked = await card("list entries");
+ expect(asked.allowKey).toMatch(/^provider-tool:claude:ledger:list_entries:[a-f0-9]{16}$/);
+ expect((await api("POST", `/api/bots/${bot.id}/always-allow`, { threadId: bot.threadId, allowKey: asked.allowKey })).status).toBe(200);
+ expect((await api("POST", `/api/bots/${bot.id}/respond`, { requestId: asked.requestId, behavior: "allow" })).status).toBe(200);
+ await expect(first).resolves.toMatchObject({ behavior: "allow" });
+
+ // Saving it as on again starts it anew, as a bot's restart of it, an edit or a changed Vault key do.
+ expect((await api("PATCH", "/api/mcp/servers/ledger", { enabled: true })).status).toBe(200);
+ await expect(raise("ask-entries-2", "list entries after a restart", "mcp__ledger__list_entries")).resolves.toMatchObject({ behavior: "allow" });
+ expect((await cards()).some((shown) => shown.subtitle === "list entries after a restart")).toBe(false);
+
+ // The grant is for that tool alone: another read on the same server still asks, under that server's same fingerprint.
+ const other = raise("ask-accounts", "list accounts", "mcp__ledger__list_accounts");
+ const otherCard = await card("list accounts");
+ expect(otherCard.allowKey).toBe(asked.allowKey!.replace(":list_entries:", ":list_accounts:"));
+ expect((await api("POST", `/api/bots/${bot.id}/respond`, { requestId: otherCard.requestId, behavior: "deny" })).status).toBe(200);
+ await expect(other).resolves.toMatchObject({ behavior: "deny" });
+ // A tool that sends has no saved grant to offer at all, restart or not.
+ const send = raise("ask-send", "send the ledger", "mcp__ledger__send_email");
+ const sendCard = await card("send the ledger");
+ expect(sendCard.allowKey).toBeUndefined();
+ expect((await api("POST", `/api/bots/${bot.id}/respond`, { requestId: sendCard.requestId, behavior: "deny" })).status).toBe(200);
+ await expect(send).resolves.toMatchObject({ behavior: "deny" });
+ expect((await api("GET", "/api/bots")).body.bots.find((candidate: { id: string }) => candidate.id === bot.id).alwaysAllow).toEqual([asked.allowKey]);
+
+ // Removed in Settings → Access: the thread it was given in and the turn now running stop allowing it too.
+ expect((await api("PATCH", `/api/bots/${bot.id}`, { alwaysAllow: [] })).status).toBe(200);
+ const saved = (await api("GET", "/api/bots")).body.bots.find((candidate: { id: string }) => candidate.id === bot.id);
+ expect([saved.alwaysAllow, ...saved.tasks.map((task: { alwaysAllow?: string[] }) => task.alwaysAllow ?? [])].flat()).toEqual([]);
+ const afterRemoval = raise("ask-entries-3", "list entries once removed", "mcp__ledger__list_entries");
+ const askedAgain = await card("list entries once removed");
+ expect(askedAgain.allowKey).toBe(asked.allowKey);
+ expect((await api("POST", `/api/bots/${bot.id}/respond`, { requestId: askedAgain.requestId, behavior: "deny" })).status).toBe(200);
+ await expect(afterRemoval).resolves.toMatchObject({ behavior: "deny" });
+ } finally {
+ for (const conn of conns) conn.destroy();
+ await api("POST", `/api/bots/${bot.id}/interrupt`);
+ await api("DELETE", `/api/bots/${bot.id}`);
+ await api("DELETE", "/api/mcp/servers/ledger").catch(() => undefined);
+ }
+ });
+
it("mounts the data-dashboards skill, with the folder that holds its template, when the person asks for a dashboard", async () => {
const bot = (await api("POST", "/api/bots", {})).body.bot;
try {
diff --git a/server/index.ts b/server/index.ts
index 59566bf47a..35707fa053 100644
--- a/server/index.ts
+++ b/server/index.ts
@@ -61,7 +61,7 @@ import {
type BrowserCleanupWireRequest,
} from "./browser-lifecycle-cleanup.ts";
import * as checkpoints from "./checkpoints.ts";
-import { commandReceipt } from "./commands.ts";
+import { commandReceipt } from "./commands.ts"; import { moveSavedGrants } from "./mcp-grant-spec.ts";
import { buildTurnDigest, coverageForDriver, digestPromptLine, renderDigest, toolEvidence } from "./digest.ts";
import { appendDecision, bindDecisionRetention, decisionRetentionDays, flushDecisionLog, pruneDecisions, withDecisionActor, type DecisionActor, type DecisionVia } from "./decision-log.ts";
import { folderToFollow, inMyFolderCwd, validateBotCwd } from "./bot-cwd.ts";
@@ -1376,7 +1376,7 @@ const attributeUsage = createUsageAttribution({ section: (botId) => store.bot(bo
}
}
-const providerAuthSessions = new ProviderAuthSessions({ signedIn: (instanceId) => limitTakeover.signedIn(instanceId) }); const mcpServersHost = createMcpServersHost({ dataDir: DATA_DIR, cfg: () => cfg, persist: persistMcpServers, bots: () => store.bots, policy: (servers) => managedPolicy.filterMcp(servers), tell: (text, about) => notify(buildNoticeNotification(about, store.bot(about.id)?.threadId ?? "", text)), startsServers: (botId) => { const bot = store.bot(botId); return Boolean(bot && registry.get(bot.modelSelection.instanceId)?.adapter.capabilities.customMcp === true); }, boxed: () => botBox.enabled(), keys: mcpKeys, forgetSignIn: (name) => mcpOAuth.forget(name) });
+const providerAuthSessions = new ProviderAuthSessions({ signedIn: (instanceId) => limitTakeover.signedIn(instanceId) }); const mcpServersHost = createMcpServersHost({ dataDir: DATA_DIR, cfg: () => cfg, moveGrants: (bot, move) => moveSavedGrants(store, bot, move), persist: persistMcpServers, bots: () => store.bots, policy: (servers) => managedPolicy.filterMcp(servers), tell: (text, about) => notify(buildNoticeNotification(about, store.bot(about.id)?.threadId ?? "", text)), startsServers: (botId) => { const bot = store.bot(botId); return Boolean(bot && registry.get(bot.modelSelection.instanceId)?.adapter.capabilities.customMcp === true); }, boxed: () => botBox.enabled(), keys: mcpKeys, forgetSignIn: (name) => mcpOAuth.forget(name) });
const mcpOAuth = new McpOAuthManager({
file: join(DATA_DIR, "mcp-oauth.json"),
isOwnerLive: (owner) => owner === "loopback" || sessions.isLive(owner) || isCardOwnerLive(store, owner),
@@ -4830,7 +4830,7 @@ async function answerRequest(
let outcome: RequestOutcome = "unavailable";
if (instance) {
try {
- // Only a card that offered "Always allow this session" can keep one: never a guest's turn, a sandbox widening or the person's own computer.
+ // Only a card that offered "Allow for this session" can keep one: never a guest's turn, a sandbox widening or the person's own computer.
outcome = await instance.adapter.respondToRequest(threadId, requestId, { behavior, message, always: always && behavior === "allow" && card?.allowSession === true });
} catch {
outcome = "unavailable";
@@ -11807,7 +11807,7 @@ function configForAccess(status: ReturnType<typeof configStatus>, admin: boolean
};
}
-function engineMcpServers(bot: BotRecord) { return teamConnections.engineMcp(bot); }
+function engineMcpServers(bot: BotRecord) { return mcpServersHost.grantSpecs(teamConnections.engineMcp(bot)); } // approval keys: no Vault key value, no restart count
function teamAdminHost() {
if (!CLOUD_TEAM) return undefined;
@@ -12093,7 +12093,7 @@ ROUTES.push(createBotMessageRoutes({
{ emoji, name: person.name ?? person.email, at: Date.now() }),
}));
const liveRoots = (threadId: string, botId: string | undefined) => { const bot = botId ? store.bot(botId) : store.botByThread(threadId); return bot ? messageFileRootsForThread(bot.id, threadId).filter((root) => root !== ATTACHMENTS_DIR) : null; }; const chatApps = createChatApps({ store, dataDir: DATA_DIR, liveRows: liveAppRows, liveRoots, paused: () => workspaceMaintenance.active || moveFreeze.frozen() });
-const chatAppsMcp = createChatAppsMcp({ store, apps: chatApps, dataDir: DATA_DIR, keys: mcpKeys, storedServers: () => cfg.mcpServers ?? {}, mountedServers: engineMcpServers, personMcp: teamConnections.personMcp, probeAs: (server) => mcpServersHost.probeAs(server), oauth: mcpOAuth });
+const chatAppsMcp = createChatAppsMcp({ store, apps: chatApps, dataDir: DATA_DIR, keys: mcpKeys, storedServers: () => cfg.mcpServers ?? {}, mountedServers: (bot) => teamConnections.engineMcp(bot), personMcp: teamConnections.personMcp, probeAs: (server) => mcpServersHost.probeAs(server), oauth: mcpOAuth });
ROUTES.push(createChatAppRoutes({ store, apps: chatApps, threadRefusal: cloudThreadRefusal, mcpRpc: chatAppsMcp.rpc, threadVisible: (auth, threadId) => (auth.kind !== "session" || sessions.isLive(auth.session.id)) && visibleTo(viewerFor(auth)).thread(threadId) }));
const { react } = createReactions({
store, reply: (input) => teamMessages.reactedIn(input.auth, input.threadId, input.target.id, input.answer, { sendId: input.sendId, sender: messageSender(input.auth) }) ?? personReplies.deliver({ ...input, about: "message" }),
@@ -12134,7 +12134,7 @@ ROUTES.push(createBotSettingsRoutes({
canManageCommandAllowlist, commandAllowlistResponse, cardAnswerRefusal, threadRead: teamMessages.seen, levelOf, personMarkThread: personRooms.personMarkThread,
}));
const botOrderRoutes = createBotOrderRoutes({ store, visibleFor: (auth) => visibleTo(viewerFor(auth)), ...(botOrders ? { own: { person: botOrders.personOf, order: botOrders, told: (person, botIds) => broadcast({ kind: "bots.order", botIds }, { person }) } } : {}) }); ROUTES.push(createGroupOrderRoutes({ store, visibleFor: (auth) => visibleTo(viewerFor(auth)) }), botOrderRoutes, createBotAccessRoutes({ team: CLOUD_TEAM, people: teamOwners.people, store, levelOf, wireBot, publicGroupState, broadcast, audienceChanged, record: (auth, row) => appendAdminAction(DATA_DIR, { ...row, actor: decisionActorFor(auth) }), shared: createShareNotice({ people: () => teamOwners.people?.list() ?? [], profileName: (email) => teamHost.people.profile(personKey({ id: "", email })).name, store: () => store, inbox: () => teamMessages.inbox }) }), accessRequests.routes);
-const botPatchRoutes = createBotPatchRoutes({
+const botPatchRoutes = createBotPatchRoutes({ turnBots: directTurnBots,
store, cfg, registry, sessions, browserRuntime, browserLive, memoryUpkeep, cacheKeepWarm, hostedModels, supportsApprovalMode,
routines: () => routines, activeVpsThreads,
hostedWorkspace: HOSTED_WORKSPACE, hostedFullAccessRefusal: HOSTED_FULL_ACCESS_REFUSAL, desktopManaged: DESKTOP_MANAGED,
diff --git a/server/mcp-grant-spec.test.ts b/server/mcp-grant-spec.test.ts
new file mode 100644
index 0000000000..5a3f9ba565
--- /dev/null
+++ b/server/mcp-grant-spec.test.ts
@@ -0,0 +1,205 @@
+import { createHash } from "node:crypto";
+import { describe, expect, it, vi } from "vitest";
+
+import type { McpServerSpec } from "./contracts.ts";
+import { rewriteGrantLists, type GrantRewrite } from "./always-allow.ts";
+import { grantMover, grantServersMark, movedGrantKeys, moveSavedGrants, storedGrantSpec, type GrantServer } from "./mcp-grant-spec.ts";
+import { providerToolAllowKey } from "./provider-tool-allow.ts";
+
+vi.mock("./provider-tool-allow.ts", async (original) => {
+ const real = await original<typeof import("./provider-tool-allow.ts")>();
+ return { ...real, providerToolAllowKey: vi.fn(real.providerToolAllowKey) };
+});
+
+const SECRET = "sk_fake-value-in-the-vault";
+const POINTER = "vault:11111111-1111-4111-8111-111111111111";
+const stored = { command: "npx", args: ["-y", "notes-mcp"], env: { NOTES_KEY: POINTER, REGION: "eu" }, enabled: true };
+const names = storedGrantSpec("notes", stored)!;
+/** The server as a turn starts it: its Vault key read, and its restart count when it has one. */
+const started = (restarts = 0, secret = SECRET): McpServerSpec =>
+ ({ command: "npx", args: ["-y", "notes-mcp"], env: { NOTES_KEY: secret, REGION: "eu", ...(restarts ? { OMB_MCP_RESTART: String(restarts) } : {}) } });
+/** The key earlier versions saved: the fingerprint of the whole started server. */
+const earlierKey = (instance: string, server: string, tool: string, spec: unknown): string =>
+ `provider-tool:${instance}:${server}:${tool}:${createHash("sha256").update(JSON.stringify(spec)).digest("hex").slice(0, 16)}`;
+const servers = (restarts = 0): Record<string, GrantServer> => ({ notes: { names, started: started(restarts) } });
+const now = (instance: string, tool: string, spec: McpServerSpec = names) => providerToolAllowKey(instance, `mcp__notes__${tool}`, spec)!;
+
+describe("the server a saved grant names", () => {
+ it("is the config.json entry: a Vault key by its reference, and nothing a restart adds", () => {
+ expect(names).toEqual({ command: "npx", args: ["-y", "notes-mcp"], env: { NOTES_KEY: POINTER, REGION: "eu" } });
+ expect(storedGrantSpec("linear", { type: "http", url: "https://mcp.linear.app/mcp", headers: { Authorization: POINTER }, enabled: true }))
+ .toEqual({ type: "http", url: "https://mcp.linear.app/mcp", headers: { Authorization: POINTER } });
+ expect(storedGrantSpec("broken", { args: [] })).toBeNull();
+ });
+
+ it("is, for a server with no Vault key and no restart, to the letter what earlier versions fingerprinted, so its saved grants need no move", () => {
+ const plain = { command: "npx", args: ["plain-mcp"], env: { TOKEN: "plain-value" } };
+ expect(JSON.stringify(storedGrantSpec("notes", { ...plain, enabled: true }))).toBe(JSON.stringify(plain));
+ const remote = { type: "http" as const, url: "https://mcp.linear.app/mcp", headers: {} };
+ expect(JSON.stringify(storedGrantSpec("linear", { ...remote, enabled: true }))).toBe(JSON.stringify(remote));
+ });
+});
+
+describe("moving grants an earlier version saved", () => {
+ it("moves a grant saved under the key's value, or under a restart count, to the same tool on the same server", () => {
+ for (const restarts of [0, 1, 7, 20]) {
+ const saved = earlierKey("claude", "notes", "list_notes", started(restarts));
+ expect(saved).not.toBe(now("claude", "list_notes"));
+ expect(movedGrantKeys(["Bash:git status", saved], servers()), `restart count ${restarts}`).toEqual(["Bash:git status", now("claude", "list_notes")]);
+ }
+ // The count the server has today is not what the saved grant has to match.
+ expect(movedGrantKeys([earlierKey("claude", "notes", "list_notes", started(2))], servers(5))).toEqual([now("claude", "list_notes")]);
+ });
+
+ it("changes nothing once moved, and folds a moved grant into the one already saved", () => {
+ const saved = earlierKey("claude", "notes", "list_notes", started());
+ const moved = movedGrantKeys([saved], servers())!;
+ expect(movedGrantKeys(moved, servers())).toBeNull();
+ expect(movedGrantKeys([now("claude", "list_notes"), saved], servers())).toEqual([now("claude", "list_notes")]);
+ expect(movedGrantKeys([], servers())).toBeNull();
+ });
+
+ it("keeps the AI, the server and the tool of every grant it moves", () => {
+ const saved = [
+ earlierKey("claude", "notes", "list_notes", started()),
+ earlierKey("codex", "notes", "list_notes", started(3)),
+ earlierKey("openaiCompat:local", "notes", "get_note", started()),
+ ];
+ const moved = movedGrantKeys(saved, servers())!;
+ expect(moved).toEqual([now("claude", "list_notes"), now("codex", "list_notes"), now("openaiCompat:local", "get_note")]);
+ moved.forEach((key, index) => expect(key.slice(0, -16)).toBe(saved[index]!.slice(0, -16)));
+ expect(new Set(moved.map((key) => key.slice(-16))).size, "one server, one fingerprint").toBe(1);
+ });
+
+ it("never moves a grant to a server set up differently, another server, another tool or a tool that sends", () => {
+ const other = (spec: Partial<{ command: string; args: string[]; env: Record<string, string> }>) => ({ ...started(), ...spec });
+ const kept = [
+ earlierKey("claude", "notes", "list_notes", other({ command: "node" })),
+ earlierKey("claude", "notes", "list_notes", other({ args: ["-y", "notes-mcp", "--all-accounts"] })),
+ earlierKey("claude", "notes", "list_notes", other({ env: { NOTES_KEY: SECRET, REGION: "us" } })),
+ // Saved under a key value the Vault no longer holds: it stopped matching before, and is not revived.
+ earlierKey("claude", "notes", "list_notes", started(0, "sk_fake-older-value")),
+ earlierKey("claude", "notes", "list_notes", started(21)),
+ // Another server that happened to be started the same way keeps its own key.
+ earlierKey("claude", "journal", "list_notes", started()),
+ earlierKey("claude", "notes", "send_email", started()),
+ "provider-tool:claude:notes:list_notes:not-a-fingerprint",
+ "provider-tool:notes",
+ "peer:teammate",
+ "Bash:git status",
+ ];
+ expect(movedGrantKeys(kept, servers())).toBeNull();
+ // A server of that name on this bot that is set up differently today takes none of the old grants either.
+ const changed: Record<string, GrantServer> = { notes: { names: { ...names, args: ["other-mcp"] }, started: { ...started(), args: ["other-mcp"] } } };
+ expect(movedGrantKeys([earlierKey("claude", "notes", "list_notes", started())], changed)).toBeNull();
+ expect(movedGrantKeys([earlierKey("claude", "notes", "list_notes", started())], {})).toBeNull();
+ });
+
+ it("moves a grant for a server reached by URL whose header is a Vault key", () => {
+ const remote = { type: "http" as const, url: "https://notes.example/mcp", headers: { Authorization: `Bearer ${POINTER}` } };
+ const startedRemote = { ...remote, headers: { Authorization: `Bearer ${SECRET}` } };
+ const saved = earlierKey("claude", "notes", "list_notes", startedRemote);
+ expect(movedGrantKeys([saved], { notes: { names: remote, started: startedRemote } })).toEqual([now("claude", "list_notes", remote)]);
+ expect(movedGrantKeys([earlierKey("claude", "notes", "list_notes", { ...startedRemote, url: "https://elsewhere.example/mcp" })], { notes: { names: remote, started: startedRemote } })).toBeNull();
+ });
+
+ it("puts no key value in a fingerprint or a saved grant", () => {
+ const moved = movedGrantKeys([earlierKey("claude", "notes", "list_notes", started())], servers())!;
+ expect(JSON.stringify(names)).not.toContain(SECRET);
+ expect(moved.join()).not.toContain(SECRET);
+ expect(moved[0]).toMatch(/^provider-tool:claude:notes:list_notes:[a-f0-9]{16}$/);
+ // The same reference with another value behind it is the same grant: the value is not in the fingerprint.
+ expect(movedGrantKeys(moved, { notes: { names, started: started(0, "sk_fake-rotated") } })).toBeNull();
+ expect(now("claude", "list_notes")).toBe(moved[0]);
+ });
+});
+
+/** The names of every object in order, as one earlier version wrote a server before fingerprinting it. */
+const inOrder = (value: unknown): unknown => Array.isArray(value) ? value.map(inOrder)
+ : value && typeof value === "object" ? Object.fromEntries(Object.entries(value).sort(([a], [b]) => a.localeCompare(b)).map(([name, item]) => [name, inOrder(item)])) : value;
+
+describe("grants saved by the version that wrote a server's names in order", () => {
+ it("move too, under a Vault key's value or a restart count, and under no other server", () => {
+ for (const restarts of [0, 3, 20]) {
+ const saved = earlierKey("claude", "notes", "list_notes", inOrder(started(restarts)));
+ expect(saved).not.toBe(earlierKey("claude", "notes", "list_notes", started(restarts)));
+ expect(movedGrantKeys([saved], servers()), `restart count ${restarts}`).toEqual([now("claude", "list_notes")]);
+ }
+ expect(movedGrantKeys([earlierKey("claude", "notes", "list_notes", inOrder({ ...started(), args: ["other-mcp"] }))], servers())).toBeNull();
+ expect(movedGrantKeys([earlierKey("claude", "notes", "list_notes", inOrder(started(21)))], servers())).toBeNull();
+ const remote = { type: "http" as const, url: "https://notes.example/mcp", headers: { Authorization: `Bearer ${POINTER}` } };
+ const startedRemote = { ...remote, headers: { Authorization: `Bearer ${SECRET}` } };
+ expect(movedGrantKeys([earlierKey("claude", "notes", "list_notes", inOrder(startedRemote))], { notes: { names: remote, started: startedRemote } })).toEqual([now("claude", "list_notes", remote)]);
+ });
+});
+
+describe("what moving a bot's grants costs", () => {
+ const keyFor = vi.mocked(providerToolAllowKey);
+ const tenServers = (): Record<string, GrantServer> => Object.fromEntries(Array.from({ length: 10 }, (_, i) => {
+ const spec = { command: "npx", args: [`server-${i}`], env: { KEY: POINTER } };
+ return [`server${i}`, { names: spec, started: { ...spec, env: { KEY: SECRET } } }];
+ }));
+ const savedKeys = (all: Record<string, GrantServer>) => Array.from({ length: 150 }, (_, i) => earlierKey("claude", `server${i % 10}`, `list_${i}`, all[`server${i % 10}`]!.started));
+
+ it("works each distinct key out once however many threads hold it, and saves the bot and all its threads in one write", () => {
+ const all = tenServers();
+ const keys = savedKeys(all);
+ const bot = { id: "iris", alwaysAllow: [...keys], tasks: Array.from({ length: 200 }, () => ({ alwaysAllow: [...keys, "Bash:ls"] })) };
+ const save = vi.fn();
+ const store = { rewriteGrants: (_botId: string, rewrite: GrantRewrite) => rewriteGrantLists(bot, rewrite, save) };
+ keyFor.mockClear();
+ moveSavedGrants(store, { id: "iris", alwaysAllow: [...keys] }, grantMover(all));
+ expect(save, "one write for the bot and its 200 threads").toHaveBeenCalledOnce();
+ expect(keyFor.mock.calls.length, "150 distinct keys, 30,000 held").toBe(150);
+ const moved = bot.alwaysAllow;
+ expect(moved).toEqual(keys.map((_key, i) => providerToolAllowKey("claude", `mcp__server${i % 10}__list_${i}`, all[`server${i % 10}`]!.names)));
+ expect(bot.tasks.every((task) => JSON.stringify(task.alwaysAllow) === JSON.stringify([...moved, "Bash:ls"]))).toBe(true);
+
+ // Gone over again by a new mover (a later start): keys already moved are told apart without a write.
+ keyFor.mockClear();
+ moveSavedGrants(store, { id: "iris", alwaysAllow: [...moved] }, grantMover(all));
+ expect(save).toHaveBeenCalledOnce();
+ expect(keyFor.mock.calls.length, "no key is worked out again").toBe(0);
+ });
+
+ it("puts every list back when the one save fails, so a grant is never half moved", () => {
+ const all = tenServers();
+ const keys = savedKeys(all);
+ const bot = { id: "iris", alwaysAllow: [...keys], tasks: [{ alwaysAllow: [...keys] }, {}] };
+ const store = { rewriteGrants: (_botId: string, rewrite: GrantRewrite) => rewriteGrantLists(bot, rewrite, () => { throw new Error("fixture disk full"); }) };
+ const live = { id: "iris", alwaysAllow: [...keys] };
+ expect(() => moveSavedGrants(store, live, grantMover(all))).toThrow("fixture disk full");
+ expect(bot).toEqual({ id: "iris", alwaysAllow: keys, tasks: [{ alwaysAllow: keys }, {}] });
+ expect(live.alwaysAllow).toEqual(keys);
+ });
+
+ it("tells one set of servers from another without keeping a key value", () => {
+ const all = tenServers();
+ expect(grantServersMark(all)).toBe(grantServersMark(tenServers()));
+ expect(grantServersMark(all)).toMatch(/^[a-f0-9]{64}$/);
+ expect(grantServersMark({ ...all, server0: { ...all.server0!, started: { ...all.server0!.started, env: { KEY: "sk_fake-rotated" } } as McpServerSpec } })).not.toBe(grantServersMark(all));
+ });
+});
+
+describe("where a bot's moved grants are saved", () => {
+ it("moves the bot's own, each thread's and the starting turn's, and leaves every other bot alone", () => {
+ const saved = earlierKey("claude", "notes", "list_notes", started(4));
+ const bots = new Map([
+ ["iris", { id: "iris", alwaysAllow: [saved, "Bash:ls"], tasks: [{ threadId: "a", alwaysAllow: [saved] }, { threadId: "b", alwaysAllow: [] as string[] }, { threadId: "c" }] }],
+ ["paul", { id: "paul", alwaysAllow: [saved], tasks: [{ threadId: "p", alwaysAllow: [saved] }] }],
+ ]);
+ const writes: string[] = [];
+ const store = { rewriteGrants: (botId: string, rewrite: GrantRewrite) => Boolean(bots.get(botId) && rewriteGrantLists(bots.get(botId)!, rewrite, () => writes.push(botId))) };
+ const live = { id: "iris", alwaysAllow: [saved] };
+ const move = grantMover(servers());
+ moveSavedGrants(store, live, move);
+ const key = now("claude", "list_notes");
+ expect(bots.get("iris")).toEqual({ id: "iris", alwaysAllow: [key, "Bash:ls"], tasks: [{ threadId: "a", alwaysAllow: [key] }, { threadId: "b", alwaysAllow: [] }, { threadId: "c" }] });
+ expect(live.alwaysAllow).toEqual([key]);
+ expect(bots.get("paul"), "another bot's grant is its own to move, in its own turn").toEqual({ id: "paul", alwaysAllow: [saved], tasks: [{ threadId: "p", alwaysAllow: [saved] }] });
+ expect(writes).toEqual(["iris"]);
+ moveSavedGrants(store, live, move);
+ expect(writes, "nothing is written when nothing moves").toHaveLength(1);
+ moveSavedGrants(store, { id: "gone" }, move);
+ });
+});
diff --git a/server/mcp-grant-spec.ts b/server/mcp-grant-spec.ts
new file mode 100644
index 0000000000..e09626dabb
--- /dev/null
+++ b/server/mcp-grant-spec.ts
@@ -0,0 +1,100 @@
+// What a saved "Always allow" for an MCP tool is tied to on its server: the server as config.json holds it. A Vault key is
+// there as its reference (`vault:<id>`), never its value, and the restart count is not there at all, so a new key value or
+// a restart leaves every saved grant in place, while a changed command, argument, variable, address or header ends it.
+import { createHash } from "node:crypto";
+
+import type { McpServerSpec } from "./contracts.ts";
+import { MCP_RESTART_ENV } from "./mcp-app-catalog.ts";
+import { isRemoteMcpServer, parseStoredMcpServer } from "./mcp-registry.ts";
+import { providerToolAllowKey } from "./provider-tool-allow.ts";
+import type { GrantRewrite } from "./always-allow.ts";
+
+const PREFIX = "provider-tool:";
+/** A restart count an earlier version may have saved a grant under: counted since the app started, so it stays small. */
+const EARLIER_RESTARTS = 20;
+
+/** The server a grant names, from its config.json entry; null when that entry is not a server. */
+export function storedGrantSpec(name: string, raw: unknown): McpServerSpec | null {
+ const parsed = parseStoredMcpServer(name, raw);
+ if (!parsed.ok) return null;
+ return isRemoteMcpServer(parsed.server)
+ ? { type: parsed.server.type, url: parsed.server.url, headers: parsed.server.headers }
+ : { command: parsed.server.command, args: parsed.server.args, env: parsed.server.env };
+}
+
+const fingerprint = (spec: unknown): string => createHash("sha256").update(JSON.stringify(spec)).digest("hex").slice(0, 16);
+
+/** `value` with every object's names in order, as one earlier version wrote a server before fingerprinting it. */
+function sorted(value: unknown): unknown {
+ if (Array.isArray(value)) return value.map(sorted);
+ if (value && typeof value === "object") return Object.fromEntries(Object.entries(value).sort(([a], [b]) => a.localeCompare(b)).map(([name, item]) => [name, sorted(item)]));
+ return value;
+}
+
+/** The fingerprints earlier versions gave this server: of it as started, its Vault keys read, at each restart count,
+ * with its names as written and in order (both were shipped).
+ * Security: made from key values only to compare with a saved one; none is kept, logged or returned to a caller outside. */
+function earlierFingerprints(started: McpServerSpec): Set<string> {
+ const both = (spec: unknown): string[] => [fingerprint(spec), fingerprint(sorted(spec))];
+ if (!("command" in started)) return new Set(both(started));
+ const { [MCP_RESTART_ENV]: _restarts, ...env } = started.env;
+ const prints = new Set(both({ ...started, env }));
+ for (let count = 1; count <= EARLIER_RESTARTS; count += 1) for (const print of both({ ...started, env: { ...env, [MCP_RESTART_ENV]: String(count) } })) prints.add(print);
+ return prints;
+}
+
+/** A server a bot's turn starts: as a grant names it now, and as the turn starts it. */
+export interface GrantServer { names: McpServerSpec; started: McpServerSpec }
+
+/** What tells one set of servers from another, so a bot whose servers are as they were is not gone over again. Kept in
+ * memory only: a hash, as the servers as started hold key values. */
+export const grantServersMark = (servers: Record<string, GrantServer>): string => createHash("sha256").update(JSON.stringify(servers)).digest("hex");
+
+/** Moves the grants an earlier version saved for one of `servers` to that server's key now: each list it is given comes
+ * back moved, or null when nothing in it moved. A key moves only when it is, to the letter, the key that version gave the
+ * same tool on the same server as it is set up now: only its fingerprint changes, so it reaches no other bot, AI, server or
+ * tool than it did. One mover serves all of a bot's lists: a server's fingerprints are made once, when a saved key first
+ * names it, and each distinct key is worked out once, so the cost follows the keys that differ, not the threads. */
+export function grantMover(servers: Record<string, GrantServer>): GrantRewrite {
+ const earlier = new Map<string, Set<string>>();
+ const known = new Map<string, string>();
+ const moveOne = (key: string): string => {
+ const cut = key.lastIndexOf(":");
+ if (!key.startsWith(PREFIX) || cut < PREFIX.length) return key;
+ const body = key.slice(PREFIX.length, cut), print = key.slice(cut + 1);
+ for (const [name, server] of Object.entries(servers)) {
+ const marker = `:${name}:`;
+ for (let at = body.indexOf(marker); at > 0; at = body.indexOf(marker, at + 1)) {
+ let prints = earlier.get(name);
+ if (!prints) earlier.set(name, prints = earlierFingerprints(server.started));
+ if (!prints.has(print)) continue;
+ const now = providerToolAllowKey(body.slice(0, at), `mcp__${name}__${body.slice(at + marker.length)}`, server.names);
+ if (now && now !== key && now.slice(0, now.lastIndexOf(":")) === key.slice(0, cut)) return now;
+ }
+ }
+ return key;
+ };
+ return (keys) => {
+ let moved = false;
+ const next = keys.map((key) => {
+ let now = known.get(key);
+ if (now === undefined) known.set(key, now = moveOne(key));
+ moved ||= now !== key;
+ return now;
+ });
+ return moved ? [...new Set(next)] : null;
+ };
+}
+
+/** One list, moved (see grantMover), or null when nothing in it moved. */
+export const movedGrantKeys = (keys: readonly string[], servers: Record<string, GrantServer>): string[] | null => grantMover(servers)(keys);
+
+interface GrantStore { rewriteGrants(botId: string, rewrite: GrantRewrite): boolean }
+
+/** Applies `move` to everything a bot's grants are read from: the bot and each of its threads, in one save, and the turn
+ * now starting. */
+export function moveSavedGrants(store: GrantStore, live: { id: string; alwaysAllow?: string[] }, move: GrantRewrite): void {
+ store.rewriteGrants(live.id, move);
+ const turn = live.alwaysAllow ? move(live.alwaysAllow) : null;
+ if (turn) live.alwaysAllow = turn;
+}
diff --git a/server/routes/bot-patch.ts b/server/routes/bot-patch.ts
index e5d64b4511..ee3ecc83cc 100644
--- a/server/routes/bot-patch.ts
+++ b/server/routes/bot-patch.ts
@@ -8,7 +8,7 @@ import { normalizePhoneApps } from "../../shared/phone-apps.ts";
import { parseToolScope, toolScopeWidens } from "../../shared/tool-scope.ts";
import { parseToolsOff, TOOL_GROUPS } from "../../shared/tool-groups.ts";
import { isMausColor, MAUS_COLOR_NAMES, type BotUpdateResponse, type WireBot, type WireGroup } from "../../shared/wire.ts";
-import { MAX_ALWAYS_ALLOW } from "../always-allow.ts";
+import { dropRemovedGrants, MAX_ALWAYS_ALLOW } from "../always-allow.ts";
import { checkBrowserProfileChange, settleBrowserChange } from "../bot-browser-profile.ts";
import { validateBotCwd } from "../bot-cwd.ts";
import { parseBotProfilePatch } from "../bot-profile.ts";
@@ -88,6 +88,8 @@ export interface BotPatchRouteDeps {
shownThread?(auth: RequestAuth, bot: BotRecord): string;
/** The Chief of Staff of a scope changed: these bots' flags did. */
chiefChanged?(changed: readonly BotRecord[]): void;
+ /** The bots of the turns now running, each with the grants its turn reads. */
+ turnBots?: { values(): Iterable<BotRecord> };
}
export function createBotPatchRoutes(deps: BotPatchRouteDeps): RouteHandler {
@@ -693,6 +695,7 @@ export function createBotPatchRoutes(deps: BotPatchRouteDeps): RouteHandler {
(freshBrowserBot.busy || browserRuntime.heldBy(currentBrowserSession(freshBrowserBot.id, freshBrowserBot.browserProfile)))) {
return json(res, 409, { error: "Stop the bot and release browser control before changing its profile." });
}
+ if (Array.isArray(patch.alwaysAllow)) dropRemovedGrants(store, deps.turnBots?.values() ?? [], m[1], patch.alwaysAllow);
if (profile.patch.soul !== undefined) {
if (freshBrowserBot) assertTeamComputerChangeIdle(freshBrowserBot, { ...freshBrowserBot, ...patch } as BotRecord);
// Runtime fields keep their fail-closed order; only the profile fields commit atomically.
diff --git a/server/store.test.ts b/server/store.test.ts
index 6409e63a97..41f7bf422c 100644
--- a/server/store.test.ts
+++ b/server/store.test.ts
@@ -1221,6 +1221,7 @@ describe("Store", () => {
alwaysAllow: ["provider-tool:claude:linear:list_comments:config-one"],
});
+ rmSync(join(DATA_DIR, "always-allow-recovered"), { force: true }); // a data folder from the version that saved them there
const reloaded = new Store(selection);
expect(reloaded.bot(bot.id)?.alwaysAllow).toEqual([
"provider-tool:claude:linear:list_comments:config-one",
@@ -1237,6 +1238,51 @@ describe("Store", () => {
);
});
+ it("says how many grants it kept when a bot's threads hold more than its list has room for, and drops none of the bot's own", () => {
+ const store = new Store(selection);
+ const bot = store.createBot();
+ const own = Array.from({ length: 195 }, (_, i) => `provider-tool:claude:linear:own_${i}:config-one`);
+ const inThread = Array.from({ length: 12 }, (_, i) => `provider-tool:claude:linear:thread_${i}:config-one`);
+ store.patchBot(bot.id, { alwaysAllow: own });
+ store.patchTask(bot.id, bot.threadId, { alwaysAllow: [...inThread, "Bash:git status"] });
+ rmSync(join(DATA_DIR, "always-allow-recovered"), { force: true });
+ const warned = vi.spyOn(console, "warn").mockImplementation(() => {});
+ try {
+ const reloaded = new Store(selection);
+ expect(reloaded.bot(bot.id)?.alwaysAllow).toEqual([...own, ...inThread.slice(0, 5)]);
+ expect(reloaded.taskByThread(bot.id, bot.threadId)?.alwaysAllow, "what did not fit leaves the thread too").toEqual([...inThread.slice(0, 5), "Bash:git status"]);
+ new Store(selection);
+ const lines = warned.mock.calls.map(([line]) => String(line)).filter((line) => line.startsWith("[always-allow]"));
+ expect(lines, "said once, not at every start").toEqual([`[always-allow] bot ${bot.id}: kept 200 of 207 always-allowed tools (the limit is 200); the other 7 ask again.`]);
+ } finally {
+ warned.mockRestore();
+ }
+ });
+
+ it("removes a grant from every thread in one save, and a restart does not bring it back", () => {
+ const store = new Store(selection);
+ const bot = store.createBot();
+ const [kept, removed] = ["provider-tool:claude:linear:list_issues:config-one", "provider-tool:claude:linear:list_comments:config-one"];
+ store.patchBot(bot.id, { alwaysAllow: [kept, removed] });
+ store.patchTask(bot.id, bot.threadId, { alwaysAllow: [kept, removed, "Bash:git status"] });
+ const sibling = store.createTask(bot.id)!;
+ expect(sibling.alwaysAllow).toEqual([kept, removed]);
+ const save = vi.spyOn(store as unknown as { saveBots(): void }, "saveBots");
+ expect(store.rewriteGrants(bot.id, (keys) => (keys.includes(removed) ? keys.filter((key) => key !== removed) : null), true)).toBe(true);
+ expect(save).toHaveBeenCalledOnce();
+ expect(store.rewriteGrants(bot.id, () => null)).toBe(false);
+ expect(store.rewriteGrants("nobody", () => [])).toBe(false);
+ expect(save).toHaveBeenCalledOnce();
+ save.mockRestore();
+ for (const loaded of [store, new Store(selection), new Store(selection)]) {
+ expect(loaded.bot(bot.id)?.alwaysAllow).toEqual([kept]);
+ expect(loaded.tasks(bot.id).map((task) => task.alwaysAllow)).toEqual([[kept], [kept, "Bash:git status"]]);
+ }
+ // A thread left holding a copy by an earlier version does not hand it back to the bot at the next start.
+ store.patchTask(bot.id, sibling.threadId, { alwaysAllow: [kept, removed] });
+ expect(new Store(selection).bot(bot.id)?.alwaysAllow).toEqual([kept]);
+ });
+
it("persists a bot's effort level across a restart, defaulting to unset", () => {
const store = new Store(selection);
const bot = store.createBot();
diff --git a/server/store.ts b/server/store.ts
index dda25d09a1..e1d7c137d0 100644
--- a/server/store.ts
+++ b/server/store.ts
@@ -35,7 +35,7 @@ import type {
WireMessage, WireTask, BotProject as BotProjectRecord,
} from "../shared/wire.ts";
import { movesThreadToTop, nextOpenThread } from "../shared/wire.ts";
-import { parseConnectorTools } from "./connector-tools.ts";
+import { parseConnectorTools } from "./connector-tools.ts"; import { recoverThreadGrantsOnce, rewriteGrantLists, type GrantRewrite } from "./always-allow.ts";
import { sameModelSelection } from "../shared/thread-model.ts";
import { initialGreetingMessage } from "./initial-greeting.ts"; import { createDefaultBot, defaultBotRefusal, type DefaultBotIntro } from "./default-bot.ts";
import { appsFromCreator } from "./inherited-apps.ts"; import { newBotOwner, sharedAsMaker, sharedUnlessRestricted, type NewBotSharingRule } from "./new-bot-sharing.ts";
@@ -436,17 +436,7 @@ export class Store {
delete b.approvePeerComms;
botsMigrated = true;
}
- // Recover only app-issued provider-tool grants into bot defaults, never task/session grants such as shell commands.
- for (const b of this.bots) {
- const taskProviderGrants = (b.tasks ?? []).flatMap((task) =>
- (task.alwaysAllow ?? []).filter((key) => key.startsWith("provider-tool:")),
- );
- if (!taskProviderGrants.length) continue;
- const migrated = [...new Set([...(b.alwaysAllow ?? []), ...taskProviderGrants])].slice(0, 200);
- if (JSON.stringify(migrated) === JSON.stringify(b.alwaysAllow ?? [])) continue;
- b.alwaysAllow = migrated;
- botsMigrated = true;
- }
+ if (recoverThreadGrantsOnce(DATA_DIR, this.bots)) botsMigrated = true;
const botIds = new Set(this.bots.map((b) => b.id));
for (const g of this.groups) {
g.busyBotId = null;
@@ -2133,7 +2123,7 @@ export class Store {
setAllThreadApprovalMode(botId: string, mode: Exclude<ApprovalMode, "custom">): BotRecord | null {
const bot = this.bot(botId);
if (!bot) return null;
- const patch = { approvalMode: mode, autoApprove: mode === "auto", ...(mode === "full" ? { alwaysAllow: [] } : {}) };
+ const patch = { approvalMode: mode, autoApprove: mode === "auto" }; // saved grants stay through Full access, unused there, so a later Ask keeps them
const tasks = (bot.tasks ?? []).map(task => ({ ...task, ...patch }));
const next = { ...bot, ...patch, approvalGrant: undefined, tasks };
this.saveBots(this.bots.map(candidate => candidate === bot ? next : candidate));
@@ -2143,6 +2133,14 @@ export class Store {
return bot;
}
+ /** Rewrites the bot's own "Always allow" list and each of its threads' in one save (always-allow.ts). */
+ rewriteGrants(botId: string, rewrite: GrantRewrite, removal = false): boolean {
+ const bot = this.bot(botId);
+ if (!bot || !rewriteGrantLists(bot, rewrite, () => this.saveBots(), removal)) return false;
+ this.emit({ type: "bot", botId });
+ return true;
+ }
+
/** An uncommitted grant is ignored, so a refresh cannot copy the temporary Ask mask. */
refreshTaskPermissions(botId: string, threadId: string): TaskRecord | null {
const bot = this.bot(botId);
diff --git a/src/components/PendingApproval.command-allowlist.test.ts b/src/components/PendingApproval.command-allowlist.test.ts
index b20b8eed5c..77c7003628 100644
--- a/src/components/PendingApproval.command-allowlist.test.ts
+++ b/src/components/PendingApproval.command-allowlist.test.ts
@@ -62,7 +62,7 @@ describe("remembering exact command approvals", () => {
const result = view();
expect(result.html).toContain("Always allow this command");
expect(result.html).toContain("/work/project");
- expect(result.html).not.toContain("Always allow this session");
+ expect(result.html).not.toContain("Allow for this session");
result.buttons.find((button) => button.props["aria-label"] === "Always allow this command")!.props.onClick!();
expect(fixture.dispatch).toHaveBeenCalledExactlyOnceWith(expect.objectContaining({
type: "decideRequest", threadId: "thread-1", requestId: "request-1", behavior: "allow", rememberCommand: true,
@@ -84,17 +84,34 @@ describe("remembering exact command approvals", () => {
fixture.admin = admin;
const result = view();
expect(result.html).not.toContain("Always allow this command");
- expect(result.html).toContain("Always allow this session");
+ expect(result.html).toContain("Allow for this session");
expect(result.html).toContain("Allow once");
});
it("preserves session approval for requests without an exact command", () => {
- view({ commandAllowlist: undefined }).buttons.find((button) => button.props["aria-label"] === "Always allow this session")!.props.onClick!();
+ view({ commandAllowlist: undefined }).buttons.find((button) => button.props["aria-label"] === "Allow for this session")!.props.onClick!();
expect(fixture.dispatch).toHaveBeenCalledExactlyOnceWith(expect.objectContaining({
behavior: "allow", always: true, rememberCommand: undefined,
}));
});
+ it("says Always allow only when the grant is saved, and names the session when it lasts no longer than that", () => {
+ const quiet = (extra: Parameters<typeof view>[0]) => view(extra).buttons.find((button) => button.props.onClick && !["Allow once", "Deny", "Cancel turn"].includes(String(button.props.children)))!;
+ const saved = quiet({ commandAllowlist: undefined, allowKey: "provider-tool:claude:linear:list_issues:0123456789abcdef" });
+ expect(saved.props.children).toBe("Always allow");
+ const command = quiet({});
+ expect(command.props.children).toBe("Always allow");
+ expect(command.props["aria-label"]).toBe("Always allow this command");
+ const session = view({ commandAllowlist: undefined });
+ const button = quiet({ commandAllowlist: undefined });
+ expect(button.props.children).toBe("Allow for this session");
+ expect(button.props["aria-label"]).toBe("Allow for this session");
+ expect(session.html).not.toContain("Always allow");
+ expect(session.html).toContain("until the session ends");
+ button.props.onClick!();
+ expect(fixture.dispatch).toHaveBeenCalledExactlyOnceWith(expect.objectContaining({ behavior: "allow", always: true, alwaysAllow: undefined, rememberCommand: undefined }));
+ });
+
it("keeps peer grants separate from provider command rules", () => {
const result = view({ allowKey: "peer:teammate" });
expect(result.html).not.toContain("Always allow this command");
diff --git a/src/components/PendingApproval.tsx b/src/components/PendingApproval.tsx
index 4c26ebb596..16fa9e8dd0 100644
--- a/src/components/PendingApproval.tsx
+++ b/src/components/PendingApproval.tsx
@@ -308,11 +308,12 @@ export function PendingApprovalActions({
}
const always = durableRequest ? null
: bot && pending.allowKey
- ? { name: t("approval.action.alwaysAllow"), hint: t("approval.action.stopAsking", { name: bot.name, key: pending.allowKey }), run: () => decide("allow", true) }
+ ? { label: t("approval.action.alwaysAllow"), name: t("approval.action.alwaysAllow"), hint: t("approval.action.stopAsking", { name: bot.name, key: pending.allowKey }), run: () => decide("allow", true) }
: canRememberCommand && pending.commandAllowlist
- ? { name: t("approval.action.alwaysAllowCommand"), hint: t("approval.action.alwaysAllowCommandHint", { cwd: pending.commandAllowlist.cwd }), run: () => decide("allow", false, true) }
+ ? { label: t("approval.action.alwaysAllow"), name: t("approval.action.alwaysAllowCommand"), hint: t("approval.action.alwaysAllowCommandHint", { cwd: pending.commandAllowlist.cwd }), run: () => decide("allow", false, true) }
: !pending.allowKey && pending.allowSession
- ? { name: t("approval.action.alwaysAllowSession"), hint: t("approval.action.alwaysAllowSessionHint"), run: () => decide("allow", true) }
+ // Nothing is saved for this one: it lasts while the AI's session does, and the button says so.
+ ? { label: t("approval.action.allowSession"), name: t("approval.action.allowSession"), hint: t("approval.action.alwaysAllowSessionHint"), run: () => decide("allow", true) }
: null;
const more = showMore && !durableRequest ? [
<button key="cancel" type="button" onClick={onCancelTurn} className={ASK_QUIET_ANSWER}>
@@ -329,7 +330,7 @@ export function PendingApprovalActions({
title={always.hint}
className={ASK_QUIET_ANSWER}
>
- {t("approval.action.alwaysAllow")}
+ {always.label}
</button>
),
<button
diff --git a/src/components/bot-buttons.test.ts b/src/components/bot-buttons.test.ts
index f4271b2333..fe6cd2e12c 100644
--- a/src/components/bot-buttons.test.ts
+++ b/src/components/bot-buttons.test.ts
@@ -65,14 +65,14 @@ const question: Message = {
};
describe("a bot's cards answer in its own colour", () => {
- it("paints Allow once in the asking bot's colour, while Deny is the neutral second answer and Always allow stays quiet", () => {
+ it("paints Allow once in the asking bot's colour, while Deny is the neutral second answer and the allow that lasts stays quiet", () => {
const html = approval({ id: "scout", name: "Scout", color: "pink" } as Bot);
expectOwn(button(html, t("approval.action.allowOnce")), "pink");
const deny = button(html, t("approval.action.deny"));
expectPlain(deny);
expect(classes(deny)).toEqual(expect.arrayContaining(["bg-ink/[0.07]", "text-ink"]));
expect(classes(deny).some((name) => name.includes("danger"))).toBe(false);
- const always = button(html, t("approval.action.alwaysAllow"));
+ const always = button(html, t("approval.action.allowSession"));
expectPlain(always);
expect(classes(always)).toContain("text-ink-secondary");
expect(classes(button(approval(), t("approval.action.allowOnce")))).toContain("bg-accent");
diff --git a/src/locales/en.json b/src/locales/en.json
index 7de45c130d..a3e2f91196 100644
--- a/src/locales/en.json
+++ b/src/locales/en.json
@@ -1181,7 +1181,7 @@
"approval.action.deny": "Deny",
"approval.action.stopAsking": "Stop asking {name} about {key}",
"approval.action.alwaysAllow": "Always allow",
- "approval.action.alwaysAllowSession": "Always allow this session",
+ "approval.action.allowSession": "Allow for this session",
"approval.action.alwaysAllowSessionHint": "The provider stops asking about this action until the session ends",
"approval.action.alwaysAllowCommand": "Always allow this command",
"approval.action.alwaysAllowCommandHint": "Remember this exact command for this bot and provider in {cwd}, including other threads using that folder",
diff --git a/src/locales/es.json b/src/locales/es.json
index 52b0dd26ee..c361d0a7aa 100644
--- a/src/locales/es.json
+++ b/src/locales/es.json
@@ -824,7 +824,7 @@
"approval.action.deny": "Denegar",
"approval.action.stopAsking": "Dejar de preguntar a {name} sobre {key}",
"approval.action.alwaysAllow": "Permitir siempre",
- "approval.action.alwaysAllowSession": "Permitir siempre en esta sesión",
+ "approval.action.allowSession": "Permitir en esta sesión",
"approval.action.alwaysAllowSessionHint": "El proveedor deja de preguntar por esta acción hasta que termine la sesión",
"approval.action.alwaysAllowCommand": "Permitir siempre este comando",
"approval.action.alwaysAllowCommandHint": "Recordar este comando exacto para este bot y proveedor en {cwd}, incluidos otros hilos que usen esa carpeta",
diff --git a/src/locales/it.json b/src/locales/it.json
index 93e1943c92..c193891f0c 100644
--- a/src/locales/it.json
+++ b/src/locales/it.json
@@ -890,7 +890,7 @@
"approval.action.deny": "Rifiuta",
"approval.action.stopAsking": "Smetti di chiedere a {name} riguardo a {key}",
"approval.action.alwaysAllow": "Consenti sempre",
- "approval.action.alwaysAllowSession": "Consenti sempre in questa sessione",
+ "approval.action.allowSession": "Consenti in questa sessione",
"approval.action.alwaysAllowSessionHint": "Il fornitore smette di chiedere di questa azione fino alla fine della sessione",
"approval.action.alwaysAllowCommand": "Consenti sempre questo comando",
"approval.action.alwaysAllowCommandHint": "Ricorda questo comando esatto per questo bot e questo fornitore in {cwd}, anche negli altri fili che usano quella cartella",
diff --git a/src/locales/ja.json b/src/locales/ja.json
index dc9e9541d1..db97e4ba0d 100644
--- a/src/locales/ja.json
+++ b/src/locales/ja.json
@@ -1012,7 +1012,7 @@
"approval.action.deny": "拒否",
"approval.action.stopAsking": "{name} に {key} を今後聞かない",
"approval.action.alwaysAllow": "常に許可",
- "approval.action.alwaysAllowSession": "このセッションでは常に許可",
+ "approval.action.allowSession": "このセッションでは許可",
"approval.action.alwaysAllowSessionHint": "セッションが終わるまで、プロバイダーはこの操作の確認を求めません",
"approval.action.alwaysAllowCommand": "このコマンドを常に許可",
"approval.action.alwaysAllowCommandHint": "{cwd} で使うこのコマンドを、このボットとプロバイダーについて完全一致で記憶します。同じフォルダーを使う他のスレッドにも適用されます",
diff --git a/src/locales/ko.json b/src/locales/ko.json
index 9524070687..fcf0f600ad 100644
--- a/src/locales/ko.json
+++ b/src/locales/ko.json
@@ -952,7 +952,7 @@
"approval.action.deny": "거부",
"approval.action.stopAsking": "{key}에 대해 {name}에게 더 묻지 않기",
"approval.action.alwaysAllow": "항상 허용",
- "approval.action.alwaysAllowSession": "이 세션 동안 항상 허용",
+ "approval.action.allowSession": "이 세션 동안 허용",
"approval.action.alwaysAllowSessionHint": "세션이 끝날 때까지 제공자가 이 작업에 대해 묻지 않아요",
"approval.action.alwaysAllowCommand": "이 명령 항상 허용",
"approval.action.alwaysAllowCommandHint": "{cwd}에서 이 봇과 제공자에 대해 정확히 이 명령을 기억해요. 같은 폴더를 쓰는 다른 스레드에도 적용돼요",
diff --git a/src/locales/pl.json b/src/locales/pl.json
index 894e21709c..74c9bf7b0d 100644
--- a/src/locales/pl.json
+++ b/src/locales/pl.json
@@ -897,7 +897,7 @@
"approval.action.deny": "Odrzuć",
"approval.action.stopAsking": "Niech {name} nie dostaje już pytań o {key}",
"approval.action.alwaysAllow": "Zawsze zezwalaj",
- "approval.action.alwaysAllowSession": "Zawsze zezwalaj w tej sesji",
+ "approval.action.allowSession": "Zezwól w tej sesji",
"approval.action.alwaysAllowSessionHint": "Dostawca przestaje pytać o tę akcję do końca sesji",
"approval.action.alwaysAllowCommand": "Zawsze zezwalaj na tę komendę",
"approval.action.alwaysAllowCommandHint": "Zapamiętaj tę dokładną komendę dla tego bota i dostawcy w {cwd}, także w innych wątkach korzystających z tego folderu",
diff --git a/src/locales/pt-br.json b/src/locales/pt-br.json
index bd2a0c432a..3441bea5c7 100644
--- a/src/locales/pt-br.json
+++ b/src/locales/pt-br.json
@@ -1143,7 +1143,7 @@
"approval.action.deny": "Negar",
"approval.action.stopAsking": "Não perguntar mais a {name} sobre {key}",
"approval.action.alwaysAllow": "Sempre permitir",
- "approval.action.alwaysAllowSession": "Sempre permitir nesta sessão",
+ "approval.action.allowSession": "Permitir nesta sessão",
"approval.action.alwaysAllowSessionHint": "O provedor deixa de pedir aprovação para esta ação até a sessão terminar",
"approval.action.alwaysAllowCommand": "Sempre permitir este comando",
"approval.action.alwaysAllowCommandHint": "Lembrar este comando exato para este bot e provedor em {cwd}, inclusive em outras conversas que usam essa pasta",
diff --git a/src/locales/ru.json b/src/locales/ru.json
index 69f31d160c..a2fe9180e8 100644
--- a/src/locales/ru.json
+++ b/src/locales/ru.json
@@ -903,7 +903,7 @@
"approval.action.deny": "Отклонить",
"approval.action.stopAsking": "Больше не спрашивать {name} про {key}",
"approval.action.alwaysAllow": "Всегда разрешать",
- "approval.action.alwaysAllowSession": "Всегда разрешать в этом сеансе",
+ "approval.action.allowSession": "Разрешить в этом сеансе",
"approval.action.alwaysAllowSessionHint": "Провайдер перестанет запрашивать подтверждение этого действия до конца сеанса",
"approval.action.alwaysAllowCommand": "Всегда разрешать эту команду",
"approval.action.alwaysAllowCommandHint": "Сохраняет эту точную команду для этого бота и провайдера в {cwd}, включая другие ветки, использующие эту папку",
diff --git a/src/locales/source-hashes.json b/src/locales/source-hashes.json
index 8733f99277..0cbf1b34ee 100644
--- a/src/locales/source-hashes.json
+++ b/src/locales/source-hashes.json
@@ -4439,7 +4439,7 @@
"approval.action.deny": "05a2d7332eb9d8bf164487c743a2e93c21b16bb2061a93e3ee2ceb508eadb753",
"approval.action.stopAsking": "dad873d89afcd6885cc1acc13e9c7280c31b377b37fb4a4d2aef451dee1dc203",
"approval.action.alwaysAllow": "977618bd8bc7eef4d3bada0cf1a791d8362cd5fd8680e9673566abab2e76dded",
- "approval.action.alwaysAllowSession": "4d95e3c6a834d5f33a8e010d4c3ef2dfbe6dfca6718bbf190d6bd78b529278a6",
+ "approval.action.allowSession": "42ab016a7a8a3b18822b8a34651d943ac3aba2aaa33abc45d59cb48557f997b5",
"approval.action.alwaysAllowSessionHint": "8c0a1379b7a44c55bfb11a6225a68373448afb5f0e2cf9710c096ecef25c3def",
"approval.action.alwaysAllowCommand": "137ecfa27e10f893e2770d3011a137cbeec755be97eb83b972eb3d301877db26",
"approval.action.alwaysAllowCommandHint": "6e2b74cd2eda2d5ea788de5663fdc42308c4bd764aff66d59723bb2a773a0b83",
@@ -18515,7 +18515,7 @@
"approval.action.deny": "05a2d7332eb9d8bf164487c743a2e93c21b16bb2061a93e3ee2ceb508eadb753",
"approval.action.stopAsking": "dad873d89afcd6885cc1acc13e9c7280c31b377b37fb4a4d2aef451dee1dc203",
"approval.action.alwaysAllow": "977618bd8bc7eef4d3bada0cf1a791d8362cd5fd8680e9673566abab2e76dded",
- "approval.action.alwaysAllowSession": "4d95e3c6a834d5f33a8e010d4c3ef2dfbe6dfca6718bbf190d6bd78b529278a6",
+ "approval.action.allowSession": "42ab016a7a8a3b18822b8a34651d943ac3aba2aaa33abc45d59cb48557f997b5",
"approval.action.alwaysAllowSessionHint": "8c0a1379b7a44c55bfb11a6225a68373448afb5f0e2cf9710c096ecef25c3def",
"approval.action.alwaysAllowCommand": "137ecfa27e10f893e2770d3011a137cbeec755be97eb83b972eb3d301877db26",
"approval.action.alwaysAllowCommandHint": "6e2b74cd2eda2d5ea788de5663fdc42308c4bd764aff66d59723bb2a773a0b83",
@@ -27115,7 +27115,7 @@
"approval.action.deny": "05a2d7332eb9d8bf164487c743a2e93c21b16bb2061a93e3ee2ceb508eadb753",
"approval.action.stopAsking": "dad873d89afcd6885cc1acc13e9c7280c31b377b37fb4a4d2aef451dee1dc203",
"approval.action.alwaysAllow": "977618bd8bc7eef4d3bada0cf1a791d8362cd5fd8680e9673566abab2e76dded",
- "approval.action.alwaysAllowSession": "4d95e3c6a834d5f33a8e010d4c3ef2dfbe6dfca6718bbf190d6bd78b529278a6",
+ "approval.action.allowSession": "42ab016a7a8a3b18822b8a34651d943ac3aba2aaa33abc45d59cb48557f997b5",
"approval.action.alwaysAllowSessionHint": "8c0a1379b7a44c55bfb11a6225a68373448afb5f0e2cf9710c096ecef25c3def",
"approval.action.alwaysAllowCommand": "137ecfa27e10f893e2770d3011a137cbeec755be97eb83b972eb3d301877db26",
"approval.action.alwaysAllowCommandHint": "6e2b74cd2eda2d5ea788de5663fdc42308c4bd764aff66d59723bb2a773a0b83",
@@ -37288,7 +37288,7 @@
"approval.action.deny": "05a2d7332eb9d8bf164487c743a2e93c21b16bb2061a93e3ee2ceb508eadb753",
"approval.action.stopAsking": "dad873d89afcd6885cc1acc13e9c7280c31b377b37fb4a4d2aef451dee1dc203",
"approval.action.alwaysAllow": "977618bd8bc7eef4d3bada0cf1a791d8362cd5fd8680e9673566abab2e76dded",
- "approval.action.alwaysAllowSession": "4d95e3c6a834d5f33a8e010d4c3ef2dfbe6dfca6718bbf190d6bd78b529278a6",
+ "approval.action.allowSession": "42ab016a7a8a3b18822b8a34651d943ac3aba2aaa33abc45d59cb48557f997b5",
"approval.action.alwaysAllowSessionHint": "8c0a1379b7a44c55bfb11a6225a68373448afb5f0e2cf9710c096ecef25c3def",
"approval.action.update": "c1c1009d3f37ec058070a62e22caf9ac9dae2169d452487c5c271a8bcf57a291",
"approval.action.enable": "5342e09f2729fbc6514528e727aeb9857afb31719d43568e6b18661ace7d1014",
@@ -47630,7 +47630,7 @@
"approval.action.deny": "05a2d7332eb9d8bf164487c743a2e93c21b16bb2061a93e3ee2ceb508eadb753",
"approval.action.stopAsking": "dad873d89afcd6885cc1acc13e9c7280c31b377b37fb4a4d2aef451dee1dc203",
"approval.action.alwaysAllow": "977618bd8bc7eef4d3bada0cf1a791d8362cd5fd8680e9673566abab2e76dded",
- "approval.action.alwaysAllowSession": "4d95e3c6a834d5f33a8e010d4c3ef2dfbe6dfca6718bbf190d6bd78b529278a6",
+ "approval.action.allowSession": "42ab016a7a8a3b18822b8a34651d943ac3aba2aaa33abc45d59cb48557f997b5",
"approval.action.alwaysAllowSessionHint": "8c0a1379b7a44c55bfb11a6225a68373448afb5f0e2cf9710c096ecef25c3def",
"approval.action.alwaysAllowCommand": "137ecfa27e10f893e2770d3011a137cbeec755be97eb83b972eb3d301877db26",
"approval.action.alwaysAllowCommandHint": "6e2b74cd2eda2d5ea788de5663fdc42308c4bd764aff66d59723bb2a773a0b83",
@@ -57869,7 +57869,7 @@
"approval.action.deny": "05a2d7332eb9d8bf164487c743a2e93c21b16bb2061a93e3ee2ceb508eadb753",
"approval.action.stopAsking": "dad873d89afcd6885cc1acc13e9c7280c31b377b37fb4a4d2aef451dee1dc203",
"approval.action.alwaysAllow": "977618bd8bc7eef4d3bada0cf1a791d8362cd5fd8680e9673566abab2e76dded",
- "approval.action.alwaysAllowSession": "4d95e3c6a834d5f33a8e010d4c3ef2dfbe6dfca6718bbf190d6bd78b529278a6",
+ "approval.action.allowSession": "42ab016a7a8a3b18822b8a34651d943ac3aba2aaa33abc45d59cb48557f997b5",
"approval.action.alwaysAllowSessionHint": "8c0a1379b7a44c55bfb11a6225a68373448afb5f0e2cf9710c096ecef25c3def",
"approval.action.update": "c1c1009d3f37ec058070a62e22caf9ac9dae2169d452487c5c271a8bcf57a291",
"approval.action.enable": "5342e09f2729fbc6514528e727aeb9857afb31719d43568e6b18661ace7d1014",
@@ -62119,7 +62119,7 @@
"approval.action.deny": "05a2d7332eb9d8bf164487c743a2e93c21b16bb2061a93e3ee2ceb508eadb753",
"approval.action.stopAsking": "dad873d89afcd6885cc1acc13e9c7280c31b377b37fb4a4d2aef451dee1dc203",
"approval.action.alwaysAllow": "977618bd8bc7eef4d3bada0cf1a791d8362cd5fd8680e9673566abab2e76dded",
- "approval.action.alwaysAllowSession": "4d95e3c6a834d5f33a8e010d4c3ef2dfbe6dfca6718bbf190d6bd78b529278a6",
+ "approval.action.allowSession": "42ab016a7a8a3b18822b8a34651d943ac3aba2aaa33abc45d59cb48557f997b5",
"approval.action.alwaysAllowSessionHint": "8c0a1379b7a44c55bfb11a6225a68373448afb5f0e2cf9710c096ecef25c3def",
"approval.action.alwaysAllowCommand": "137ecfa27e10f893e2770d3011a137cbeec755be97eb83b972eb3d301877db26",
"approval.action.alwaysAllowCommandHint": "6e2b74cd2eda2d5ea788de5663fdc42308c4bd764aff66d59723bb2a773a0b83",
@@ -68137,7 +68137,7 @@
"approval.action.deny": "05a2d7332eb9d8bf164487c743a2e93c21b16bb2061a93e3ee2ceb508eadb753",
"approval.action.stopAsking": "dad873d89afcd6885cc1acc13e9c7280c31b377b37fb4a4d2aef451dee1dc203",
"approval.action.alwaysAllow": "977618bd8bc7eef4d3bada0cf1a791d8362cd5fd8680e9673566abab2e76dded",
- "approval.action.alwaysAllowSession": "4d95e3c6a834d5f33a8e010d4c3ef2dfbe6dfca6718bbf190d6bd78b529278a6",
+ "approval.action.allowSession": "42ab016a7a8a3b18822b8a34651d943ac3aba2aaa33abc45d59cb48557f997b5",
"approval.action.alwaysAllowSessionHint": "8c0a1379b7a44c55bfb11a6225a68373448afb5f0e2cf9710c096ecef25c3def",
"approval.action.alwaysAllowCommand": "137ecfa27e10f893e2770d3011a137cbeec755be97eb83b972eb3d301877db26",
"approval.action.alwaysAllowCommandHint": "6e2b74cd2eda2d5ea788de5663fdc42308c4bd764aff66d59723bb2a773a0b83",
@@ -74334,7 +74334,7 @@
"approval.action.deny": "05a2d7332eb9d8bf164487c743a2e93c21b16bb2061a93e3ee2ceb508eadb753",
"approval.action.stopAsking": "dad873d89afcd6885cc1acc13e9c7280c31b377b37fb4a4d2aef451dee1dc203",
"approval.action.alwaysAllow": "977618bd8bc7eef4d3bada0cf1a791d8362cd5fd8680e9673566abab2e76dded",
- "approval.action.alwaysAllowSession": "4d95e3c6a834d5f33a8e010d4c3ef2dfbe6dfca6718bbf190d6bd78b529278a6",
+ "approval.action.allowSession": "42ab016a7a8a3b18822b8a34651d943ac3aba2aaa33abc45d59cb48557f997b5",
"approval.action.alwaysAllowSessionHint": "8c0a1379b7a44c55bfb11a6225a68373448afb5f0e2cf9710c096ecef25c3def",
"approval.action.alwaysAllowCommand": "137ecfa27e10f893e2770d3011a137cbeec755be97eb83b972eb3d301877db26",
"approval.action.alwaysAllowCommandHint": "6e2b74cd2eda2d5ea788de5663fdc42308c4bd764aff66d59723bb2a773a0b83",
@@ -81624,7 +81624,7 @@
"approval.action.deny": "05a2d7332eb9d8bf164487c743a2e93c21b16bb2061a93e3ee2ceb508eadb753",
"approval.action.stopAsking": "dad873d89afcd6885cc1acc13e9c7280c31b377b37fb4a4d2aef451dee1dc203",
"approval.action.alwaysAllow": "977618bd8bc7eef4d3bada0cf1a791d8362cd5fd8680e9673566abab2e76dded",
- "approval.action.alwaysAllowSession": "4d95e3c6a834d5f33a8e010d4c3ef2dfbe6dfca6718bbf190d6bd78b529278a6",
+ "approval.action.allowSession": "42ab016a7a8a3b18822b8a34651d943ac3aba2aaa33abc45d59cb48557f997b5",
"approval.action.alwaysAllowSessionHint": "8c0a1379b7a44c55bfb11a6225a68373448afb5f0e2cf9710c096ecef25c3def",
"approval.action.alwaysAllowCommand": "137ecfa27e10f893e2770d3011a137cbeec755be97eb83b972eb3d301877db26",
"approval.action.alwaysAllowCommandHint": "6e2b74cd2eda2d5ea788de5663fdc42308c4bd764aff66d59723bb2a773a0b83",
@@ -88947,7 +88947,7 @@
"approval.action.deny": "05a2d7332eb9d8bf164487c743a2e93c21b16bb2061a93e3ee2ceb508eadb753",
"approval.action.stopAsking": "dad873d89afcd6885cc1acc13e9c7280c31b377b37fb4a4d2aef451dee1dc203",
"approval.action.alwaysAllow": "977618bd8bc7eef4d3bada0cf1a791d8362cd5fd8680e9673566abab2e76dded",
- "approval.action.alwaysAllowSession": "4d95e3c6a834d5f33a8e010d4c3ef2dfbe6dfca6718bbf190d6bd78b529278a6",
+ "approval.action.allowSession": "42ab016a7a8a3b18822b8a34651d943ac3aba2aaa33abc45d59cb48557f997b5",
"approval.action.alwaysAllowSessionHint": "8c0a1379b7a44c55bfb11a6225a68373448afb5f0e2cf9710c096ecef25c3def",
"approval.action.alwaysAllowCommand": "137ecfa27e10f893e2770d3011a137cbeec755be97eb83b972eb3d301877db26",
"approval.action.alwaysAllowCommandHint": "6e2b74cd2eda2d5ea788de5663fdc42308c4bd764aff66d59723bb2a773a0b83",
@@ -96256,7 +96256,7 @@
"approval.action.deny": "05a2d7332eb9d8bf164487c743a2e93c21b16bb2061a93e3ee2ceb508eadb753",
"approval.action.stopAsking": "dad873d89afcd6885cc1acc13e9c7280c31b377b37fb4a4d2aef451dee1dc203",
"approval.action.alwaysAllow": "977618bd8bc7eef4d3bada0cf1a791d8362cd5fd8680e9673566abab2e76dded",
- "approval.action.alwaysAllowSession": "4d95e3c6a834d5f33a8e010d4c3ef2dfbe6dfca6718bbf190d6bd78b529278a6",
+ "approval.action.allowSession": "42ab016a7a8a3b18822b8a34651d943ac3aba2aaa33abc45d59cb48557f997b5",
"approval.action.alwaysAllowSessionHint": "8c0a1379b7a44c55bfb11a6225a68373448afb5f0e2cf9710c096ecef25c3def",
"approval.action.alwaysAllowCommand": "137ecfa27e10f893e2770d3011a137cbeec755be97eb83b972eb3d301877db26",
"approval.action.alwaysAllowCommandHint": "6e2b74cd2eda2d5ea788de5663fdc42308c4bd764aff66d59723bb2a773a0b83",
diff --git a/src/locales/tr.json b/src/locales/tr.json
index cea68a4356..cec833eeec 100644
--- a/src/locales/tr.json
+++ b/src/locales/tr.json
@@ -607,7 +607,7 @@
"approval.action.deny": "Reddet",
"approval.action.stopAsking": "{key} hakkında {name} adlı bota sormayı durdur",
"approval.action.alwaysAllow": "Her zaman izin ver",
- "approval.action.alwaysAllowSession": "Bu oturumda her zaman izin ver",
+ "approval.action.allowSession": "Bu oturumda izin ver",
"approval.action.alwaysAllowSessionHint": "Sağlayıcı, oturum sona erene kadar bu eylem hakkında sormayı durdurur",
"approval.action.alwaysAllowCommand": "Bu komuta her zaman izin ver",
"approval.action.alwaysAllowCommandHint": "Bu klasörü kullanan diğer iş parçacıkları da dahil olmak üzere, {cwd} içindeki bu bot ve sağlayıcı için bu komutu tam olarak hatırla",
diff --git a/src/locales/uk.json b/src/locales/uk.json
index 9c31f024e3..bd6fa4204c 100644
--- a/src/locales/uk.json
+++ b/src/locales/uk.json
@@ -446,7 +446,7 @@
"approval.action.deny": "Відмовити",
"approval.action.stopAsking": "Не питати {name} про {key}",
"approval.action.alwaysAllow": "Завжди дозволяти",
- "approval.action.alwaysAllowSession": "Завжди дозволяти в цій сесії",
+ "approval.action.allowSession": "Дозволити в цій сесії",
"approval.action.alwaysAllowSessionHint": "Провайдер перестане питати про цю дію до завершення сесії",
"approval.action.update": "Оновити",
"approval.action.enable": "Увімкнути",
diff --git a/src/locales/vi.json b/src/locales/vi.json
index b47e187489..b59b08c003 100644
--- a/src/locales/vi.json
+++ b/src/locales/vi.json
@@ -607,7 +607,7 @@
"approval.action.deny": "Từ chối",
"approval.action.stopAsking": "Không hỏi lại {name} về {key}",
"approval.action.alwaysAllow": "Luôn cho phép",
- "approval.action.alwaysAllowSession": "Luôn cho phép trong phiên này",
+ "approval.action.allowSession": "Cho phép trong phiên này",
"approval.action.alwaysAllowSessionHint": "Nhà cung cấp sẽ ngừng hỏi về hành động này cho đến khi phiên kết thúc",
"approval.action.alwaysAllowCommand": "Luôn cho phép lệnh này",
"approval.action.alwaysAllowCommandHint": "Ghi nhớ đúng lệnh này cho bot và nhà cung cấp này trong {cwd}, bao gồm các luồng khác dùng thư mục đó",
diff --git a/src/locales/zh-tw.json b/src/locales/zh-tw.json
index 3da69ab738..c0df5766a9 100644
--- a/src/locales/zh-tw.json
+++ b/src/locales/zh-tw.json
@@ -1105,7 +1105,7 @@
"approval.action.deny": "拒絕",
"approval.action.stopAsking": "不再詢問 {name} 關於 {key} 的事",
"approval.action.alwaysAllow": "一律允許",
- "approval.action.alwaysAllowSession": "本次工作階段一律允許",
+ "approval.action.allowSession": "本次工作階段允許",
"approval.action.alwaysAllowSessionHint": "在工作階段結束前,供應商不會再詢問這個動作。",
"approval.action.alwaysAllowCommand": "一律允許這個指令",
"approval.action.alwaysAllowCommandHint": "針對此機器人與供應商,在 {cwd} 中記住這個完全相符的指令,也適用於使用該資料夾的其他對話",
diff --git a/src/locales/zh.json b/src/locales/zh.json
index a9dc542395..60bbd87e01 100644
--- a/src/locales/zh.json
+++ b/src/locales/zh.json
@@ -1222,7 +1222,7 @@
"approval.action.deny": "拒绝",
"approval.action.stopAsking": "不再就 {key} 询问 {name}",
"approval.action.alwaysAllow": "始终允许",
- "approval.action.alwaysAllowSession": "本次会话一律允许",
+ "approval.action.allowSession": "本次会话允许",
"approval.action.alwaysAllowSessionHint": "在会话结束前,提供方不会再询问这个动作。",
"approval.action.alwaysAllowCommand": "始终允许此命令",
"approval.action.alwaysAllowCommandHint": "为这个机器人和提供方在 {cwd} 中记住这条完全相同的命令,使用该文件夹的其他对话也适用",