The best way to control Claude Code, Codex and more from any computer or phone
fix(web,mobile): subagent cards show which account each subagent runs on (#24898)
Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
Vitaly Iegorov committed
Nov 1, 2026 at 03:06 UTC
2c59bf66c7fec2d3799ef62700edc2b457c15a1c
7 files changed
+119
-24
apps/mobile/src/components/ProviderIcon.tsx
+1
-1
@@ -181,7 +181,7 @@ export function ProviderInstanceIcon(props: {
181
paddingHorizontal: 2,
182
borderRadius: 999,
183
borderWidth: 1,
184
- borderColor: props.surfaceColor,
184
+ ...(props.surfaceColor ? { borderColor: props.surfaceColor } : {}),
185
backgroundColor: accentColor,
186
alignItems: "center",
187
justifyContent: "center",
apps/mobile/src/features/threads/thread-subagent-group.tsx
+46
-13
@@ -1,19 +1,23 @@
1
import { useAtomValue } from "@effect/atom-react";
2
import { StackActions, useNavigation } from "@react-navigation/native";
3
import { scopeThreadRef } from "@t3tools/client-runtime/environment";
4
+import {
5
+ resolveProviderInstanceDisplayName,
6
+ shouldShowInstanceBadge,
7
+} from "@t3tools/client-runtime/state/provider-instance-display";
8
import { summarizeSubagentStatuses } from "@t3tools/client-runtime/state/subagent-display";
9
import { isActiveSubagentStatus } from "@t3tools/client-runtime/state/subagentRuntime";
10
import type {
11
EnvironmentId,
12
OrchestrationV2Subagent,
13
OrchestrationV2TurnItem,
10
- ServerProvider,
14
+ ServerConfig,
15
} from "@t3tools/contracts";
16
import { Pressable, View, type ColorValue } from "react-native";
17
18
import { AppText as Text } from "../../components/ui/AppText";
19
import { SymbolView } from "../../components/ui/AppSymbol";
16
-import { ProviderIcon } from "../../components/ProviderIcon";
20
+import { ProviderIcon, ProviderInstanceIcon } from "../../components/ProviderIcon";
21
import { cn } from "../../lib/cn";
22
import type { ThreadFeedActivity } from "../../lib/threadActivity";
23
import { serverEnvironment } from "../../state/server";
@@ -42,21 +46,53 @@ function SubagentElapsed({ agents }: { readonly agents: ReadonlyArray<AgentTimin
46
47
function SubagentAvatar(props: {
48
readonly item: SubagentItem;
45
- readonly provider: ServerProvider | undefined;
49
+ readonly config: ServerConfig | null | undefined;
50
}) {
51
+ const providers = props.config?.providers ?? [];
52
+ const provider = providers.find(
53
+ (candidate) => candidate.instanceId === props.item.providerInstanceId,
54
+ );
55
// A remote task's own driver is only a "remote" label.
56
const driver =
49
- props.provider?.driver ??
50
- (props.item.remoteChild === undefined ? props.item.driver : undefined);
57
+ provider?.driver ?? (props.item.remoteChild === undefined ? props.item.driver : undefined);
58
+ const badgeEntries = providers.map((candidate) => {
59
+ const rawConfig = props.config?.settings.providerInstances[candidate.instanceId]?.config;
60
+ const instanceConfig =
61
+ rawConfig !== null && typeof rawConfig === "object"
62
+ ? (rawConfig as Readonly<Record<string, unknown>>)
63
+ : null;
64
+ const agentId = instanceConfig?.source === "local" ? undefined : instanceConfig?.agentId;
65
+ return {
66
+ ...candidate,
67
+ driverKind: candidate.driver,
68
+ acpRegistryAgentId: typeof agentId === "string" ? agentId.trim() || undefined : undefined,
69
+ };
70
+ });
71
+ const badgeEntry = badgeEntries.find(
72
+ (candidate) => candidate.instanceId === props.item.providerInstanceId,
73
+ );
74
+ const showBadge =
75
+ provider !== undefined &&
76
+ badgeEntry !== undefined &&
77
+ shouldShowInstanceBadge(badgeEntry, badgeEntries);
78
return (
79
<View
80
accessible={false}
81
className="h-7 w-7 shrink-0 items-center justify-center rounded-full border border-border bg-card"
82
>
56
- {driver === undefined ? (
83
+ {showBadge ? (
84
+ <ProviderInstanceIcon
85
+ provider={provider.driver}
86
+ iconUrl={provider.iconUrl}
87
+ size={15}
88
+ displayName={resolveProviderInstanceDisplayName(provider)}
89
+ accentColor={provider.accentColor}
90
+ showBadge
91
+ />
92
+ ) : driver === undefined ? (
93
<SymbolView name="sparkles" size={13} tintColorClassName="accent-icon-muted" />
94
) : (
59
- <ProviderIcon provider={driver} iconUrl={props.provider?.iconUrl} size={15} />
95
+ <ProviderIcon provider={driver} iconUrl={provider?.iconUrl} size={15} />
96
)}
97
</View>
98
);
@@ -100,11 +136,8 @@ export function ThreadSubagentGroup(props: {
136
const expanded = props.expandedRows[props.anchorKey] ?? false;
137
const serverConfigs = useServerConfigs();
138
// A task in a linked environment runs a provider instance of that environment.
103
- const providerOf = (item: SubagentItem) =>
104
- (item.remoteChild === undefined
105
- ? config
106
- : serverConfigs.get(item.remoteChild.environmentId)
107
- )?.providers.find((provider) => provider.instanceId === item.providerInstanceId);
139
+ const configOf = (item: SubagentItem) =>
140
+ item.remoteChild === undefined ? config : serverConfigs.get(item.remoteChild.environmentId);
141
return (
142
<WorkLogBlock>
143
{grouped ? (
@@ -118,7 +151,7 @@ export function ThreadSubagentGroup(props: {
151
<View className="flex-row items-center">
152
{agents.slice(0, 3).map((agent, index) => (
153
<View key={agent.item.id} style={{ marginLeft: index === 0 ? 0 : -7 }}>
121
- <SubagentAvatar item={agent.item} provider={providerOf(agent.item)} />
154
+ <SubagentAvatar item={agent.item} config={configOf(agent.item)} />
155
</View>
156
))}
157
{agents.length > 3 ? (
apps/web/src/components/chat/V2LifecycleRow.tsx
+30
-5
@@ -47,6 +47,7 @@ import {
47
import { Tooltip, TooltipTrigger, TooltipPopup } from "../ui/tooltip";
48
import {
49
applyProviderInstanceSettings,
50
+ brandProviderInstanceEntries,
51
deriveProviderInstanceEntries,
52
shouldShowInstanceBadge,
53
type ProviderInstanceEntry,
@@ -206,12 +207,16 @@ function SubagentAvatar({
207
driver,
208
displayName,
209
iconUrl,
210
+ accentColor,
211
+ showBadge,
212
status,
213
className,
214
}: {
215
driver?: ProviderDriverKind | undefined;
216
displayName?: string | undefined;
217
iconUrl?: string | undefined;
218
+ accentColor?: string | undefined;
219
+ showBadge: boolean;
220
status?: OrchestrationV2TurnItem["status"] | undefined;
221
className?: string;
222
}) {
@@ -227,7 +232,10 @@ function SubagentAvatar({
232
<ProviderInstanceIcon
233
driverKind={driver}
234
displayName={displayName ?? driver}
235
+ accentColor={accentColor}
236
acpRegistryIconUrl={iconUrl}
237
+ showBadge={showBadge}
238
+ size="compact"
239
className="z-auto"
240
iconClassName="size-3.5"
241
/>
@@ -237,7 +245,8 @@ function SubagentAvatar({
245
{status ? (
246
<span
247
className={cn(
240
- "absolute -right-px -bottom-px size-2 rounded-full ring-2 ring-background",
248
+ "absolute size-2 rounded-full ring-2 ring-background",
249
+ showBadge ? "-left-px -top-px" : "-right-px -bottom-px",
250
subagentStatusVisual(status).dotClass,
251
)}
252
/>
@@ -261,9 +270,13 @@ export function EnvironmentSubagentAvatar({
270
remote?: OrchestrationV2RemoteTaskChild | undefined;
271
status?: OrchestrationV2TurnItem["status"] | undefined;
272
}) {
264
- const providersAtom = serverEnvironment.providersValueAtom(
265
- remote?.environmentId ?? environmentId,
266
- );
273
+ const providerEnvironmentId = remote?.environmentId ?? environmentId;
274
+ const providersAtom = serverEnvironment.providersValueAtom(providerEnvironmentId);
275
+ const settings = useAtomValue(serverEnvironment.settingsValueAtom(providerEnvironmentId));
276
+ const entries = (providers: ReadonlyArray<ServerProvider> | null | undefined) => {
277
+ const derived = deriveProviderInstanceEntries(providers ?? []);
278
+ return settings ? brandProviderInstanceEntries(derived, settings) : derived;
279
+ };
280
const providerDriver = useAtomValue(
281
providersAtom,
282
(providers) =>
@@ -272,8 +285,18 @@ export function EnvironmentSubagentAvatar({
285
const displayName = useAtomValue(
286
providersAtom,
287
(providers) =>
275
- providers?.find((provider) => provider.instanceId === providerInstanceId)?.displayName,
288
+ entries(providers).find((entry) => entry.instanceId === providerInstanceId)?.displayName,
289
+ );
290
+ const accentColor = useAtomValue(
291
+ providersAtom,
292
+ (providers) =>
293
+ entries(providers).find((entry) => entry.instanceId === providerInstanceId)?.accentColor,
294
);
295
+ const showBadge = useAtomValue(providersAtom, (providers) => {
296
+ const all = entries(providers);
297
+ const entry = all.find((candidate) => candidate.instanceId === providerInstanceId);
298
+ return entry !== undefined && shouldShowInstanceBadge(entry, all);
299
+ });
300
const iconUrl = useAtomValue(
301
providersAtom,
302
(providers) =>
@@ -285,6 +308,8 @@ export function EnvironmentSubagentAvatar({
308
driver={providerDriver ?? (remote === undefined ? driver : undefined)}
309
displayName={displayName}
310
iconUrl={iconUrl}
311
+ accentColor={accentColor}
312
+ showBadge={showBadge}
313
/>
314
);
315
}
apps/web/src/providerInstances.test.ts
+27
@@ -8,6 +8,7 @@ import {
8
import { describe, expect, it } from "vite-plus/test";
9
import {
10
applyProviderInstanceSettings,
11
+ brandProviderInstanceEntries,
12
deriveProviderEntriesByEnvironment,
13
deriveProviderInstanceEntries,
14
getDefaultProviderInstanceModel,
@@ -254,6 +255,32 @@ describe("deriveProviderEntriesByEnvironment", () => {
255
});
256
});
257
258
+describe("brandProviderInstanceEntries", () => {
259
+ it("keeps an instance a project turns on as a sibling for the instance badge", () => {
260
+ const codex = ProviderDriverKind.make("codex");
261
+ const settings = {
262
+ providerInstances: {
263
+ [ProviderInstanceId.make("codex_work")]: { driver: codex, enabled: false },
264
+ },
265
+ projectSettingsOverrides: {
266
+ [ProjectId.make("project-work")]: {
267
+ providerInstances: { [ProviderInstanceId.make("codex_work")]: { enabled: true } },
268
+ },
269
+ },
270
+ };
271
+ const entries = brandProviderInstanceEntries(
272
+ deriveProviderInstanceEntries([
273
+ provider({ provider: codex, instanceId: "codex" }),
274
+ provider({ provider: codex, instanceId: "codex_work" }),
275
+ ]),
276
+ settings,
277
+ );
278
+ const personal = entries.find((entry) => entry.instanceId === "codex");
279
+
280
+ expect(personal && shouldShowInstanceBadge(personal, entries)).toBe(true);
281
+ });
282
+});
283
+
284
describe("resolveSelectableProviderInstance", () => {
285
it("falls back to the first enabled and available instance", () => {
286
const disabled = ProviderInstanceId.make("codex");
apps/web/src/providerInstances.ts
+9
-4
@@ -93,10 +93,7 @@ export function deriveProviderEntriesByEnvironment(
93
const byEnvironment = new Map<string, ReadonlyMap<string, ProviderInstanceEntry>>();
94
for (const [environmentId, providers, settings] of providersByEnvironment) {
95
const derived = deriveProviderInstanceEntries(providers);
96
- // The snapshot includes instances enabled by any project; machine settings alone do not.
97
- const entries = settings
98
- ? derived.map((entry) => applyProviderInstanceBranding(entry, settings))
99
- : derived;
96
+ const entries = settings ? brandProviderInstanceEntries(derived, settings) : derived;
97
byEnvironment.set(
98
environmentId,
99
new Map(entries.map((entry) => [entry.instanceId as string, entry] as const)),
@@ -105,6 +102,14 @@ export function deriveProviderEntriesByEnvironment(
102
return byEnvironment;
103
}
104
105
+// The snapshot includes instances enabled by any project; machine settings alone do not.
106
+export function brandProviderInstanceEntries(
107
+ entries: ReadonlyArray<ProviderInstanceEntry>,
108
+ settings: Pick<ServerSettings, "providerInstances">,
109
+): ReadonlyArray<ProviderInstanceEntry> {
110
+ return entries.map((entry) => applyProviderInstanceBranding(entry, settings));
111
+}
112
+
113
/** projectId applies project overrides; explicit null uses machine settings. */
114
export function applyProviderInstanceSettings(
115
entries: ReadonlyArray<ProviderInstanceEntry>,
packages/client-runtime/src/state/providerInstanceDisplay.test.ts
+5
@@ -62,6 +62,11 @@ describe("shouldShowInstanceBadge", () => {
62
expect(shouldShowInstanceBadge(entry, [entry])).toBe(true);
63
});
64
65
+ it("ignores a non-hex accent color", () => {
66
+ const entry = { driverKind: codex, accentColor: "blue", enabled: true };
67
+ expect(shouldShowInstanceBadge(entry, [entry])).toBe(false);
68
+ });
69
+
70
it("shows the badge when two entries share a driver, even without an accent", () => {
71
const first = { driverKind: codex, accentColor: undefined, enabled: true };
72
const second = { driverKind: codex, accentColor: undefined, enabled: true };
packages/client-runtime/src/state/providerInstanceDisplay.ts
+1
-1
@@ -74,7 +74,7 @@ export function shouldShowInstanceBadge(
74
readonly enabled: boolean;
75
}>,
76
): boolean {
77
- if (entry.accentColor) return true;
77
+ if (normalizeProviderAccentColor(entry.accentColor)) return true;
78
let sharedProviderCount = 0;
79
for (const candidate of entries) {
80
if (candidate.driverKind !== entry.driverKind) continue;