Skip to content

The agent that grows with you

fix(desktop): status bar names the profile when another profile's messaging is down

Teknium9f050ccc82f8
diff --git a/apps/desktop/src/lib/gateway-health-pill.test.ts b/apps/desktop/src/lib/gateway-health-pill.test.ts
index a21bd494f8c..7d9cf5bcff2 100644
--- a/apps/desktop/src/lib/gateway-health-pill.test.ts
+++ b/apps/desktop/src/lib/gateway-health-pill.test.ts
@@ -66,4 +66,15 @@ describe('statusBarGatewayHealth', () => {
expect(discordDown.detail).toBe(copy.messagingDegraded('discord'))
expect(discordDown.degraded).toBe(true)
})
+
+ it("names the owning profile when another profile's platform is the one down", () => {
+ const pill = statusBarGatewayHealth({
+ ...openReady,
+ messagingRunning: true,
+ messagingState: 'running',
+ platforms: { telegram: { state: 'connected' }, 'workhorse:whatsapp': { state: 'fatal' } }
+ })
+
+ expect(pill.detail).toBe(copy.messagingDegraded('workhorse:whatsapp'))
+ })
})
diff --git a/apps/desktop/src/lib/gateway-health-pill.ts b/apps/desktop/src/lib/gateway-health-pill.ts
index 860313f69f4..e2af81bdc58 100644
--- a/apps/desktop/src/lib/gateway-health-pill.ts
+++ b/apps/desktop/src/lib/gateway-health-pill.ts
@@ -43,12 +43,8 @@ export interface GatewayHealthPill {
const HEALTHY_PLATFORM_STATES = new Set(['connected'])
const IGNORED_PLATFORM_STATES = new Set(['disabled', 'not_configured', 'not configured'])
-function platformLeaf(id: string): string {
- const sep = id.lastIndexOf(':')
-
- return sep >= 0 ? id.slice(sep + 1) : id
-}
-
+// Keep the "profile:" prefix a multiplexed gateway puts on secondary profiles'
+// platforms: "whatsapp down" read as the user's own WhatsApp when it was another profile's.
function unhealthyPlatformNames(platforms: GatewayHealthPillInput['platforms']): string[] {
return Object.entries(platforms || {})
.filter(([, platform]) => {
@@ -56,7 +52,7 @@ function unhealthyPlatformNames(platforms: GatewayHealthPillInput['platforms']):
return Boolean(state) && !HEALTHY_PLATFORM_STATES.has(state) && !IGNORED_PLATFORM_STATES.has(state)
})
- .map(([id]) => platformLeaf(id))
+ .map(([id]) => id)
}
function messagingWasConfigured(