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 23, 01:45 UTC
fix(clients): handoffs between accounts show which account is on each side (#15477)
Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com> Co-authored-by: Julius Marminge <julius0216@outlook.com>
Vitaly Iegorov committed
Oct 19, 2026 at 22:24 UTC
27b0dbb30ee1ebeb3b592d3757ba6588a18c1b17
7 files changed
+90
-30
apps/mobile/src/features/threads/ThreadFeed.tsx
+2
@@ -1101,6 +1101,7 @@ function renderFeedEntry(
1101
environmentId={props.environmentId}
1102
projectedItem={entry.activities[0]!.projectedItem}
1103
iconColor={iconSubtleColor}
1104
+ surfaceColor={props.screenColor}
1105
/>
1106
);
1107
}
@@ -2546,6 +2547,7 @@ export const ThreadFeed = memo(function ThreadFeed(props: ThreadFeedProps) {
2547
environmentId={props.environmentId}
2548
endpoints={props.pendingHandoff}
2549
iconColor={iconSubtleColor}
2550
+ surfaceColor={screenColor}
2551
label="Context handoff pending"
2552
/>
2553
) : null
apps/mobile/src/features/threads/thread-handoff-row.tsx
+54
-11
@@ -2,7 +2,11 @@ import * as Dialog from "../../components/ui/Dialog";
2
import { useAtomValue } from "@effect/atom-react";
3
import { scopeThreadRef } from "@t3tools/client-runtime/environment";
4
import { resolveHandoffEndpoints, type HandoffEndpoints } from "@t3tools/client-runtime/handoff";
5
-import { resolveProviderInstanceDisplayName } from "@t3tools/client-runtime/state/provider-instance-display";
5
+import {
6
+ normalizeProviderAccentColor,
7
+ resolveProviderInstanceDisplayName,
8
+ shouldShowInstanceBadge,
9
+} from "@t3tools/client-runtime/state/provider-instance-display";
10
import type {
11
EnvironmentId,
12
OrchestrationV2ProjectedTurnItem,
@@ -14,11 +18,16 @@ import { useMemo } from "react";
18
import { Pressable, View, type ColorValue } from "react-native";
19
import { AppText as Text } from "../../components/ui/AppText";
20
import { SymbolView } from "../../components/ui/AppSymbol";
17
-import { ProviderIcon } from "../../components/ProviderIcon";
21
+import { ProviderIcon, ProviderInstanceIcon } from "../../components/ProviderIcon";
22
import { environmentThreadDetails } from "../../state/threads";
23
import { serverEnvironment } from "../../state/server";
24
import { ThreadContextDivider } from "./thread-context-divider";
25
26
+type HandoffProvider = ServerProvider & {
27
+ readonly driverKind: ServerProvider["driver"];
28
+ readonly acpRegistryAgentId: string | undefined;
29
+};
30
+
31
function handoffEndpointsAtom(
32
environmentId: EnvironmentId,
33
{ item, sourceThreadId }: OrchestrationV2ProjectedTurnItem,
@@ -39,6 +48,7 @@ export function ThreadHandoffRow(props: {
48
environmentId: EnvironmentId;
49
projectedItem: OrchestrationV2ProjectedTurnItem;
50
iconColor: ColorValue;
51
+ surfaceColor: string;
52
}) {
53
const { item } = props.projectedItem;
54
const endpointsAtom = useMemo(
@@ -53,6 +63,7 @@ export function ThreadHandoffRow(props: {
63
environmentId={props.environmentId}
64
endpoints={endpoints}
65
iconColor={color}
66
+ surfaceColor={props.surfaceColor}
67
label="Context handoff"
68
failed={item.status === "failed"}
69
/>
@@ -63,11 +74,29 @@ export function ThreadHandoffDivider(props: {
74
environmentId: EnvironmentId;
75
endpoints: HandoffEndpoints;
76
iconColor: ColorValue;
77
+ surfaceColor: string;
78
label: string;
79
failed?: boolean;
80
}) {
81
const config = useAtomValue(serverEnvironment.configValueAtom(props.environmentId));
82
const { endpoints } = props;
83
+ const endpointProps = {
84
+ providers: (config?.providers ?? []).map((provider) => {
85
+ const rawConfig = config?.settings.providerInstances[provider.instanceId]?.config;
86
+ const instanceConfig =
87
+ rawConfig !== null && typeof rawConfig === "object"
88
+ ? (rawConfig as Readonly<Record<string, unknown>>)
89
+ : null;
90
+ const agentId = instanceConfig?.source === "local" ? undefined : instanceConfig?.agentId;
91
+ return {
92
+ ...provider,
93
+ driverKind: provider.driver,
94
+ accentColor: normalizeProviderAccentColor(provider.accentColor),
95
+ acpRegistryAgentId: typeof agentId === "string" ? agentId.trim() || undefined : undefined,
96
+ };
97
+ }),
98
+ surfaceColor: props.surfaceColor,
99
+ };
100
return (
101
<ThreadContextDivider
102
label={props.label}
@@ -81,7 +110,7 @@ export function ThreadHandoffDivider(props: {
110
key={`${endpoint.instanceId}:${endpoint.model ?? ""}`}
111
className="max-w-full flex-row items-center"
112
>
84
- <HandoffEndpoint {...endpoint} providers={config?.providers ?? []} />
113
+ <HandoffEndpoint {...endpoint} {...endpointProps} />
114
{index < endpoints.from.length - 1 ? (
115
<Text accessible={false} className="text-xs text-foreground-muted">
116
,
@@ -92,7 +121,7 @@ export function ThreadHandoffDivider(props: {
121
{endpoints.from.length > 0 ? (
122
<SymbolView name="arrow.right" size={12} tintColor={props.iconColor} />
123
) : null}
95
- <HandoffEndpoint {...endpoints.to} providers={config?.providers ?? []} />
124
+ <HandoffEndpoint {...endpoints.to} {...endpointProps} />
125
</View>
126
</ThreadContextDivider>
127
);
@@ -101,7 +130,8 @@ export function ThreadHandoffDivider(props: {
130
function HandoffEndpoint(props: {
131
instanceId: ProviderInstanceId;
132
model?: string | undefined;
104
- providers: ReadonlyArray<ServerProvider>;
133
+ providers: ReadonlyArray<HandoffProvider>;
134
+ surfaceColor: string;
135
}) {
136
const provider = props.providers.find((candidate) => candidate.instanceId === props.instanceId);
137
const model = provider?.models.find((candidate) => candidate.slug === props.model);
@@ -110,12 +140,13 @@ function HandoffEndpoint(props: {
140
model?.name ??
141
props.model ??
142
(provider ? resolveProviderInstanceDisplayName(provider) : props.instanceId);
143
+ const showBadge = provider !== undefined && shouldShowInstanceBadge(provider, props.providers);
144
return (
145
<Pressable
146
accessibilityRole="button"
147
accessibilityLabel={label}
148
accessibilityHint="Show provider account"
118
- className="min-h-6 max-w-full flex-row items-center justify-center gap-1"
149
+ className="min-h-6 max-w-full flex-row items-center justify-center gap-1.5"
150
hitSlop={{ top: 8, bottom: 8 }}
151
onPress={() =>
152
Dialog.alert(
@@ -124,11 +155,23 @@ function HandoffEndpoint(props: {
155
)
156
}
157
>
127
- <ProviderIcon
128
- provider={provider?.driver ?? props.instanceId}
129
- iconUrl={provider?.iconUrl}
130
- size={12}
131
- />
158
+ {showBadge && provider !== undefined ? (
159
+ <ProviderInstanceIcon
160
+ provider={provider.driver}
161
+ iconUrl={provider.iconUrl}
162
+ size={14}
163
+ displayName={resolveProviderInstanceDisplayName(provider)}
164
+ accentColor={provider.accentColor}
165
+ showBadge
166
+ surfaceColor={props.surfaceColor}
167
+ />
168
+ ) : (
169
+ <ProviderIcon
170
+ provider={provider?.driver ?? props.instanceId}
171
+ iconUrl={provider?.iconUrl}
172
+ size={12}
173
+ />
174
+ )}
175
<Text numberOfLines={1} className="shrink text-xs text-foreground-muted">
176
{label}
177
</Text>
apps/web/src/components/ChatView.tsx
+1
@@ -8001,6 +8001,7 @@ export default function ChatView(props: ChatViewProps) {
8001
<>
8002
<div className="chat-content-lane">
8003
<HandoffRow
8004
+ environmentId={environmentId}
8005
endpoints={pendingHandoff}
8006
providers={providerStatuses}
8007
pending
apps/web/src/components/Sidebar.tsx
+2
-2
@@ -905,8 +905,8 @@ function SidebarProviderStack(props: {
905
acpRegistryAgentId={currentEntry.acpRegistryAgentId}
906
acpRegistryIconUrl={currentEntry.acpRegistryIconUrl}
907
showBadge={showInstanceBadge}
908
- iconClassName="size-3.5 opacity-60"
909
- badgeClassName="right-[-0.1875rem] bottom-[-0.1875rem] h-3 min-w-3 px-0.5 text-5xs"
908
+ size="compact"
909
+ iconClassName="opacity-60"
910
/>
911
);
912
if (stack.length === 1) {
apps/web/src/components/chat/ProviderInstanceIcon.tsx
+8
-4
@@ -61,6 +61,7 @@ export const ProviderInstanceIcon = memo(function ProviderInstanceIcon(props: {
61
acpRegistryIconUrl?: string | undefined;
62
showBadge?: boolean;
63
badgeContent?: "initials" | "none";
64
+ size?: "default" | "compact";
65
className?: string;
66
iconClassName?: string;
67
badgeClassName?: string;
@@ -74,6 +75,7 @@ export const ProviderInstanceIcon = memo(function ProviderInstanceIcon(props: {
75
? ({ "--provider-accent": props.accentColor } as CSSProperties)
76
: undefined;
77
const badgeContent = props.badgeContent ?? "initials";
78
+ const iconClassName = cn(props.size === "compact" && "size-3.5", props.iconClassName);
79
const isAcpRegistry = props.driverKind === "acpRegistry";
80
const acpRegistryIconUrl = resolveProviderInstanceAcpRegistryIconUrl({
81
driverKind: props.driverKind,
@@ -92,20 +94,20 @@ export const ProviderInstanceIcon = memo(function ProviderInstanceIcon(props: {
94
>
95
{isAcpRegistry ? (
96
<AcpRegistryAgentIcon
95
- className={cn("size-5 rounded-none bg-transparent", props.iconClassName)}
97
+ className={cn("size-5 rounded-none bg-transparent", iconClassName)}
98
fallbackClassName="size-full"
99
icon={acpRegistryIconUrl}
100
/>
101
) : packageIcon ? (
102
<ProviderPackageIcon
103
icon={packageIcon}
102
- className={cn("size-5 shrink-0", props.iconClassName)}
104
+ className={cn("size-5 shrink-0", iconClassName)}
105
aria-hidden
106
/>
107
) : Icon ? (
106
- <Icon className={cn("size-5 shrink-0", props.iconClassName)} aria-hidden />
108
+ <Icon className={cn("size-5 shrink-0", iconClassName)} aria-hidden />
109
) : (
108
- <span className={cn("text-3xs font-semibold leading-none", props.iconClassName)}>
110
+ <span className={cn("text-3xs font-semibold leading-none", iconClassName)}>
111
{providerInstanceInitials(props.displayName)}
112
</span>
113
)}
@@ -126,6 +128,8 @@ export const ProviderInstanceIcon = memo(function ProviderInstanceIcon(props: {
128
props.accentColor
129
? "bg-(--provider-accent) text-white"
130
: "bg-card text-muted-foreground",
131
+ props.size === "compact" &&
132
+ "right-[-0.1875rem] bottom-[-0.1875rem] h-3 min-w-3 px-0.5 text-5xs",
133
props.badgeClassName,
134
)}
135
style={{ borderColor: indicatorBackground }}
apps/web/src/components/chat/V2LifecycleRow.tsx
+22
-12
@@ -42,7 +42,12 @@ import {
42
} from "lucide-react";
43
44
import { Tooltip, TooltipTrigger, TooltipPopup } from "../ui/tooltip";
45
-import { getProviderInstanceEntry } from "../../providerInstances";
45
+import {
46
+ applyProviderInstanceSettings,
47
+ deriveProviderInstanceEntries,
48
+ shouldShowInstanceBadge,
49
+ type ProviderInstanceEntry,
50
+} from "../../providerInstances";
51
import { formatShortTimestamp } from "../../timestampFormat";
52
import { getTriggerDisplayModelName } from "./providerIconUtils";
53
import { ProviderInstanceIcon, providerTextColor } from "./ProviderInstanceIcon";
@@ -575,16 +580,20 @@ function EnvironmentHandoffRow({
580
}) {
581
const providers =
582
useAtomValue(serverEnvironment.providersValueAtom(environmentId)) ?? EMPTY_SERVER_PROVIDERS;
578
- return <HandoffRow {...props} providers={providers} />;
583
+ return <HandoffRow {...props} environmentId={environmentId} providers={providers} />;
584
}
585
586
export function HandoffRow(props: {
587
+ readonly environmentId: EnvironmentId;
588
readonly endpoints: HandoffEndpoints;
589
readonly providers: ReadonlyArray<ServerProvider>;
590
readonly pending?: boolean;
591
readonly failed?: boolean;
592
}) {
593
const { from: fromEndpoints, to } = props.endpoints;
594
+ const settings = useAtomValue(serverEnvironment.settingsValueAtom(props.environmentId));
595
+ const derived = deriveProviderInstanceEntries(props.providers);
596
+ const entries = settings ? applyProviderInstanceSettings(derived, settings, null) : derived;
597
return (
598
<TimelineSystemDivider
599
label={props.pending ? "Context handoff pending" : "Context handoff"}
@@ -599,7 +608,7 @@ export function HandoffRow(props: {
608
className="inline-flex min-w-0 items-center"
609
>
610
<HandoffEndpoint
602
- providers={props.providers}
611
+ entries={entries}
612
instanceId={endpoint.instanceId}
613
model={endpoint.model}
614
/>
@@ -613,11 +622,7 @@ export function HandoffRow(props: {
622
{fromEndpoints.length > 0 ? (
623
<ArrowRightIcon aria-hidden="true" className="size-3 shrink-0" />
624
) : null}
616
- <HandoffEndpoint
617
- providers={props.providers}
618
- instanceId={to.instanceId}
619
- model={to.model}
620
- />
625
+ <HandoffEndpoint entries={entries} instanceId={to.instanceId} model={to.model} />
626
</span>
627
}
628
/>
@@ -625,11 +630,12 @@ export function HandoffRow(props: {
630
}
631
632
function HandoffEndpoint(props: {
628
- readonly providers: ReadonlyArray<ServerProvider>;
633
+ readonly entries: ReadonlyArray<ProviderInstanceEntry>;
634
readonly instanceId: ProviderInstanceId;
635
readonly model?: string | undefined;
636
}) {
632
- const entry = getProviderInstanceEntry(props.providers, props.instanceId);
637
+ const entry = props.entries.find((candidate) => candidate.instanceId === props.instanceId);
638
+ const showBadge = entry !== undefined && shouldShowInstanceBadge(entry, props.entries);
639
const model = props.model?.trim();
640
const providerModel =
641
model === undefined || model.length === 0
@@ -650,14 +656,18 @@ function HandoffEndpoint(props: {
656
render={
657
<span
658
tabIndex={0}
653
- className="inline-flex min-w-0 items-center gap-1 rounded-sm focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-inset focus-visible:ring-ring"
659
+ className="inline-flex min-w-0 items-center gap-1.5 rounded-sm focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-inset focus-visible:ring-ring"
660
>
661
<ProviderInstanceIcon
662
driverKind={entry?.driverKind ?? ProviderDriverKind.make(props.instanceId)}
663
displayName={entry?.displayName ?? props.instanceId}
664
+ accentColor={entry?.accentColor}
665
acpRegistryAgentId={entry?.acpRegistryAgentId}
666
acpRegistryIconUrl={entry?.acpRegistryIconUrl}
660
- iconClassName="size-3"
667
+ showBadge={showBadge}
668
+ size="compact"
669
+ iconClassName={cn(showBadge && "opacity-60")}
670
+ indicatorBackground="var(--background)"
671
/>
672
<span
673
className={cn("truncate font-medium", labelColor.className)}
apps/web/src/providerInstances.ts
+1
-1
@@ -203,7 +203,7 @@ export function sortProviderInstanceEntries(
203
return sorted;
204
}
205
206
-export function getProviderInstanceEntry(
206
+function getProviderInstanceEntry(
207
providers: ReadonlyArray<ServerProvider>,
208
instanceId: ProviderInstanceId,
209
): ProviderInstanceEntry | undefined {