Skip to content

Commit aebac9a

Browse files
fix(web): subagent badges count project-enabled sibling accounts
Co-Authored-By: Claude Opus 5.5 <[email protected]>
1 parent b5edddf commit aebac9a

1 file changed

Lines changed: 17 additions & 7 deletions

File tree

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

Lines changed: 17 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,7 @@ import {
4848
import { Tooltip, TooltipTrigger, TooltipPopup } from "../ui/tooltip";
4949
import {
5050
applyProviderInstanceSettings,
51+
deriveProviderEntriesByEnvironment,
5152
deriveProviderInstanceEntries,
5253
shouldShowInstanceBadge,
5354
type ProviderInstanceEntry,
@@ -255,16 +256,21 @@ function SubagentAvatar({
255256
);
256257
}
257258

258-
// Same entries and badge rule as the handoff row.
259+
// Same entries and badge rule as the sidebar row.
259260
function subagentProviderBadge(
261+
environmentId: EnvironmentId,
260262
providers: ReadonlyArray<ServerProvider> | null | undefined,
261263
settings: ServerSettings | null,
262264
instanceId: ProviderInstanceId,
263265
) {
264-
const derived = deriveProviderInstanceEntries(providers ?? EMPTY_SERVER_PROVIDERS);
265-
const entries = settings ? applyProviderInstanceSettings(derived, settings, null) : derived;
266-
const entry = entries.find((candidate) => candidate.instanceId === instanceId);
267-
return entry !== undefined && shouldShowInstanceBadge(entry, entries) ? entry : undefined;
266+
const scoped = providers ?? EMPTY_SERVER_PROVIDERS;
267+
const entries = deriveProviderEntriesByEnvironment([
268+
settings ? [environmentId, scoped, settings] : [environmentId, scoped],
269+
]).get(environmentId);
270+
const entry = entries?.get(instanceId);
271+
return entry !== undefined && shouldShowInstanceBadge(entry, entries?.values() ?? [])
272+
? entry
273+
: undefined;
268274
}
269275

270276
// Select primitives; status pushes replace providers even when avatar fields are unchanged.
@@ -303,11 +309,15 @@ export function EnvironmentSubagentAvatar({
303309
);
304310
const badgeLabel = useAtomValue(
305311
providersAtom,
306-
(providers) => subagentProviderBadge(providers, settings, providerInstanceId)?.displayName,
312+
(providers) =>
313+
subagentProviderBadge(providerEnvironmentId, providers, settings, providerInstanceId)
314+
?.displayName,
307315
);
308316
const accentColor = useAtomValue(
309317
providersAtom,
310-
(providers) => subagentProviderBadge(providers, settings, providerInstanceId)?.accentColor,
318+
(providers) =>
319+
subagentProviderBadge(providerEnvironmentId, providers, settings, providerInstanceId)
320+
?.accentColor,
311321
);
312322
return (
313323
<SubagentAvatar

0 commit comments

Comments
 (0)