diff --git a/apps/server/src/mcp/McpToolAccess.test.ts b/apps/server/src/mcp/McpToolAccess.test.ts index 6cfd86bd3d836..930ad5bf19030 100644 --- a/apps/server/src/mcp/McpToolAccess.test.ts +++ b/apps/server/src/mcp/McpToolAccess.test.ts @@ -28,6 +28,7 @@ import { liveThreadShell } from "./McpToolAccess.testkit.ts"; const supervisedThreadId = ThreadId.make("thread:supervised"); const planThreadId = ThreadId.make("thread:plan"); const fullAccessThreadId = ThreadId.make("thread:full-access"); +const autoThreadId = ThreadId.make("thread:auto"); const endedThreadId = ThreadId.make("thread:ended"); const backgroundThreadId = ThreadId.make("thread:background"); const oldProviderThreadId = ThreadId.make("thread:old-provider-background"); @@ -48,6 +49,7 @@ const shells = new Map([ liveThreadShell(planThreadId, { runtimeMode: "approval-required", interactionMode: "plan" }), ], [fullAccessThreadId, liveThreadShell(fullAccessThreadId)], + [autoThreadId, liveThreadShell(autoThreadId, { runtimeMode: "auto" })], [endedThreadId, liveThreadShell(endedThreadId, { activeRunId: null })], [backgroundThreadId, backgroundShell(backgroundThreadId, ProviderInstanceId.make("codex"))], [oldProviderThreadId, backgroundShell(oldProviderThreadId, ProviderInstanceId.make("claude"))], @@ -228,6 +230,7 @@ const call = ( const supervised = threadCaller(supervisedThreadId); const plan = threadCaller(planThreadId); const fullAccess = threadCaller(fullAccessThreadId); +const auto = threadCaller(autoThreadId); const ended = threadCaller(endedThreadId); const background = threadCaller(backgroundThreadId); const oldProviderBackground = threadCaller(oldProviderThreadId); @@ -239,6 +242,7 @@ const mismatchedProvider = { }; const supervisedClient = clientCaller("approval-required"); const fullAccessClient = clientCaller("full-access"); +const autoAcceptEditsClient = clientCaller("auto-accept-edits"); const readOnlyClient = clientCaller("read-only"); const linkedClient: McpInvocationContext.McpInvocationScope = { ...supervisedClient, @@ -317,9 +321,11 @@ it.effect.each([ ["starts_threads", fullAccessClient, { runtimeMode: "full-access" }, "full-access/default"], ["writes_environment", fullAccess, {}, "ran"], + ["writes_environment", auto, {}, "ran"], ["writes_environment", supervised, {}, "capability_denied"], ["writes_environment", plan, {}, "capability_denied"], ["writes_environment", fullAccessClient, {}, "ran"], + ["writes_environment", autoAcceptEditsClient, {}, "ran"], ["writes_environment", supervisedClient, {}, "capability_denied"], ] as const)("%s from %o with %o: %s", ([tool, scope, args, expected]) => call(tool, scope, args).pipe( diff --git a/apps/server/src/mcp/McpToolAccess.ts b/apps/server/src/mcp/McpToolAccess.ts index 20a9274798d0f..9e94ba0b03613 100644 --- a/apps/server/src/mcp/McpToolAccess.ts +++ b/apps/server/src/mcp/McpToolAccess.ts @@ -27,8 +27,8 @@ import { assertNotLinked, assertSameLink, callerLinkOrigin } from "./linkOrigin. import * as McpInvocationContext from "./McpInvocationContext.ts"; import { resolveInteractionMode, resolveRuntimeMode } from "./delegatedTaskModes.ts"; import { - assertFullAccess, assertLiveCaller, + assertMayChangeEnvironment, assertTargetWithinLimits, type Caller, loadCaller, @@ -318,8 +318,8 @@ export const afterForwarding =
( forwarded, ); -const fullAccessRequired = - "Changing projects or environment settings needs a live full-access/default calling thread or a full-access client."; +const environmentChangeRefused = + "Changing projects or environment settings needs a calling thread with Auto-accept edits, Auto or Full access permissions that is not in plan mode, or a client approved for more than Supervised access. Ask the user to change this thread's permissions, or to make the change themselves."; /** Recheck after waits before writing; caller modes may have changed. */ export const writesEnvironment =
( @@ -341,14 +341,14 @@ export const writesEnvironment =
(
? Effect.void
: assertNotLinked(caller, "change projects or environment settings"),
),
- Effect.tap((caller) => assertFullAccess(caller, fullAccessRequired)),
+ Effect.tap((caller) => assertMayChangeEnvironment(caller, environmentChangeRefused)),
);
return declare(
(params: P) => check.pipe(Effect.flatMap(() => handle(params, check))),
// Linked work never reaches a link at all; that is checked as the call goes.
() =>
orchestratingCaller.pipe(
- Effect.tap((caller) => assertFullAccess(caller, fullAccessRequired)),
+ Effect.tap((caller) => assertMayChangeEnvironment(caller, environmentChangeRefused)),
),
);
};
diff --git a/apps/server/src/mcp/threadAccess.ts b/apps/server/src/mcp/threadAccess.ts
index 8cce38949cdd0..06caec6184b78 100644
--- a/apps/server/src/mcp/threadAccess.ts
+++ b/apps/server/src/mcp/threadAccess.ts
@@ -188,8 +188,9 @@ export function assertLiveCaller({ caller, scope }: Caller) {
);
}
-export const assertFullAccess = (context: Caller, message: string) =>
- context.limits.runtimeMode === "full-access" && context.limits.interactionMode === "default"
+/** Supervised stays refused: Claude pre-approves T3 tools, so its user would see no approval step. */
+export const assertMayChangeEnvironment = (context: Caller, message: string) =>
+ context.limits.runtimeMode !== "approval-required" && context.limits.interactionMode === "default"
? Effect.void
: Effect.fail(new OrchestratorMcpFailure({ code: "capability_denied", message }));
diff --git a/apps/server/src/mcp/toolkits/environment/tools.ts b/apps/server/src/mcp/toolkits/environment/tools.ts
index 9e10380295de2..c49b5496525b1 100644
--- a/apps/server/src/mcp/toolkits/environment/tools.ts
+++ b/apps/server/src/mcp/toolkits/environment/tools.ts
@@ -56,7 +56,7 @@ const EnvironmentReadTool = Tool.make("t3_environment_read", {
const EnvironmentPreferencesTool = Tool.make("t3_environment_preferences_update", {
...shared,
description:
- "Update environment-wide preferences. Live full-access or default caller thread only. Omitted fields are unchanged; `customInstructions: ''` clears it.",
+ "Update environment-wide preferences. Not for Supervised or plan callers. Omitted fields are unchanged; `customInstructions: ''` clears it.",
parameters: Schema.Struct({
environmentId: OrchestratorMcpEnvironmentTarget,
defaultThreadEnvMode: ServerSettingsPatch.fields.defaultThreadEnvMode,
diff --git a/apps/server/src/mcp/toolkits/orchestrator/handlers.ts b/apps/server/src/mcp/toolkits/orchestrator/handlers.ts
index dfa1ad58545ee..e8893f16c97b8 100644
--- a/apps/server/src/mcp/toolkits/orchestrator/handlers.ts
+++ b/apps/server/src/mcp/toolkits/orchestrator/handlers.ts
@@ -206,7 +206,7 @@ const handlers = {
}),
),
// A link lets every agent here reach the other environment, so it is an
- // environment setting: full access, and never for linked work.
+ // environment setting: above Supervised, and never for linked work.
t3_environment_link: McpToolAccess.writesEnvironment((input) =>
Effect.gen(function* () {
const scope = yield* McpInvocationContext.McpInvocationContext;
diff --git a/apps/server/src/mcp/toolkits/theme/tools.ts b/apps/server/src/mcp/toolkits/theme/tools.ts
index 716c540b2c41e..67cba2f5d3916 100644
--- a/apps/server/src/mcp/toolkits/theme/tools.ts
+++ b/apps/server/src/mcp/toolkits/theme/tools.ts
@@ -55,7 +55,7 @@ const ThemeReadTool = Tool.make("t3_theme_read", {
const ThemeSetTool = Tool.make("t3_theme_set", {
...shared,
description:
- "Restyle T3 Code itself, only when the user asks. With `theme`, publish it as `themeId` (same id updates it) and switch this server's web app and this machine's desktop app to it, not remote desktop apps. Without `theme`, switch to a built-in or published `themeId`. `appearance` sets light, dark, or system mode. Live full-access or default caller thread only.",
+ "Restyle T3 Code itself, only when the user asks. With `theme`, publish it as `themeId` (same id updates it) and switch this server's web app and this machine's desktop app to it, not remote desktop apps. Without `theme`, switch to a built-in or published `themeId`. `appearance` sets light, dark, or system mode. Not for Supervised or plan callers.",
parameters: Schema.Struct({
themeId: Schema.optionalKey(EnvironmentThemeId),
theme: Schema.optionalKey(EnvironmentThemeFile),
diff --git a/apps/server/src/mcp/toolkits/thread/tools.ts b/apps/server/src/mcp/toolkits/thread/tools.ts
index d6c9a34565ddb..26154f16d246b 100644
--- a/apps/server/src/mcp/toolkits/thread/tools.ts
+++ b/apps/server/src/mcp/toolkits/thread/tools.ts
@@ -222,7 +222,7 @@ const ThreadSearchTool = Tool.make("t3_thread_search", {
const ScheduledTaskRunTool = Tool.make("run_scheduled_task_now", {
...commandTool,
description:
- "Run one scheduled task now. Needs a full-access or default caller. Returns its thread, or null if not started. Success means started, not finished.",
+ "Run one scheduled task now. Not for Supervised or plan callers. Returns its thread, or null if not started. Success means started, not finished.",
parameters: Schema.Struct({
environmentId: OrchestratorMcpEnvironmentTarget,
taskId: ScheduledTaskId,
diff --git a/apps/server/src/peer/PeerForwarding.test.ts b/apps/server/src/peer/PeerForwarding.test.ts
index 5f53bfdf5b9dd..de60f46f7e4be 100644
--- a/apps/server/src/peer/PeerForwarding.test.ts
+++ b/apps/server/src/peer/PeerForwarding.test.ts
@@ -551,7 +551,7 @@ it.effect("launches in a linked environment with the caller's modes, retry-safe"
).pipe(Effect.provide(NodeHttpServer.layerTest)),
);
-it.effect("brings a repository to a linked environment, only through full access", () =>
+it.effect("brings a repository to a linked environment, only through a link above supervised", () =>
Effect.scoped(
Effect.gen(function* () {
const seen = yield* Ref.make