Skip to content

Commit ddde982

Browse files
feat(web,mobile): "Why am I being asked this?" explains full-access approvals
The header label only said the approval was required even in full access. A trigger now opens a longer explanation: a popover on web that opens on hover or tap, and an inline expansion on mobile. Claude Code's specific reason stays visible on the card. Co-Authored-By: Claude Opus 5.5 <[email protected]>
1 parent ed9d75a commit ddde982

3 files changed

Lines changed: 54 additions & 17 deletions

File tree

‎apps/mobile/src/features/threads/PendingApprovalCard.tsx‎

Lines changed: 25 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,12 @@ import type {
44
ProviderApprovalOption,
55
RuntimeRequestId,
66
} from "@t3tools/contracts";
7-
import { fullAccessOverrideLabel } from "@t3tools/client-runtime/state/thread-requests";
8-
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";
913

1014
import { AppText as Text } from "../../components/ui/AppText";
1115
import type { PendingApproval } from "../../lib/threadActivity";
@@ -32,6 +36,7 @@ export function PendingApprovalCard(props: PendingApprovalCardProps) {
3236
const warning = options.find((option) => option.warning)?.warning;
3337
const canRespond = props.approval.responseCapability === "live";
3438
const disabled = !canRespond || props.respondingApprovalId === props.approval.requestId;
39+
const [explanationOpen, setExplanationOpen] = useState(false);
3540
return (
3641
<View className="gap-2.5 rounded-[20px] border border-border bg-card-alt p-4">
3742
<Text className="font-t3-bold text-2xs uppercase tracking-[1.1px] text-foreground-secondary">
@@ -45,18 +50,27 @@ export function PendingApprovalCard(props: PendingApprovalCardProps) {
4550
{props.approval.detail}
4651
</Text>
4752
) : null}
48-
{props.approval.fullAccessOverride || props.approval.reason ? (
53+
{props.approval.reason ? (
4954
<Text className="font-sans text-xs leading-normal text-warning-foreground">
50-
{[
51-
props.approval.fullAccessOverride
52-
? fullAccessOverrideLabel(props.approval.fullAccessOverride)
53-
: undefined,
54-
props.approval.reason,
55-
]
56-
.filter(Boolean)
57-
.join(": ")}
55+
{props.approval.reason}
5856
</Text>
5957
) : 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}
6074
{!canRespond ? (
6175
<Text className="font-sans text-sm leading-5 text-foreground-muted">
6276
The provider process for this request is no longer available. Interrupt or restart the run

‎apps/web/src/components/chat/ComposerPendingApprovalPanel.tsx‎

Lines changed: 21 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,12 @@
1-
import { fullAccessOverrideLabel } from "@t3tools/client-runtime/state/thread-requests";
1+
import {
2+
FULL_ACCESS_OVERRIDE_QUESTION,
3+
fullAccessOverrideExplanation,
4+
} from "@t3tools/client-runtime/state/thread-requests";
25
import { memo } from "react";
36
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";
410
import { cn } from "~/lib/utils";
511

612
interface ComposerPendingApprovalPanelProps {
@@ -46,9 +52,20 @@ export const ComposerPendingApprovalPanel = memo(function ComposerPendingApprova
4652
<span className="shrink-0 font-medium text-warning">{fallbackLabel}</span>
4753
{approval.appName ? <span className="min-w-0 truncate">{approval.appName}</span> : null}
4854
{approval.fullAccessOverride ? (
49-
<span className="min-w-0 truncate">
50-
{fullAccessOverrideLabel(approval.fullAccessOverride)}
51-
</span>
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>
5269
) : null}
5370
{pendingCount > 1 ? (
5471
<span className="ml-auto shrink-0 tabular-nums">1/{pendingCount}</span>

‎packages/client-runtime/src/state/threadRequests.ts‎

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,8 +21,14 @@ export interface ThreadPendingApproval {
2121
readonly responseCapability: "live" | "not_resumable";
2222
}
2323

24-
export function fullAccessOverrideLabel(override: ProviderApprovalFullAccessOverride): string {
25-
return override === "ask_rule" ? "Your ask rule" : "Required even in full access";
24+
export const FULL_ACCESS_OVERRIDE_QUESTION = "Why am I being asked this?";
25+
26+
export function fullAccessOverrideExplanation(
27+
override: ProviderApprovalFullAccessOverride,
28+
): string {
29+
return override === "ask_rule"
30+
? "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."
31+
: "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.";
2632
}
2733

2834
export interface ThreadUserInputQuestion extends Omit<

0 commit comments

Comments
 (0)