Skip to content

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

fix: render update/out-of-sync advisories as inline banners instead of permanent toasts (#3786)

[._.]/ Adam Eivy3892b173549a
diff --git a/.changelog/NEXT.md b/.changelog/NEXT.md
index 3a70080b73..05fee6bf6c 100644
--- a/.changelog/NEXT.md
+++ b/.changelog/NEXT.md
@@ -65,3 +65,4 @@
- **Insights overview cards now carry the step they describe instead of naming a control that isn't on the screen.** The Overview tab's three cards were all prose: the Cross-Domain card said "Click Refresh to analyze patterns across all your data" on a screen whose only controls were the tabs themselves, and the Genome and Taste cards described a prerequisite ("Complete taste profile") without offering it anywhere. Each empty card now ends in a button that does the thing — Upload genome (to the genome screen), Complete taste profile (deep-linked to the Digital Twin taste tab) or Generate themes when the profile is already done, and Analyze now, which generates the cross-domain narrative in place and swaps the card over to its first line. The empty copy states what the user gets rather than which button to hunt for, and the tab's own empty state dropped its "Click Refresh" phrasing for the same reason.
- **Settings → Backup now keeps Save and Run Backup Now in reach.** The tab handed most of its height to the built-in Default Exclusions catalog — 15+ rows of internal path patterns, each with a toggle and a paragraph of explanation — and put both commit actions below it, so the ordinary edit (destination, Enabled, schedule) meant scrolling past a wall of infrastructure toggles to find the button, with nothing on screen saying the change was still unsaved. The exclusions catalog is now collapsed behind a disclosure that summarizes it ("Default exclusions — N paths skipped", plus a count of any you re-included), and Save/Run Backup Now sit in a sticky bar pinned to the bottom of the tab carrying an "Unsaved changes"/"Saving…" hint. The Enabled toggle and the cron schedule also count as unsaved edits now: they ride the same save as the destination path, but only the destination fed the dirty check, so flipping the schedule and hitting Run Backup Now would silently run against the old saved value.
While collapsing that catalog, one more thing surfaced: an overridable default's switch reported the *effective* rsync outcome rather than the user's own override, so a re-included path that a custom exclude pattern still shadowed rendered as switched off — and clicking it dropped the override while appearing to do nothing. The switch now reports the override, and the existing "(still excluded via Additional Exclude Paths)" note keeps carrying the effective state.
+- **The "install out of sync" and "update available" notices no longer sit on top of the screen you're using.** Both were raised as permanent corner toasts, and on a phone the card landed squarely on the bottom of the viewport — covering the Ask composer and its Send button, the Add Peer form on Instances, and the process list on System Health. Since neither notice ever times out, that was the resting state of the app after any `git pull`: you had to find the small Dismiss link before the screen worked again, and the toast came back on the next poll. They are now inline banners in the app chrome, directly under the header and in normal document flow, so they push the page down instead of covering it, and dismissing the out-of-sync notice sticks for the commit you dismissed it on — a later pull raises it again.
diff --git a/client/src/components/Layout.jsx b/client/src/components/Layout.jsx
index 3a8ce70d82..0d907259bb 100644
--- a/client/src/components/Layout.jsx
+++ b/client/src/components/Layout.jsx
@@ -109,7 +109,7 @@ import { useNotifications } from '../hooks/useNotifications';
import { useAgentFeedbackToast } from '../hooks/useAgentFeedbackToast';
import { useOnDemandTaskToast } from '../hooks/useOnDemandTaskToast';
import { useSharingNotifications } from '../hooks/useSharingNotifications';
-import { useUpdateChecker } from '../hooks/useUpdateChecker';
+import UpdateBanners from './UpdateBanners';
import { useAIStatusNotifications } from '../hooks/useAIStatusNotifications';
import { useNavWorkingSet } from '../hooks/useNavWorkingSet.js';
import { useSidebarApps } from '../hooks/useSidebarApps.js';
@@ -534,9 +534,6 @@ export default function Layout() {
// Live AI operation status (model loads, "calling LM Studio…", etc.)
useAIStatusNotifications();
- // Check for PortOS updates and show toast when available
- useUpdateChecker();
-
// Notifications for user task alerts
const {
notifications,
@@ -1196,6 +1193,10 @@ export default function Layout() {
</div>
</header>
+ {/* Update / out-of-sync advisories — inline (document flow) so they
+ push the page instead of covering a bottom-anchored composer (#3786) */}
+ <UpdateBanners />
+
{/* Main content */}
{(() => {
const isFullWidth = location.pathname === '/character' ||
diff --git a/client/src/components/Layout.test.jsx b/client/src/components/Layout.test.jsx
index 41f1d49bcb..e7c2b19020 100644
--- a/client/src/components/Layout.test.jsx
+++ b/client/src/components/Layout.test.jsx
@@ -20,7 +20,7 @@ vi.mock('../hooks/useErrorNotifications', () => ({ useErrorNotifications: () =>
vi.mock('../hooks/useSharingNotifications', () => ({ useSharingNotifications: () => {} }));
vi.mock('../hooks/useAgentFeedbackToast', () => ({ useAgentFeedbackToast: () => {} }));
vi.mock('../hooks/useAIStatusNotifications', () => ({ useAIStatusNotifications: () => {} }));
-vi.mock('../hooks/useUpdateChecker', () => ({ useUpdateChecker: () => {} }));
+vi.mock('./UpdateBanners', () => ({ default: () => null }));
vi.mock('../hooks/useNotifications', () => ({
useNotifications: () => ({
notifications: [],
diff --git a/client/src/components/UpdateBanners.jsx b/client/src/components/UpdateBanners.jsx
new file mode 100644
index 0000000000..c2296c4c52
--- /dev/null
+++ b/client/src/components/UpdateBanners.jsx
@@ -0,0 +1,78 @@
+import { AlertTriangle, RefreshCw } from 'lucide-react';
+import { useNavigate } from 'react-router';
+import Banner from './ui/Banner';
+import { useUpdateChecker } from '../hooks/useUpdateChecker';
+import * as api from '../services/api';
+
+// A non-transient advisory must never occlude the current screen's primary
+// action (#3786), so these render in normal document flow above <main> and
+// push the page down instead of floating over a bottom-anchored composer.
+export default function UpdateBanners() {
+ const navigate = useNavigate();
+ const { update, outOfSync, ignoreUpdate, dismissUpdate, dismissOutOfSync } = useUpdateChecker();
+
+ if (!update && !outOfSync) return null;
+
+ const goToUpdate = () => navigate(`/apps/${api.PORTOS_APP_ID}/update`);
+
+ return (
+ <div className="shrink-0 px-3 pt-2 flex flex-col gap-2 print:hidden">
+ {outOfSync ? (
+ <Banner
+ tone="warning"
+ icon={AlertTriangle}
+ align="center"
+ role="status"
+ actions={
+ <div className="flex gap-2">
+ <button
+ type="button"
+ onClick={goToUpdate}
+ className="px-2 py-1 bg-port-warning text-black text-xs rounded hover:bg-port-warning/80"
+ >
+ Reconcile
+ </button>
+ <button
+ type="button"
+ onClick={dismissOutOfSync}
+ className="px-2 py-1 bg-gray-600 text-white text-xs rounded hover:bg-gray-500"
+ >
+ Dismiss
+ </button>
+ </div>
+ }
+ >
+ Install out of sync — you pulled new code but haven’t reconciled it.
+ </Banner>
+ ) : null}
+ {update ? (
+ <Banner
+ tone="info"
+ icon={RefreshCw}
+ align="center"
+ role="status"
+ actions={
+ <div className="flex gap-2">
+ <button
+ type="button"
+ onClick={() => { dismissUpdate(); goToUpdate(); }}
+ className="px-2 py-1 bg-port-accent text-white text-xs rounded hover:bg-port-accent/80"
+ >
+ Update
+ </button>
+ <button
+ type="button"
+ onClick={ignoreUpdate}
+ className="px-2 py-1 bg-gray-600 text-white text-xs rounded hover:bg-gray-500"
+ >
+ Ignore
+ </button>
+ </div>
+ }
+ >
+ Update available: <strong>v{update.currentVersion}</strong> → <strong>v{update.latestVersion}</strong>
+ </Banner>
+ ) : null}
+ </div>
+ );
+}
diff --git a/client/src/components/UpdateBanners.test.jsx b/client/src/components/UpdateBanners.test.jsx
new file mode 100644
index 0000000000..e57804ac68
--- /dev/null
+++ b/client/src/components/UpdateBanners.test.jsx
@@ -0,0 +1,130 @@
+import { describe, it, expect, vi, beforeEach, afterEach } from 'vitest';
+import { render, screen, cleanup, act, fireEvent, waitFor } from '@testing-library/react';
+import { MemoryRouter } from 'react-router';
+
+// The regression this suite locks (#3786): the update / out-of-sync advisories
+// must render as INLINE banners in document flow, not as `duration: Infinity`
+// corner toasts that permanently occlude a bottom-anchored composer at 375px.
+
+const handlers = new Map();
+vi.mock('../services/socket', () => ({
+ default: {
+ on: (event, fn) => { handlers.set(event, fn); },
+ off: (event, fn) => { if (handlers.get(event) === fn) handlers.delete(event); },
+ },
+}));
+
+const getUpdateStatus = vi.fn();
+const ignoreUpdateVersion = vi.fn(() => Promise.resolve({}));
+vi.mock('../services/api', () => ({
+ PORTOS_APP_ID: 'portos-default',
+ getUpdateStatus: (...a) => getUpdateStatus(...a),
+ ignoreUpdateVersion: (...a) => ignoreUpdateVersion(...a),
+}));
+
+const navigate = vi.fn();
+vi.mock('react-router', async () => {
+ const actual = await vi.importActual('react-router');
+ return { ...actual, useNavigate: () => navigate };
+});
+
+// Toasts are the thing this component replaced — assert none are raised.
+const toastFn = vi.fn();
+vi.mock('./ui/Toast', () => ({ default: Object.assign((...a) => toastFn(...a), { dismiss: vi.fn() }) }));
+
+import UpdateBanners from './UpdateBanners';
+import { __internal } from '../hooks/useUpdateChecker';
+
+const renderBanners = () => render(<MemoryRouter><UpdateBanners /></MemoryRouter>);
+
+const flush = async () => { await act(async () => { await Promise.resolve(); }); };
+
+beforeEach(() => {
+ handlers.clear();
+ navigate.mockClear();
+ toastFn.mockClear();
+ ignoreUpdateVersion.mockClear();
+ getUpdateStatus.mockReset();
+ getUpdateStatus.mockResolvedValue({});
+ localStorage.clear();
+});
+
+afterEach(() => cleanup());
+
+describe('UpdateBanners', () => {
+ it('renders nothing when the install is current', async () => {
+ const { container } = renderBanners();
+ await flush();
+ expect(container).toBeEmptyDOMElement();
+ expect(toastFn).not.toHaveBeenCalled();
+ });
+
+ it('renders the out-of-sync advisory inline (no toast)', async () => {
+ getUpdateStatus.mockResolvedValue({
+ installState: { outOfSync: true, currentCommit: 'abc123' }
+ });
+ renderBanners();
+ await screen.findByText(/Install out of sync/);
+ expect(toastFn).not.toHaveBeenCalled();
+ // In document flow, not a fixed-position overlay.
+ expect(document.querySelector('.fixed')).toBeNull();
+ });
+
+ it('persists the out-of-sync dismissal per commit so it does not re-raise', async () => {
+ getUpdateStatus.mockResolvedValue({
+ installState: { outOfSync: true, currentCommit: 'abc123' }
+ });
+ renderBanners();
+ fireEvent.click(await screen.findByRole('button', { name: 'Dismiss' }));
+ await waitFor(() => expect(screen.queryByText(/Install out of sync/)).toBeNull());
+ expect(localStorage.getItem(__internal.OUT_OF_SYNC_DISMISS_KEY)).toBe('abc123');
+
+ cleanup();
+ renderBanners();
+ await flush();
+ expect(screen.queryByText(/Install out of sync/)).toBeNull();
+ });
+
+ it('re-raises out-of-sync after a later pull moves the commit', async () => {
+ localStorage.setItem(__internal.OUT_OF_SYNC_DISMISS_KEY, 'abc123');
+ getUpdateStatus.mockResolvedValue({
+ installState: { outOfSync: true, currentCommit: 'def456' }
+ });
+ renderBanners();
+ expect(await screen.findByText(/Install out of sync/)).toBeTruthy();
+ });
+
+ it('shows the update advisory and navigates to the update tab', async () => {
+ getUpdateStatus.mockResolvedValue({
+ updateAvailable: true,
+ currentVersion: '1.0.0',
+ latestRelease: { version: '1.1.0' }
+ });
+ renderBanners();
+ fireEvent.click(await screen.findByRole('button', { name: 'Update' }));
+ expect(navigate).toHaveBeenCalledWith('/apps/portos-default/update');
+ await waitFor(() => expect(screen.queryByText(/Update available/)).toBeNull());
+ });
+
+ it('Ignore records the version server-side exactly once', async () => {
+ getUpdateStatus.mockResolvedValue({
+ updateAvailable: true,
+ currentVersion: '1.0.0',
+ latestRelease: { version: '1.1.0' }
+ });
+ renderBanners();
+ fireEvent.click(await screen.findByRole('button', { name: 'Ignore' }));
+ expect(ignoreUpdateVersion).toHaveBeenCalledTimes(1);
+ expect(ignoreUpdateVersion).toHaveBeenCalledWith('1.1.0');
+ await waitFor(() => expect(screen.queryByText(/Update available/)).toBeNull());
+ });
+
+ it('raises the update advisory from a live socket event', async () => {
+ renderBanners();
+ await flush();
+ act(() => {
+ handlers.get('portos:update:available')?.({ currentVersion: '1.0.0', latestVersion: '1.2.0' });
+ });
+ expect(await screen.findByText(/v1.2.0/)).toBeTruthy();
+ });
+});
diff --git a/client/src/hooks/README.md b/client/src/hooks/README.md
index bd5d8c82c0..e52c39b63f 100644
--- a/client/src/hooks/README.md
+++ b/client/src/hooks/README.md
@@ -76,7 +76,7 @@ grep -i "what you want to do" client/src/hooks/README.md
|---|---|---|
| `useSocket` | Shared socket instance + connection status. | You need to subscribe to a socket event. |
| `useShellSession` | All Socket.IO `shell:*` session/terminal state + lifecycle for the Shell page: owns the xterm instance, the attach/detach/generation-guard contract (`pendingAttachRef {target,generation}`, `claim`, `userIdleRef`, `mountedRef`), URL sync, and every session action. Returns `{ terminalRef, connected, sessions, activeSessionId, activeSession, interactiveCount, liveRunCount, isLiveRun, emitShellInput, sendImage, sendCommand, sendCtrlB, sendCtrlC, sendNavKey, restartSession, stopSession, startNewSession, switchToSession, killOtherSession }` so the route stays presentational. `sendImage(file, message)` is the one operation that leaves the socket — it POSTs to `/api/shell/sessions/:id/image` so a running agent TUI gets the photo's path pasted into its prompt. | The Shell page (`pages/Shell.jsx`) — don't re-roll the single-subscriber PTY attach lifecycle. |
-| `useUpdateChecker` | Detect stale client bundle; show reload toast. | Wire once at app root. |
+| `useUpdateChecker` | Update-available + install-out-of-sync advisories as *state* (`{ update, outOfSync, ignoreUpdate, dismissUpdate, dismissOutOfSync }`), never toasts — a non-transient advisory must not occlude the screen's primary action (#3786). Out-of-sync dismissals persist per on-disk commit in `safeStorage`, so a later `git pull` re-raises. | Wire once at app root; render via `components/UpdateBanners`. |
| `useMounted` | `mountedRef` whose `.current` is true while mounted. | Async deferred work that must abort on unmount. |
| `usePrevious` | Returns the value from the previous render — snapshot updated in a `useEffect`. | Compare-and-act on prop/state change from inside a `useEffect`. |
| `usePreviousSync` | Same shape, but snapshot updated *during* render. | The prior value gates an in-render `setState` (React's "adjusting state on prop change" pattern); the during-render update avoids an extra discard/rerun cycle. |
diff --git a/client/src/hooks/useUpdateChecker.jsx b/client/src/hooks/useUpdateChecker.jsx
index dc1b1a31cb..6d3e9f96f7 100644
--- a/client/src/hooks/useUpdateChecker.jsx
+++ b/client/src/hooks/useUpdateChecker.jsx
@@ -1,117 +1,77 @@
-import { useEffect, useRef } from 'react';
-import { useNavigate } from 'react-router';
-import toast from '../components/ui/Toast';
+import { useCallback, useEffect, useState } from 'react';
+import { safeReadStorage, safeWriteStorage } from '../lib/safeStorage';
import socket from '../services/socket';
import * as api from '../services/api';
-const TOAST_ID = 'portos-update-available';
-const OUT_OF_SYNC_TOAST_ID = 'portos-install-out-of-sync';
+// Out-of-sync dismissals are keyed by the on-disk commit the advisory was
+// raised for, so dismissing it silences THIS half-updated state without
+// silencing the next pull. `unknown` covers a tarball install / non-git tree.
+const OUT_OF_SYNC_DISMISS_KEY = 'portos:updateChecker:outOfSyncDismissedCommit';
+
+const dismissedCommit = () => safeReadStorage(OUT_OF_SYNC_DISMISS_KEY);
/**
- * Global hook that checks for PortOS updates and shows a persistent toast
- * when a new version is available, plus a distinct toast when the install is
- * out of sync (a bare `git pull` without ./update.sh — issue #1779). Runs in
- * Layout alongside useErrorNotifications.
+ * Global hook that checks for PortOS updates and reports both a new-version
+ * advisory and an "install out of sync" advisory (a bare `git pull` without
+ * ./update.sh — issue #1779).
+ *
+ * It returns state rather than raising toasts: a non-transient advisory must
+ * never occlude the current screen's primary action, so Layout renders these
+ * as inline banners in normal document flow (issue #3786). At 375px the old
+ * `duration: Infinity` corner toast sat permanently on top of bottom-anchored
+ * composers and submit buttons.
+ *
+ * Returns `{ update, outOfSync, ignoreUpdate, dismissUpdate, dismissOutOfSync }`.
*/
export function useUpdateChecker() {
- const navigate = useNavigate();
- const navigateRef = useRef(navigate);
- navigateRef.current = navigate;
+ const [update, setUpdate] = useState(null);
+ const [outOfSync, setOutOfSync] = useState(null);
useEffect(() => {
- const showUpdateToast = (data) => {
- toast(
- (t) => (
- <div className="flex flex-col gap-2">
- <span className="text-sm">
- Update available: <strong>v{data.currentVersion}</strong> → <strong>v{data.latestVersion}</strong>
- </span>
- <div className="flex gap-2">
- <button
- onClick={() => {
- toast.dismiss(t.id);
- navigateRef.current(`/apps/${api.PORTOS_APP_ID}/update`);
- }}
- className="px-2 py-1 bg-port-accent text-white text-xs rounded hover:bg-port-accent/80"
- >
- Update
- </button>
- <button
- onClick={() => {
- api.ignoreUpdateVersion(data.latestVersion).catch(() => null);
- toast.dismiss(t.id);
- }}
- className="px-2 py-1 bg-gray-600 text-white text-xs rounded hover:bg-gray-500"
- >
- Ignore
- </button>
- </div>
- </div>
- ),
- {
- id: TOAST_ID,
- duration: Infinity,
- icon: '🔄',
- label: `Update available: v${data.latestVersion}`
- }
- );
- };
-
- const showOutOfSyncToast = () => {
- toast(
- (t) => (
- <div className="flex flex-col gap-2">
- <span className="text-sm">
- Install out of sync — you pulled new code but haven’t reconciled it.
- </span>
- <div className="flex gap-2">
- <button
- onClick={() => {
- toast.dismiss(t.id);
- navigateRef.current(`/apps/${api.PORTOS_APP_ID}/update`);
- }}
- className="px-2 py-1 bg-port-warning text-black text-xs rounded hover:bg-port-warning/80"
- >
- Reconcile
- </button>
- <button
- onClick={() => toast.dismiss(t.id)}
- className="px-2 py-1 bg-gray-600 text-white text-xs rounded hover:bg-gray-500"
- >
- Dismiss
- </button>
- </div>
- </div>
- ),
- {
- id: OUT_OF_SYNC_TOAST_ID,
- duration: Infinity,
- icon: '⚠️',
- label: 'Install out of sync'
- }
- );
+ const onUpdateAvailable = (data) => {
+ setUpdate({ currentVersion: data.currentVersion, latestVersion: data.latestVersion });
};
- // Check status on mount
api.getUpdateStatus().then(status => {
if (status.updateAvailable && status.latestRelease) {
- showUpdateToast({
+ onUpdateAvailable({
currentVersion: status.currentVersion,
latestVersion: status.latestRelease.version
});
}
- // Distinct from the release toast — a half-updated install needs a
+ // Distinct from the release advisory — a half-updated install needs a
// reconcile (run update.sh), not a version bump.
if (status.installState?.outOfSync) {
- showOutOfSyncToast();
+ const commit = status.installState.currentCommit || 'unknown';
+ if (dismissedCommit() !== commit) setOutOfSync({ commit });
}
}).catch(() => {});
- // Listen for real-time update available events
- socket.on('portos:update:available', showUpdateToast);
-
+ socket.on('portos:update:available', onUpdateAvailable);
return () => {
- socket.off('portos:update:available', showUpdateToast);
+ socket.off('portos:update:available', onUpdateAvailable);
};
}, []);
+
+ // The side effects live in the handler, NOT inside a setState updater —
+ // React invokes updaters twice under StrictMode, which would double-fire the
+ // POST / storage write.
+ //
+ // "Ignore" is durable server-side (this version never re-raises); "dismiss"
+ // only clears it for this session.
+ const ignoreUpdate = useCallback(() => {
+ if (update) api.ignoreUpdateVersion(update.latestVersion).catch(() => null);
+ setUpdate(null);
+ }, [update]);
+
+ const dismissUpdate = useCallback(() => setUpdate(null), []);
+
+ const dismissOutOfSync = useCallback(() => {
+ if (outOfSync) safeWriteStorage(OUT_OF_SYNC_DISMISS_KEY, outOfSync.commit);
+ setOutOfSync(null);
+ }, [outOfSync]);
+
+ return { update, outOfSync, ignoreUpdate, dismissUpdate, dismissOutOfSync };
}
+
+export const __internal = { OUT_OF_SYNC_DISMISS_KEY };