Skip to content

Evenfire is an intelligence layer platform for running LLM agents that take real actions, on your infrastructure

TypeScript

fix(desktop-ui): preserve logout recovery error status (R13-L17)

Josué06f92b32a670
diff --git a/desktop-app/ui/src/hooks/domain/__tests__/desktopEnvironmentHandoff.test.ts b/desktop-app/ui/src/hooks/domain/__tests__/desktopEnvironmentHandoff.test.ts
index 31c8aed6b..674808ba2 100644
--- a/desktop-app/ui/src/hooks/domain/__tests__/desktopEnvironmentHandoff.test.ts
+++ b/desktop-app/ui/src/hooks/domain/__tests__/desktopEnvironmentHandoff.test.ts
@@ -339,6 +339,34 @@ describe('Desktop environment handoff concurrency', () => {
expect(setPendingDesktopEnvironmentSetup).toHaveBeenCalledWith(null)
})
+ it('keeps a session reload error visible when handoff logout did not commit', async () => {
+ const onSessionNeedsLoad = vi.fn(async () => {
+ throw new Error('session read unavailable')
+ })
+ const { handler, setStatus } = createHandler(
+ () => ({
+ booting: false,
+ busy: false,
+ authTransitioning: false,
+ isAuthenticated: true,
+ }),
+ undefined,
+ vi.fn(async () => null),
+ onSessionNeedsLoad
+ )
+
+ await handler({
+ ...targetEnvironment,
+ externalRestApiBaseUrl: `${targetEnvironment.externalRestApiBaseUrl}/api/v1`,
+ })
+
+ expect(onSessionNeedsLoad).toHaveBeenCalledWith({ preserveNav: true })
+ expect(setStatus).toHaveBeenLastCalledWith(
+ 'Could not reload the current desktop session: session read unavailable',
+ 'error'
+ )
+ })
+
it.each([
{
targetKind: 'saved target',
diff --git a/desktop-app/ui/src/hooks/domain/desktopEnvironmentHandoff.ts b/desktop-app/ui/src/hooks/domain/desktopEnvironmentHandoff.ts
index e0aa2a5fb..85284e151 100644
--- a/desktop-app/ui/src/hooks/domain/desktopEnvironmentHandoff.ts
+++ b/desktop-app/ui/src/hooks/domain/desktopEnvironmentHandoff.ts
@@ -275,10 +275,14 @@ export function createDesktopEnvironmentSetupHandler({
`Could not reload the current desktop session: ${error instanceof Error ? error.message : String(error)}`,
'error'
)
+ return
}
+ authState = getAuthState()
}
- if (authState.isAuthenticated || isAuthenticationOperationInProgress(authState)) {
+ if (isAuthenticationOperationInProgress(authState)) {
reportAuthenticationStateChanged(authState, setStatus)
+ } else if (authState.isAuthenticated) {
+ setStatus('Could not sign out before switching desktop environments.', 'error')
} else {
setStatus('Could not confirm sign out before switching desktop environments.', 'error')
}