The best way to control Claude Code, Codex and more from any computer or phone
feat(server,web,mobile): approvals in full access say why Claude asked (#22546)
Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
Julius Marminge committed
Oct 21, 2026 at 12:45 UTC
e74924538705d774e2e1c56616485351d33d38db
9 files changed
+187
-8
apps/mobile/src/features/threads/PendingApprovalCard.tsx
+28
-1
@@ -4,7 +4,12 @@ import type {
4
ProviderApprovalOption,
5
RuntimeRequestId,
6
} from "@t3tools/contracts";
7
-import { View } from "react-native";
7
+import {
8
+ FULL_ACCESS_OVERRIDE_QUESTION,
9
+ fullAccessOverrideExplanation,
10
+} from "@t3tools/client-runtime/state/thread-requests";
11
+import { useState } from "react";
12
+import { Pressable, View } from "react-native";
13
14
import { AppText as Text } from "../../components/ui/AppText";
15
import type { PendingApproval } from "../../lib/threadActivity";
@@ -31,6 +36,7 @@ export function PendingApprovalCard(props: PendingApprovalCardProps) {
36
const warning = options.find((option) => option.warning)?.warning;
37
const canRespond = props.approval.responseCapability === "live";
38
const disabled = !canRespond || props.respondingApprovalId === props.approval.requestId;
39
+ const [explanationOpen, setExplanationOpen] = useState(false);
40
return (
41
<View className="gap-2.5 rounded-[20px] border border-border bg-card-alt p-4">
42
<Text className="font-t3-bold text-2xs uppercase tracking-[1.1px] text-foreground-secondary">
@@ -44,6 +50,27 @@ export function PendingApprovalCard(props: PendingApprovalCardProps) {
50
{props.approval.detail}
51
</Text>
52
) : null}
53
+ {props.approval.reason ? (
54
+ <Text className="font-sans text-xs leading-normal text-warning-foreground">
55
+ {props.approval.reason}
56
+ </Text>
57
+ ) : null}
58
+ {props.approval.fullAccessOverride ? (
59
+ <Pressable
60
+ accessibilityRole="button"
61
+ accessibilityState={{ expanded: explanationOpen }}
62
+ onPress={() => setExplanationOpen((open) => !open)}
63
+ >
64
+ <Text className="font-t3-bold text-xs text-foreground-secondary underline">
65
+ {FULL_ACCESS_OVERRIDE_QUESTION}
66
+ </Text>
67
+ {explanationOpen ? (
68
+ <Text className="mt-1 font-sans text-xs leading-normal text-foreground-muted">
69
+ {fullAccessOverrideExplanation(props.approval.fullAccessOverride)}
70
+ </Text>
71
+ ) : null}
72
+ </Pressable>
73
+ ) : null}
74
{!canRespond ? (
75
<Text className="font-sans text-sm leading-5 text-foreground-muted">
76
The provider process for this request is no longer available. Interrupt or restart the run
apps/server/src/mcp/OrchestratorMcpService.ts
+3
-1
@@ -988,7 +988,9 @@ function turnItemText(item: OrchestrationV2TurnItem): string | null {
988
case "web_search":
989
return jsonText({ patterns: item.patterns, results: item.results });
990
case "approval_request":
991
- return item.prompt ?? item.requestKind;
991
+ return [item.prompt ?? item.requestKind, item.reason]
992
+ .filter((line): line is string => line !== undefined)
993
+ .join("\n");
994
case "checkpoint":
995
return jsonText(item.files);
996
case "run_interrupt_request":
apps/server/src/orchestration-v2/Adapters/ClaudeAdapterV2.test.ts
+41
@@ -588,6 +588,47 @@ describe("ClaudeAdapterV2 context usage", () => {
588
});
589
});
590
591
+describe("ClaudeAdapterV2 approval presentation", () => {
592
+ it("marks asks that full access could not auto-allow and keeps the CLI's reason", () => {
593
+ const presentation = ClaudeAdapterV2.claudeApprovalPresentation({
594
+ permissionMode: "bypassPermissions",
595
+ prompt: 'Claude wants to run rm -r -- "$rr/$h"',
596
+ callbackOptions: {
597
+ decisionReason: "\u001b[33mDangerous rm on a path built from a variable\u001b[39m",
598
+ suppressAlwaysAllowRule: true,
599
+ },
600
+ });
601
+ assert.deepEqual(presentation, {
602
+ reason: "Dangerous rm on a path built from a variable",
603
+ fullAccessOverride: "provider_check",
604
+ options: [
605
+ { decision: "decline", label: "Decline" },
606
+ { decision: "accept", label: "Approve" },
607
+ ],
608
+ });
609
+ });
610
+
611
+ it("attributes a bypass ask to the user's ask rule when one matched", () => {
612
+ const presentation = ClaudeAdapterV2.claudeApprovalPresentation({
613
+ permissionMode: "bypassPermissions",
614
+ prompt: "Claude wants to run git push",
615
+ callbackOptions: {
616
+ matchedAskRule: { source: "userSettings", toolName: "Bash", ruleContent: "git push:*" },
617
+ },
618
+ });
619
+ assert.deepEqual(presentation, { fullAccessOverride: "ask_rule" });
620
+ });
621
+
622
+ it("adds nothing to ordinary approvals outside full access", () => {
623
+ const presentation = ClaudeAdapterV2.claudeApprovalPresentation({
624
+ permissionMode: "default",
625
+ prompt: "Run make?",
626
+ callbackOptions: { decisionReason: "Run make?" },
627
+ });
628
+ assert.deepEqual(presentation, {});
629
+ });
630
+});
631
+
632
describe("ClaudeAdapterV2 session permissions", () => {
633
// regression: #15892 an explicit user refusal must stay user_reject, not a tool failure
634
it("keeps explicit user refusals classified as user_reject", () => {
apps/server/src/orchestration-v2/Adapters/ClaudeAdapterV2.ts
+49
@@ -51,6 +51,7 @@ import type {
51
} from "@anthropic-ai/claude-agent-sdk/sdk-tools";
52
// @effect-diagnostics-next-line nodeBuiltinImport:off -- the SDK takes a Node ChildProcess for the CLI.
53
import * as NodeChildProcess from "node:child_process";
54
+import * as NodeUtil from "node:util";
55
import { parseCliArgs } from "@t3tools/shared/cliArgs";
56
import { fromLenientJson } from "@t3tools/shared/schemaJson";
57
import { AgentScope } from "@t3tools/shared/AgentScope";
@@ -87,6 +88,8 @@ import {
88
type OrchestrationV2TurnItem,
89
type OrchestrationV2WebSearchResult,
90
type ProviderApprovalDecision,
91
+ type ProviderApprovalFullAccessOverride,
92
+ type ProviderApprovalOption,
93
ProviderDriverKind,
94
type ProviderInstanceId,
95
type ProviderRequestKind,
@@ -2827,6 +2830,45 @@ function parentToolUseIdFromSdkMessage(message: SDKMessage): string | null {
2830
: null;
2831
}
2832
2833
+const CLAUDE_NO_STANDING_GRANT_OPTIONS = [
2834
+ { decision: "decline", label: "Decline" },
2835
+ { decision: "accept", label: "Approve" },
2836
+] satisfies ReadonlyArray<ProviderApprovalOption>;
2837
+
2838
+export function claudeApprovalPresentation(input: {
2839
+ readonly permissionMode: PermissionMode;
2840
+ readonly prompt: string;
2841
+ readonly callbackOptions: Pick<
2842
+ Parameters<CanUseTool>[2],
2843
+ "decisionReason" | "matchedAskRule" | "suppressAlwaysAllowRule"
2844
+ >;
2845
+}): {
2846
+ readonly reason?: string;
2847
+ readonly fullAccessOverride?: ProviderApprovalFullAccessOverride;
2848
+ readonly options?: ReadonlyArray<ProviderApprovalOption>;
2849
+} {
2850
+ // The reason can carry terminal escapes from the CLI's own prompt renderer.
2851
+ const reason = NodeUtil.stripVTControlCharacters(
2852
+ input.callbackOptions.decisionReason ?? "",
2853
+ ).trim();
2854
+ // Bypass auto-allows everything it can, so any ask that still reaches the
2855
+ // callback is one bypass refused. The SDK drops the CLI's decision_reason_type,
2856
+ // leaving the matched ask rule as the only way to tell the two causes apart.
2857
+ const fullAccessOverride: ProviderApprovalFullAccessOverride | undefined =
2858
+ input.permissionMode !== "bypassPermissions"
2859
+ ? undefined
2860
+ : input.callbackOptions.matchedAskRule === undefined
2861
+ ? "provider_check"
2862
+ : "ask_rule";
2863
+ return {
2864
+ ...(reason === "" || reason === input.prompt ? {} : { reason }),
2865
+ ...(fullAccessOverride === undefined ? {} : { fullAccessOverride }),
2866
+ ...(input.callbackOptions.suppressAlwaysAllowRule === true
2867
+ ? { options: CLAUDE_NO_STANDING_GRANT_OPTIONS }
2868
+ : {}),
2869
+ };
2870
+}
2871
+
2872
export function permissionResultFromDecision(input: {
2873
readonly toolName: string;
2874
readonly decision: ProviderApprovalDecision;
@@ -6347,6 +6389,7 @@ export const makeClaudeAdapterV2 = Effect.fn("makeClaudeAdapterV2")(function* (
6389
readonly nativeRequestId: string;
6390
readonly requestKind: OrchestrationV2RuntimeRequest["kind"];
6391
readonly prompt?: string;
6392
+ readonly presentation?: ReturnType<typeof claudeApprovalPresentation>;
6393
readonly questions?: ReadonlyArray<OrchestrationV2UserInputQuestion>;
6394
}) {
6395
const createdAt = yield* DateTime.now;
@@ -6431,6 +6474,7 @@ export const makeClaudeAdapterV2 = Effect.fn("makeClaudeAdapterV2")(function* (
6474
requestId,
6475
requestKind: input.requestKind as ProviderRequestKind,
6476
...(input.prompt === undefined ? {} : { prompt: input.prompt }),
6477
+ ...input.presentation,
6478
}
6479
: {
6480
type: "user_input_request" as const,
@@ -8918,6 +8962,11 @@ export const makeClaudeAdapterV2 = Effect.fn("makeClaudeAdapterV2")(function* (
8962
nativeRequestId,
8963
requestKind,
8964
prompt,
8965
+ presentation: claudeApprovalPresentation({
8966
+ permissionMode: context.queryPolicy.permissionMode,
8967
+ prompt,
8968
+ callbackOptions,
8969
+ }),
8970
});
8971
const decision = yield* Deferred.make<ProviderApprovalDecision, never>();
8972
yield* Ref.update(pendingRuntimeRequests, (current) => {
apps/web/src/components/chat/ComposerBanner.tsx
+11
-6
@@ -160,13 +160,18 @@ function Root({
160
density === "comfortable" && "[--composer-banner-padding-block:--spacing(1.25)]",
161
density === "spacious" && "px-3 [--composer-banner-padding-block:--spacing(3)]",
162
width === "content" ? "w-fit max-w-full flex-none" : "@container",
163
- "[&>[data-composer-banner-row]:first-child>[data-slot=composer-banner-actions]>[data-slot=button]:last-child]:rounded-se-xl",
164
- "[&>[data-composer-banner-row]:first-child>[data-slot=composer-banner-actions]>:last-child>[data-slot=button]:last-of-type]:rounded-se-xl",
165
- "[&>:first-child>[data-composer-banner-row]:first-child>[data-slot=composer-banner-actions]>[data-slot=button]:last-child]:rounded-se-xl",
166
- placement === "floating" && [
167
- "[&>[data-composer-banner-row]:only-child>[data-slot=composer-banner-actions]>[data-slot=button]:last-child]:rounded-ee-xl",
168
- "[&>[data-composer-banner-row]:only-child>[data-slot=composer-banner-actions]>:last-child>[data-slot=button]:last-of-type]:rounded-ee-xl",
163
+ // A corner button nests inside the banner's radius only when the padding
164
+ // is tight; spacious padding already leaves the default radius concentric.
165
+ density !== "spacious" && [
166
+ "[&>[data-composer-banner-row]:first-child>[data-slot=composer-banner-actions]>[data-slot=button]:last-child]:rounded-se-xl",
167
+ "[&>[data-composer-banner-row]:first-child>[data-slot=composer-banner-actions]>:last-child>[data-slot=button]:last-of-type]:rounded-se-xl",
168
+ "[&>:first-child>[data-composer-banner-row]:first-child>[data-slot=composer-banner-actions]>[data-slot=button]:last-child]:rounded-se-xl",
169
],
170
+ placement === "floating" &&
171
+ density !== "spacious" && [
172
+ "[&>[data-composer-banner-row]:only-child>[data-slot=composer-banner-actions]>[data-slot=button]:last-child]:rounded-ee-xl",
173
+ "[&>[data-composer-banner-row]:only-child>[data-slot=composer-banner-actions]>:last-child>[data-slot=button]:last-of-type]:rounded-ee-xl",
174
+ ],
175
className,
176
)}
177
data-slot="composer-banner"
apps/web/src/components/chat/ComposerPendingApprovalPanel.tsx
+28
@@ -1,5 +1,12 @@
1
+import {
2
+ FULL_ACCESS_OVERRIDE_QUESTION,
3
+ fullAccessOverrideExplanation,
4
+} from "@t3tools/client-runtime/state/thread-requests";
5
import { memo } from "react";
6
import { type PendingApproval } from "../../session-logic";
7
+import { InlineButton } from "../ui/button";
8
+import { Popover, PopoverPopup, PopoverTrigger } from "../ui/popover";
9
+import { composerFloatingLayerProps } from "./composerEventScope";
10
import { cn } from "~/lib/utils";
11
12
interface ComposerPendingApprovalPanelProps {
@@ -44,6 +51,22 @@ export const ComposerPendingApprovalPanel = memo(function ComposerPendingApprova
51
<span className="flex w-full min-w-0 items-center gap-2 text-2xs text-muted-foreground">
52
<span className="shrink-0 font-medium text-warning">{fallbackLabel}</span>
53
{approval.appName ? <span className="min-w-0 truncate">{approval.appName}</span> : null}
54
+ {approval.fullAccessOverride ? (
55
+ <Popover>
56
+ <PopoverTrigger openOnHover render={<InlineButton tone="muted" />}>
57
+ {FULL_ACCESS_OVERRIDE_QUESTION}
58
+ </PopoverTrigger>
59
+ <PopoverPopup
60
+ {...composerFloatingLayerProps}
61
+ aria-label={FULL_ACCESS_OVERRIDE_QUESTION}
62
+ tooltipStyle
63
+ side="top"
64
+ className="max-w-[min(22rem,calc(100vw-2rem))] whitespace-normal"
65
+ >
66
+ {fullAccessOverrideExplanation(approval.fullAccessOverride)}
67
+ </PopoverPopup>
68
+ </Popover>
69
+ ) : null}
70
{pendingCount > 1 ? (
71
<span className="ml-auto shrink-0 tabular-nums">1/{pendingCount}</span>
72
) : null}
@@ -63,6 +86,11 @@ export const ComposerPendingApprovalPanel = memo(function ComposerPendingApprova
86
? "Provider process is gone — interrupt or restart the run to respond."
87
: approval.detail || fallbackLabel}
88
</Detail>
89
+ {approval.reason ? (
90
+ <span className="w-full min-w-0 text-2xs text-muted-foreground wrap-break-word">
91
+ {approval.reason}
92
+ </span>
93
+ ) : null}
94
</span>
95
);
96
});
packages/client-runtime/src/state/threadRequests.ts
+17
@@ -2,6 +2,7 @@ import type {
2
OrchestrationV2ThreadProjection,
3
OrchestrationV2RuntimeRequest,
4
OrchestrationV2UserInputQuestion,
5
+ ProviderApprovalFullAccessOverride,
6
ProviderApprovalOption,
7
ProviderApprovalDecision,
8
ProviderRequestKind,
@@ -33,11 +34,23 @@ export interface ThreadPendingApproval {
34
readonly requestKind: ProviderRequestKind;
35
readonly createdAt: string;
36
readonly detail?: string;
37
+ readonly reason?: string;
38
+ readonly fullAccessOverride?: ProviderApprovalFullAccessOverride;
39
readonly appName?: string;
40
readonly options?: ReadonlyArray<ProviderApprovalOption>;
41
readonly responseCapability: "live" | "not_resumable";
42
}
43
44
+export const FULL_ACCESS_OVERRIDE_QUESTION = "Why am I being asked this?";
45
+
46
+export function fullAccessOverrideExplanation(
47
+ override: ProviderApprovalFullAccessOverride,
48
+): string {
49
+ return override === "ask_rule"
50
+ ? "Full access skips approvals, but an ask rule in the agent's own settings matches this action, so it still asks. Remove or narrow that rule to stop these prompts."
51
+ : "Full access skips approvals, but the agent still stops for a few safety checks of its own that no setting can skip, such as a delete whose path it can't verify. T3 Code can't turn these off, so check the request and approve it if it's what you expect.";
52
+}
53
+
54
export interface ThreadUserInputQuestion extends Omit<
55
OrchestrationV2UserInputQuestion,
56
"multiSelect"
@@ -119,6 +132,10 @@ export function derivePendingThreadRequests(
132
requestKind: request.kind,
133
createdAt: DateTime.formatIso(request.createdAt),
134
...(item?.type === "approval_request" && item.prompt ? { detail: item.prompt } : {}),
135
+ ...(item?.type === "approval_request" && item.reason ? { reason: item.reason } : {}),
136
+ ...(item?.type === "approval_request" && item.fullAccessOverride
137
+ ? { fullAccessOverride: item.fullAccessOverride }
138
+ : {}),
139
...(item?.type === "approval_request" && item.appName ? { appName: item.appName } : {}),
140
...(item?.type === "approval_request" && item.options !== undefined
141
? { options: item.options }
packages/contracts/src/orchestrationV2.ts
+5
@@ -55,6 +55,7 @@ import {
55
} from "./threadPullRequest.ts";
56
import {
57
ProviderApprovalDecision,
58
+ ProviderApprovalFullAccessOverride,
59
ProviderApprovalOption,
60
ProviderInteractionMode,
61
ProviderRequestKind,
@@ -1429,6 +1430,8 @@ export const OrchestrationV2TurnItem = Schema.Union([
1430
requestId: RuntimeRequestId,
1431
requestKind: ProviderRequestKind,
1432
prompt: Schema.optional(Schema.String),
1433
+ reason: Schema.optional(Schema.String),
1434
+ fullAccessOverride: Schema.optional(ProviderApprovalFullAccessOverride),
1435
appName: Schema.optional(Schema.String),
1436
options: Schema.optional(Schema.Array(ProviderApprovalOption)),
1437
}),
@@ -2189,6 +2192,8 @@ export const OrchestrationV2TurnItemJson = Schema.Union([
2192
requestId: RuntimeRequestId,
2193
requestKind: ProviderRequestKind,
2194
prompt: Schema.optional(Schema.String),
2195
+ reason: Schema.optional(Schema.String),
2196
+ fullAccessOverride: Schema.optional(ProviderApprovalFullAccessOverride),
2197
appName: Schema.optional(Schema.String),
2198
options: Schema.optional(Schema.Array(ProviderApprovalOption)),
2199
}),
packages/contracts/src/providerPolicy.ts
+5
@@ -56,6 +56,11 @@ export const ProviderApprovalDecision = Schema.Literals([
56
]);
57
export type ProviderApprovalDecision = typeof ProviderApprovalDecision.Type;
58
59
+// Why an approval reached the user although the thread runs with full access:
60
+// the user's own ask rule, or a check the provider enforces even when bypassed.
61
+export const ProviderApprovalFullAccessOverride = Schema.Literals(["ask_rule", "provider_check"]);
62
+export type ProviderApprovalFullAccessOverride = typeof ProviderApprovalFullAccessOverride.Type;
63
+
64
export const ProviderApprovalOption = Schema.Struct({
65
decision: ProviderApprovalDecision,
66
label: TrimmedNonEmptyString,