Self-hosted, Self-Improving, Federated Everything App — dev management, agent orchestration, persistent mind, digital twin, second brain, and creative pipeline from a single dashboard over Tailscale to port the user into the OS
JavaScript ai-agentsdashboarddeveloper-toolsdigital-twinquantified-selfsecond-brainself-hostedtailscale
scope the PortOS restart watch to surfaces that can see the update
[._.]/ Adam Eivy06812d07da83
diff --git a/client/src/hooks/useAppOperation.js b/client/src/hooks/useAppOperation.jsindex dcdf6e683e..b51a980a02 100644--- a/client/src/hooks/useAppOperation.js+++ b/client/src/hooks/useAppOperation.js@@ -115,8 +115,11 @@ export function useAppOperation({ onComplete, appId: scopeAppId } = {}) {const onStep = (data) => {// The last frame that can reach us from a PortOS self-update: the script's- // own `pm2 delete` kills this server moments later.- if (data?.appId === PORTOS_APP_ID && data.status !== 'error'+ // own `pm2 delete` kills this server moments later. Gated on `watchable`+ // for the same reason the subscriptions are — `app:update:step` is a+ // broadcast, so without it a surface scoped to some OTHER app would arm+ // the watch (and reload the page) off a PortOS update it has no part in.+ if (watchable && data?.appId === PORTOS_APP_ID && data.status !== 'error'&& (data.step === 'restart' || data.step === 'restarting')) arm();patch(data, current => ({ ...current, steps: mergeStep(current.steps, data) }));};@@ -178,7 +181,7 @@ export function useAppOperation({ onComplete, appId: scopeAppId } = {}) {socket.off('app:standardize:complete', onDone);socket.off('connect', requestActive);};- }, [arm, scopeAppId, drop]);+ }, [arm, watchable, scopeAppId, drop]);const start = useCallback((type, appId, appName, options = {}) => {clearTimeout(clearTimersRef.current[appId]);diff --git a/client/src/hooks/useAppOperation.test.jsx b/client/src/hooks/useAppOperation.test.jsxindex a05525a495..b683cd3cd2 100644--- a/client/src/hooks/useAppOperation.test.jsx+++ b/client/src/hooks/useAppOperation.test.jsx@@ -96,6 +96,22 @@ describe('useAppOperation — PortOS self-update handoff', () => {expect(socketHandlers.has('portos:update:step')).toBe(false);});+ it('ignores a PortOS restart frame on a surface scoped to another app', () => {+ // `app:update:step` is a BROADCAST, so a PortOS update running elsewhere+ // still reaches this surface's step handler. Arming off it would reload a+ // page that is watching an entirely different app's update.+ const { result } = renderHook(() => useAppOperation({ appId: 'example-managed-app' }));++ act(() => {+ socketHandlers.get('app:update:step')({+ appId: PORTOS_APP_ID, step: 'restart', status: 'running', message: 'Starting PortOS...',+ });+ });++ expect(result.current.restarting).toBe(false);+ expect(mockToast.loading).not.toHaveBeenCalled();+ });+it('does not seed a baseline for a non-PortOS update', () => {const { result } = renderHook(() => useAppOperation({ appId: 'example-managed-app' }));