Real-time monitoring dashboard for Proxmox VE, PBS, Docker, Kubernetes, TrueNAS and vSphere. Self-hosted, with alerts for failed backups, full disks, unhealthy containers and offline nodes.
Go aialertsdashboarddockerdocker-monitoringgohomelabinfrastructure-monitoringkubernetesmonitoringmspproxmoxproxmox-backup-serverproxmox-mail-gatewayproxmox-veself-hostedtruenastypescriptvspherewebhooks
End the current realtime owner during sign-out cleanup
pulse-triage[bot]46e3943d6fdf
diff --git a/docs/release-control/v6/internal/subsystems/cloud-paid.md b/docs/release-control/v6/internal/subsystems/cloud-paid.mdindex aed6427e9f..3b6d871a70 100644--- a/docs/release-control/v6/internal/subsystems/cloud-paid.md+++ b/docs/release-control/v6/internal/subsystems/cloud-paid.md@@ -3940,7 +3940,11 @@ starts a targeted Patrol run instead of opening a chat.The existing app runtime sends a single bounded, cookie/CSRF-bearing POST to`/api/logout` before clearing saved authentication and cached metadata, stopping-its runtime and following any configured proxy/SSO destination. It requires the+its runtime and following any configured proxy/SSO destination. The canonical+global WebSocket shutdown ends this tab's current connection/request owner+even if storage cleanup fails or provider navigation never occurs; clearing+the local accessor alone is not teardown. Auth-clear and shutdown errors still+allow the remaining cleanup and leave an explicit close-tab warning. It requires theendpoint's successful JSON acknowledgement; rejection, a redirect, malformedreply, lost response or timeout stays visibly uncertain and allows deliberateretry. The API client must not turn a logout 401 into a success-looking logindiff --git a/docs/release-control/v6/internal/subsystems/performance-and-scalability.md b/docs/release-control/v6/internal/subsystems/performance-and-scalability.mdindex 5a737eee34..2525e101b8 100644--- a/docs/release-control/v6/internal/subsystems/performance-and-scalability.md+++ b/docs/release-control/v6/internal/subsystems/performance-and-scalability.md@@ -4659,7 +4659,11 @@ composition access, not the reporter's missing native ARC or I/O/History source.The existing app runtime sends a single bounded, cookie/CSRF-bearing POST to`/api/logout` before clearing saved authentication and cached metadata, stopping-its runtime and following any configured proxy/SSO destination. It requires the+its runtime and following any configured proxy/SSO destination. The canonical+global WebSocket shutdown ends this tab's current connection/request owner+even if storage cleanup fails or provider navigation never occurs; clearing+the local accessor alone is not teardown. Auth-clear and shutdown errors still+allow the remaining cleanup and leave an explicit close-tab warning. It requires theendpoint's successful JSON acknowledgement; rejection, a redirect, malformedreply, lost response or timeout stays visibly uncertain and allows deliberateretry. The API client must not turn a logout 401 into a success-looking logindiff --git a/frontend-modern/src/__tests__/useAppRuntimeState.test.ts b/frontend-modern/src/__tests__/useAppRuntimeState.test.tsindex 2ab7fd5c62..7f44539562 100644--- a/frontend-modern/src/__tests__/useAppRuntimeState.test.ts+++ b/frontend-modern/src/__tests__/useAppRuntimeState.test.ts@@ -66,6 +66,7 @@ describe('useAppRuntimeState', () => {let hasStoredAuthSessionMock: ReturnType<typeof vi.fn>;let setOrgIDMock: ReturnType<typeof vi.fn>;let clearAuthMock: ReturnType<typeof vi.fn>;+ let shutdownGlobalWebSocketStoreMock: ReturnType<typeof vi.fn>;let showToastMock: ReturnType<typeof vi.fn>;let aiAvailabilitySetEnabledMock: ReturnType<typeof vi.fn>;let aiAvailabilityRefreshMock: ReturnType<typeof vi.fn>;@@ -148,6 +149,7 @@ describe('useAppRuntimeState', () => {window.sessionStorage.removeItem('pulse_auth_user');window.localStorage.removeItem('org_id');});+ shutdownGlobalWebSocketStoreMock = vi.fn();showToastMock = vi.fn();aiAvailabilitySetEnabledMock = vi.fn();aiAvailabilityRefreshMock = vi.fn().mockResolvedValue(undefined);@@ -164,6 +166,7 @@ describe('useAppRuntimeState', () => {onStoreAcquired = undefined;vi.doMock('@/stores/websocket-global', () => ({+ shutdownGlobalWebSocketStore: shutdownGlobalWebSocketStoreMock,getGlobalWebSocketStore: () => {const store = {state: websocketState,@@ -792,6 +795,7 @@ describe('useAppRuntimeState', () => {await waitFor(() => expect(finish).toBeDefined());expect(hookState.isLoggingOut()).toBe(true);expect(clearAuthMock).not.toHaveBeenCalled();+ expect(shutdownGlobalWebSocketStoreMock).not.toHaveBeenCalled();expect(localStorage.getItem('auth')).toBe('synthetic-cache');expect(window.location.hash).toBe('');await hookState.handleLogout();@@ -809,6 +813,7 @@ describe('useAppRuntimeState', () => {finish(new Response('{"success":true}', { status: 200 }));await pending;expect(clearAuthMock).toHaveBeenCalledOnce();+ expect(shutdownGlobalWebSocketStoreMock).toHaveBeenCalledOnce();for (const key of ['auth', 'guest_metadata', 'docker_metadata', 'docker_metadata_hosts']) {expect(localStorage.getItem(key)).toBeNull();}@@ -851,6 +856,7 @@ describe('useAppRuntimeState', () => {expect(hookState.isLoggingOut()).toBe(false);expect(hookState.needsAuth()).toBe(false);expect(clearAuthMock).not.toHaveBeenCalled();+ expect(shutdownGlobalWebSocketStoreMock).not.toHaveBeenCalled();expect(sessionStorage.getItem('auth')).toBe('saved-browser-credential');expect(localStorage.getItem('just_logged_out')).toBeNull();expect(window.location.hash).toBe('');@@ -862,6 +868,7 @@ describe('useAppRuntimeState', () => {await hookState.handleLogout();expect(attempts).toBe(2);expect(clearAuthMock).toHaveBeenCalledOnce();+ expect(shutdownGlobalWebSocketStoreMock).toHaveBeenCalledOnce();expect(window.location.hash).toBe('#proxy-logout');},);@@ -882,6 +889,7 @@ describe('useAppRuntimeState', () => {await vi.advanceTimersByTimeAsync(15_000);await pending;expect(clearAuthMock).not.toHaveBeenCalled();+ expect(shutdownGlobalWebSocketStoreMock).not.toHaveBeenCalled();expect(hookState.isLoggingOut()).toBe(false);expect(window.location.hash).toBe('');expect(showToastMock).toHaveBeenCalledWith(@@ -909,6 +917,7 @@ describe('useAppRuntimeState', () => {finish(new Response('{"success":true}'));await pending;expect(clearAuthMock).not.toHaveBeenCalled();+ expect(shutdownGlobalWebSocketStoreMock).not.toHaveBeenCalled();expect(showToastMock).not.toHaveBeenCalled();expect(window.location.hash).toBe('');});@@ -928,6 +937,7 @@ describe('useAppRuntimeState', () => {);await hookState.handleLogout();expect(clearAuthMock).toHaveBeenCalledOnce();+ expect(shutdownGlobalWebSocketStoreMock).toHaveBeenCalledOnce();expect(localStorage.getItem('docker_metadata')).toBeNull();expect(hookState.needsAuth()).toBe(true);expect(hookState.enhancedStore()).toBeNull();@@ -939,6 +949,32 @@ describe('useAppRuntimeState', () => {);});+ it.each(['auth', 'socket'])('logout keeps %s cleanup failure explicit', async (failure) => {+ const { hookState } = await mountLogout();+ sessionStorage.setItem('auth', 'synthetic-browser-credential');+ const fail = () => {+ throw new Error('Synthetic cleanup failure');+ };+ if (failure === 'auth') clearAuthMock.mockImplementation(fail);+ else shutdownGlobalWebSocketStoreMock.mockImplementation(fail);+ const fallback = apiFetchMock.getMockImplementation()!;+ apiFetchMock.mockImplementation(async (url: string) =>+ url === '/api/logout' ? new Response('{"success":true}') : fallback(url),+ );+ await hookState.handleLogout();+ expect(clearAuthMock).toHaveBeenCalledOnce();+ expect(shutdownGlobalWebSocketStoreMock).toHaveBeenCalledOnce();+ expect(sessionStorage.getItem('auth')).toBeNull();+ expect(hookState.enhancedStore()).toBeNull();+ expect(hookState.needsAuth()).toBe(true);+ expect(window.location.hash).toBe('');+ expect(showToastMock).toHaveBeenCalledWith(+ 'error',+ 'Browser cleanup incomplete',+ expect.stringContaining('could not finish browser cleanup'),+ );+ });+it('does not start the proxy-auth runtime when protected state rejects the session', async () => {apiFetchMock.mockImplementation(async (url: string) => {if (url === '/api/state/summary') {diff --git a/frontend-modern/src/useAppRuntimeState.ts b/frontend-modern/src/useAppRuntimeState.tsindex eb76c34048..6637b61aca 100644--- a/frontend-modern/src/useAppRuntimeState.ts+++ b/frontend-modern/src/useAppRuntimeState.ts@@ -7,7 +7,7 @@ import {onMount,runWithOwner,} from 'solid-js';-import { getGlobalWebSocketStore } from '@/stores/websocket-global';+import { getGlobalWebSocketStore, shutdownGlobalWebSocketStore } from '@/stores/websocket-global';import { logger } from '@/utils/logger';import { apiFetchJSON } from '@/utils/apiClient';import {@@ -856,7 +856,6 @@ export const useAppRuntimeState = () => {throw new Error('Pulse did not acknowledge sign-out');}controller.signal.throwIfAborted();- clearAuth();// One blocked storage operation must not prevent the remaining cleanup.let cleanupFailed = false;@@ -867,6 +866,7 @@ export const useAppRuntimeState = () => {cleanupFailed = true;}};+ clean(clearAuth);for (const key of [STORAGE_KEYS.AUTH,STORAGE_KEYS.GUEST_METADATA,@@ -879,6 +879,7 @@ export const useAppRuntimeState = () => {clean(() => sessionStorage.setItem(SESSION_STORAGE_KEYS.DEMO_AUTO_LOGIN, 'suppressed'));clean(() => localStorage.setItem('just_logged_out', 'true'));aiAvailabilityStore.setEnabled(false);+ clean(shutdownGlobalWebSocketStore);setWsStore(null);setNeedsAuth(true);@@ -886,7 +887,7 @@ export const useAppRuntimeState = () => {showToast('error','Browser cleanup incomplete',- 'Pulse ended this session, but could not clear saved browser data. Close this tab. Your proxy or identity-provider session may still be active.',+ 'Pulse ended this session, but could not finish browser cleanup. Close this tab. Your proxy or identity-provider session may still be active.',);return;}