Skip to content

Commit 05b815c

Browse files
fix(clients): retain badges for disabled historical accounts
1 parent da53161 commit 05b815c

2 files changed

Lines changed: 7 additions & 4 deletions

File tree

‎packages/client-runtime/src/state/providerInstanceDisplay.test.ts‎

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -129,12 +129,14 @@ describe("shouldShowInstanceBadge", () => {
129129
expect(shouldShowInstanceBadge(first, [first, second])).toBe(true);
130130
});
131131

132-
it("only badges the disabled instance when an enabled sibling remains", () => {
132+
it("ignores disabled siblings for enabled instances while distinguishing historical owners", () => {
133133
const enabled = { driverKind: codex, enabled: true };
134134
const disabled = { driverKind: codex, enabled: false };
135135

136136
expect(shouldShowInstanceBadge(enabled, [enabled, disabled])).toBe(false);
137137
expect(shouldShowInstanceBadge(disabled, [enabled, disabled])).toBe(true);
138+
expect(shouldShowInstanceBadge(disabled, [disabled, { ...disabled }])).toBe(true);
139+
expect(shouldShowInstanceBadge(disabled, [disabled])).toBe(false);
138140
});
139141

140142
it("hides the badge for a single instance of a driver with no accent", () => {

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

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -56,10 +56,11 @@ export function shouldShowInstanceBadge(
5656
}>,
5757
): boolean {
5858
if (entry.accentColor) return true;
59-
// Count a historical thread's disabled owner, but only enabled siblings.
60-
let sharedProviderCount = entry.enabled ? 0 : 1;
59+
let sharedProviderCount = 0;
6160
for (const candidate of entries) {
62-
if (!candidate.enabled || candidate.driverKind !== entry.driverKind) continue;
61+
if (candidate.driverKind !== entry.driverKind) continue;
62+
// Historical threads still need to distinguish accounts that are all disabled.
63+
if (entry.enabled && !candidate.enabled) continue;
6364
if (
6465
entry.driverKind === "acpRegistry" &&
6566
candidate.acpRegistryAgentId !== entry.acpRegistryAgentId

0 commit comments

Comments
 (0)