Skip to content

Commit 35e0de9

Browse files
vitalyiegorovclaude
andcommitted
fix(web,mobile): distinct ACP agents no longer get account badges on subagent cards
Co-Authored-By: Claude Opus 5.5 <[email protected]>
1 parent ca5bc6e commit 35e0de9

2 files changed

Lines changed: 28 additions & 10 deletions

File tree

‎apps/mobile/src/features/threads/thread-subagent-group.tsx‎

Lines changed: 23 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ import type {
1111
EnvironmentId,
1212
OrchestrationV2Subagent,
1313
OrchestrationV2TurnItem,
14-
ServerProvider,
14+
ServerConfig,
1515
} from "@t3tools/contracts";
1616
import { useEffect, useState } from "react";
1717
import { AppState, Pressable, View, type ColorValue } from "react-native";
@@ -54,17 +54,32 @@ function SubagentElapsed({ agents }: { readonly agents: ReadonlyArray<AgentTimin
5454

5555
function SubagentAvatar(props: {
5656
readonly item: SubagentItem;
57-
readonly providers: ReadonlyArray<ServerProvider>;
57+
readonly config: ServerConfig | null | undefined;
5858
}) {
59-
const provider = props.providers.find(
59+
const providers = props.config?.providers ?? [];
60+
const provider = providers.find(
61+
(candidate) => candidate.instanceId === props.item.providerInstanceId,
62+
);
63+
const badgeEntries = providers.map((candidate) => {
64+
const rawConfig = props.config?.settings.providerInstances[candidate.instanceId]?.config;
65+
const instanceConfig =
66+
rawConfig !== null && typeof rawConfig === "object"
67+
? (rawConfig as Readonly<Record<string, unknown>>)
68+
: null;
69+
const agentId = instanceConfig?.source === "local" ? undefined : instanceConfig?.agentId;
70+
return {
71+
...candidate,
72+
driverKind: candidate.driver,
73+
acpRegistryAgentId: typeof agentId === "string" ? agentId.trim() || undefined : undefined,
74+
};
75+
});
76+
const badgeEntry = badgeEntries.find(
6077
(candidate) => candidate.instanceId === props.item.providerInstanceId,
6178
);
6279
const showBadge =
6380
provider !== undefined &&
64-
shouldShowInstanceBadge(
65-
{ ...provider, driverKind: provider.driver },
66-
props.providers.map((candidate) => ({ ...candidate, driverKind: candidate.driver })),
67-
);
81+
badgeEntry !== undefined &&
82+
shouldShowInstanceBadge(badgeEntry, badgeEntries);
6883
return (
6984
<View
7085
accessible={false}
@@ -133,7 +148,7 @@ export function ThreadSubagentGroup(props: {
133148
<View className="flex-row items-center">
134149
{agents.slice(0, 3).map((agent, index) => (
135150
<View key={agent.item.id} style={{ marginLeft: index === 0 ? 0 : -7 }}>
136-
<SubagentAvatar item={agent.item} providers={config?.providers ?? []} />
151+
<SubagentAvatar item={agent.item} config={config} />
137152
</View>
138153
))}
139154
{agents.length > 3 ? (

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

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -319,8 +319,11 @@ export function EnvironmentSubagentAvatar({
319319
status?: OrchestrationV2TurnItem["status"] | undefined;
320320
}) {
321321
const providersAtom = serverEnvironment.providersValueAtom(environmentId);
322-
const entries = (providers: ReadonlyArray<ServerProvider> | null | undefined) =>
323-
deriveProviderInstanceEntries(providers ?? []);
322+
const settings = useAtomValue(serverEnvironment.settingsValueAtom(environmentId));
323+
const entries = (providers: ReadonlyArray<ServerProvider> | null | undefined) => {
324+
const derived = deriveProviderInstanceEntries(providers ?? []);
325+
return settings ? applyProviderInstanceSettings(derived, settings, null) : derived;
326+
};
324327
const displayName = useAtomValue(
325328
providersAtom,
326329
(providers) =>

0 commit comments

Comments
 (0)