The fastest, cheapest, most efficient open-source agent harness. Run more than 500 agents on a $10 VPS.
Rust agent-orchestrationai-agentsai-assistantdesktopllmlocal-firstmcppersonal-aiprivacyrustsecond-braintauri
fix: re-dispatch bootstrap-replay through guarded runReauth path\n\nCalling clearSession() directly in the bootstrap-replay useEffect bypasses\nthe isLocalSession and suppressReauthUntilRef guards in runReauth(). If an\nOAuth callback installs a new session during bootstrap the stale queued\nevent would destructively log out that valid session.\n\nDispatch openhuman:session-expired instead — onSocketExpired routes it\nthrough runReauth('confirmed') where all guards apply, identical to a live\nsocket push.\n\nAlso strengthens the tauriLogout-throws test: assert one new\nfetchCoreAppSnapshot call after the expiry event to verify refresh() is\nactually invoked (the previous assertion only checked commitState fired first).\n\nAddresses CodeRabbit review on PR #5968.\n
shanue792fa4d0dea
diff --git a/app/src/providers/CoreStateProvider.tsx b/app/src/providers/CoreStateProvider.tsxindex 228b5cde88..c644729ca0 100644--- a/app/src/providers/CoreStateProvider.tsx+++ b/app/src/providers/CoreStateProvider.tsx@@ -773,15 +773,24 @@ export default function CoreStateProvider({ children }: { children: ReactNode })// bootstrapping, runReauth() sets pendingConfirmedReauthRef instead of// dropping it. Once isBootstrapping flips to false (first successful// snapshot) this effect replays it so the router reaches the login screen.+ //+ // We re-dispatch through openhuman:session-expired (rather than calling+ // clearSession() directly) so the guarded runReauth() path applies: the+ // isLocalSession check and suppressReauthUntilRef window are both+ // re-evaluated against the now-current session state. Without this a+ // session installed by an OAuth callback *during* bootstrap would be+ // destructively logged out by the stale queued event.useEffect(() => {if (!state.isBootstrapping && pendingConfirmedReauthRef.current) {pendingConfirmedReauthRef.current = false;log('auth-expired: replaying confirmed reauth suppressed during bootstrap');- void clearSession().catch(err => {- log('clearSession failed after post-bootstrap replay: %O', sanitizeError(err));- });+ window.dispatchEvent(+ new CustomEvent('openhuman:session-expired', {+ detail: { source: 'bootstrap-replay' },+ })+ );}- }, [state.isBootstrapping, clearSession]);+ }, [state.isBootstrapping]);// Listen for two flavours of session expiry, both routed through the// same debounced `clearSession`:diff --git a/app/src/providers/__tests__/CoreStateProvider.test.tsx b/app/src/providers/__tests__/CoreStateProvider.test.tsxindex ae6308e848..e97492cc76 100644--- a/app/src/providers/__tests__/CoreStateProvider.test.tsx+++ b/app/src/providers/__tests__/CoreStateProvider.test.tsx@@ -985,6 +985,7 @@ describe('session expiry fixes (#5868)', () => {</CoreStateProvider>);await waitFor(() => expect(screen.getByTestId('ready').textContent).toBe('ready'));+ vi.mocked(coreStateApi.fetchCoreAppSnapshot).mockClear();// Trigger a confirmed session-expiry via the socket path.await act(async () => {@@ -993,8 +994,11 @@ describe('session expiry fixes (#5868)', () => {);});- // Even though logout threw, refresh must still have fired and the snapshot- // should now show signed-out state.+ // Even though logout threw, refresh must still have fired (one new snapshot+ // fetch) and the snapshot should now show signed-out state.+ await waitFor(() =>+ expect(vi.mocked(coreStateApi.fetchCoreAppSnapshot)).toHaveBeenCalledTimes(1)+ );await waitFor(() => expect(screen.getByTestId('token').textContent).toBe('none'));});