From 2579ea7574a7b41fed2ceeb0082eb628278df03a Mon Sep 17 00:00:00 2001 From: Dante Date: Thu, 8 Oct 2026 18:22:28 +0000 Subject: [PATCH] FE-3267 fix(auth): stop repeating a Desktop account's email as its name (#20536) ## Summary In Desktop local, the account menu for a Desktop-signed-in (SSO) user showed the email twice: once as the name and once as the email line. Follow-up to #20383 (FE-3267). **Why:** the menu reads as broken, and the agent panel and Settings > User showed the email where a name belongs. **Root cause:** a Desktop host session carries no display name (the OAuth claims have `email` but no name). `useCurrentUser().userDisplayName` fell back to the email for host users, and the menu then rendered both `userDisplayName` and `userEmail`. **How:** for a host user, `userDisplayName` is now unset, as for a Firebase account without a display name. The menu shows the generic "User" title over the email, Settings > User shows "Not set", and the agent panel greets without a name. `userEmail` is unchanged. ## Verification - New `useCurrentUser` case (host account: email set, name unset) fails on `main` and passes here. The suite has 15 tests. - Manual check in Desktop local against testcloud as `ssotest1@example.com`. Screenshots below. ### AS IS The Desktop SSO account's menu repeats the email as the name. ### TO BE Same account with this build: the email shows once, under the generic "User" title. --- src/composables/auth/useCurrentUser.test.ts | 20 ++++++++++++++++++++ src/composables/auth/useCurrentUser.ts | 2 +- 2 files changed, 21 insertions(+), 1 deletion(-) diff --git a/src/composables/auth/useCurrentUser.test.ts b/src/composables/auth/useCurrentUser.test.ts index b9f0f1c4bc8..12cfbdd6dd5 100644 --- a/src/composables/auth/useCurrentUser.test.ts +++ b/src/composables/auth/useCurrentUser.test.ts @@ -80,6 +80,26 @@ describe('useCurrentUser', () => { expect(resolvedUserInfo.value).toEqual({ id: 'host-user' }) }) + it('shows a Desktop host account by its email, without repeating it as the name', async () => { + const signedIn = { + status: 'signed_in', + userId: 'host-user', + email: 'sso@example.com' + } as const + await startDesktopHostSession({ + getState: async () => signedIn, + getWorkspaceToken: async () => 'host-token', + requestSignIn: async () => signedIn, + signOut: async () => ({ status: 'signed_out' }), + onChanged: () => () => {} + }) + + const { userDisplayName, userEmail } = useCurrentUser() + + expect(userEmail.value).toBe('sso@example.com') + expect(userDisplayName.value).toBeUndefined() + }) + it('reads a Firebase-only login entirely from Firebase', () => { mockAuthState.currentUser = fromPartial< NonNullable diff --git a/src/composables/auth/useCurrentUser.ts b/src/composables/auth/useCurrentUser.ts index 4f9a138d540..542a658932d 100644 --- a/src/composables/auth/useCurrentUser.ts +++ b/src/composables/auth/useCurrentUser.ts @@ -57,7 +57,7 @@ export const useCurrentUser = () => { } const userDisplayName = computed(() => { - if (desktopHostUser.value) return desktopHostUser.value.email + if (desktopHostUser.value) return undefined if (isApiKeyLogin.value) { return apiKeyStore.currentUser?.name }