@devries-cameron20 / t3code Mirror · read-only / commits / 917ce994e4
Fork 0

The best way to control Claude Code, Codex and more from any computer or phone

Mirrored from https://github.com/Camo67/t3code.git

Synced Nov 22, 02:00 UTC

fix(web): agent sign-in defaults to Auto access (#32186)

oliver committed Nov 7, 2026 at 04:38 UTC 917ce994e4c64864bad3eed39044607b86896320
4 files changed +38 -3
apps/web/src/components/auth/ConnectAgentSurface.logic.test.ts new
+13
@@ -0,0 +1,13 @@
1 +import { expect, it } from "vite-plus/test";
2 +import { RuntimeMode } from "@t3tools/contracts";
3 +
4 +import { resolveMcpAccess } from "./ConnectAgentSurface.logic";
5 +
6 +it.each(RuntimeMode.literals)("keeps MCP access within the %s policy ceiling", (maxRuntimeMode) => {
7 + const ceiling = { organization: "Example", maxRuntimeMode };
8 + expect(resolveMcpAccess("auto", ceiling)).toBe(
9 + maxRuntimeMode === "full-access" ? "auto" : maxRuntimeMode,
10 + );
11 + expect(resolveMcpAccess("read-only", ceiling)).toBe("read-only");
12 + expect(resolveMcpAccess("approval-required", ceiling)).toBe("approval-required");
13 +});
apps/web/src/components/auth/ConnectAgentSurface.logic.ts new
+16
@@ -0,0 +1,16 @@
1 +import {
2 + type AuthMcpApprovalDetails,
3 + type AuthMcpClientAccess,
4 + isRuntimeModeAbove,
5 +} from "@t3tools/contracts";
6 +
7 +export function resolveMcpAccess(
8 + access: AuthMcpClientAccess,
9 + ceiling: AuthMcpApprovalDetails["runtimeModeCeiling"],
10 +) {
11 + return access !== "read-only" &&
12 + ceiling !== undefined &&
13 + isRuntimeModeAbove(access, ceiling.maxRuntimeMode)
14 + ? ceiling.maxRuntimeMode
15 + : access;
16 +}
apps/web/src/components/auth/ConnectAgentSurface.tsx
+6 -1
@@ -18,6 +18,7 @@ import { type ReactNode, useEffect, useState } from "react";
18 import { PrimaryEnvironmentHttpClient } from "~/environments/primary/httpClient";
19 import { runPrimaryHttp } from "~/lib/runtime";
20 import { cn } from "~/lib/utils";
21 +import { resolveMcpAccess } from "./ConnectAgentSurface.logic";
22 import { runtimeModeConfig } from "../chat/runtimeModeConfig";
23 import { Alert, AlertDescription } from "../ui/alert";
24 import { Button } from "../ui/button";
@@ -92,7 +93,11 @@ function oneClickApproves(details: AuthMcpApprovalDetails, access: AuthMcpClient
93 export function ConnectAgentSurface() {
94 const [authorization] = useState(readAuthorizationRequest);
95 const [loaded, setLoaded] = useState<Loaded>({ status: "loading" });
95 - const [access, setAccess] = useState<AuthMcpClientAccess>("read-only");
96 + const [requestedAccess, setAccess] = useState<AuthMcpClientAccess>("auto");
97 + const access = resolveMcpAccess(
98 + requestedAccess,
99 + loaded.status === "ready" ? loaded.details.runtimeModeCeiling : undefined,
100 + );
101 const [pairingCode, setPairingCode] = useState("");
102 const [errorMessage, setErrorMessage] = useState("");
103 const [pending, setPending] = useState<"approve" | "deny" | null>(null);
docs/user/outside-agents.md
+3 -2
@@ -45,9 +45,10 @@ Only approve a sign-in you just started. To approve, enter a pairing code from
45 browser already signed in to the environment with permission to manage access
46 can approve without a code.
47
48 -Then choose what the agent may do:
48 +Then choose what the agent may do. **Auto** is selected by default, or the
49 +closest lower mode allowed by your organization’s policy:
50
50 -- **Read only** is the default. The agent can read projects and threads and see
51 +- **Read only** lets the agent read projects and threads and see
52 the available providers and models. It cannot change anything.
53 - **Supervised** through **Full access** also let it start, message and stop
54 threads in every project. A thread it starts or steers cannot run with more