Skip to content

The agent that grows with you

fix(desktop): null-guard the rotation signal fired from ensureSessionState

Brooklyn Nicholsonc74f48b62e70
diff --git a/apps/desktop/src/app/session/hooks/use-session-state-cache.ts b/apps/desktop/src/app/session/hooks/use-session-state-cache.ts
index 952c90be799..04fe08513e5 100644
--- a/apps/desktop/src/app/session/hooks/use-session-state-cache.ts
+++ b/apps/desktop/src/app/session/hooks/use-session-state-cache.ts
@@ -118,7 +118,9 @@ export function useSessionStateCache({
if (existing.storedSessionId && existing.storedSessionId !== storedSessionId) {
runtimeIdByStoredSessionIdRef.current.delete(existing.storedSessionId)
- if (sessionId === $activeSessionId.get()) {
+ // A rotation event needs a real next id — a null/cleared stored id
+ // is a detach, not a rotation the route-follow effect should chase.
+ if (storedSessionId && sessionId === $activeSessionId.get()) {
setActiveSessionStoredIdRotation({
nextStoredSessionId: storedSessionId,
previousStoredSessionId: existing.storedSessionId,