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: pin backup Save/Run actions to a sticky bar and collapse the exclusions catalog (#3788)

[._.]/ Adam Eivy8c134970984b
diff --git a/.changelog/NEXT.md b/.changelog/NEXT.md
index 219b663eec..662f84bcc2 100644
--- a/.changelog/NEXT.md
+++ b/.changelog/NEXT.md
@@ -62,3 +62,4 @@
- **A CoS runner that is briefly unreachable no longer blocks the task for a human.** When an agent's TUI session spawns through the durable cos-runner and the spawn HTTP call fails — a bare `fetch failed` while PM2 restarts the runner, or the runner answering with a refusal — the failure finalized as the actionable `spawn-error`: the task was blocked immediately awaiting human approval, an "[Auto] Investigate agent failure" task was filed, and the escalation advice said to confirm the provider CLI is installed — none of which is true of a runner that was down for a moment. It was the most frequent failure class in the week's digest, five times over, each one parking work a plain retry fixes. The direct-CLI runner path drew this exact distinction long ago (`spawn-rejected` — non-actionable, retry, block only after the retry budget with the runner's own message attached); the TUI runner path now mirrors it. A local PTY that genuinely cannot open keeps the actionable `spawn-error`, because that is a real host problem a retry cannot repair.
- **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.
diff --git a/client/src/components/settings/BackupTab.jsx b/client/src/components/settings/BackupTab.jsx
index 0a1ce929fa..f3bb3f6350 100644
--- a/client/src/components/settings/BackupTab.jsx
+++ b/client/src/components/settings/BackupTab.jsx
@@ -1,5 +1,5 @@
import { useState, useEffect, useId } from 'react';
-import { Save, Plus, X, Play, ShieldOff } from 'lucide-react';
+import { Save, Plus, X, Play, ShieldOff, ChevronDown, ChevronRight } from 'lucide-react';
import toast from '../ui/Toast';
import BrailleSpinner from '../BrailleSpinner';
import ToggleSwitch from '../ToggleSwitch';
@@ -45,7 +45,9 @@ export function BackupTab() {
const [destPath, setDestPath] = useState('');
const [savedDestPath, setSavedDestPath] = useState('');
const [enabled, setEnabled] = useState(false);
+ const [savedEnabled, setSavedEnabled] = useState(false);
const [cronExpression, setCronExpression] = useState('0 2 * * *');
+ const [savedCronExpression, setSavedCronExpression] = useState('0 2 * * *');
const [excludePaths, setExcludePaths] = useState([]);
const [savedExcludePaths, setSavedExcludePaths] = useState([]);
const [disabledDefaultExcludes, setDisabledDefaultExcludes] = useState([]);
@@ -57,6 +59,10 @@ export function BackupTab() {
const [snapshots, setSnapshots] = useState([]);
const [restoreTarget, setRestoreTarget] = useState(null); // snapshotId pending confirm
const [restorePreview, setRestorePreview] = useState(null); // dry-run result
+ // The default-exclusions catalog is a 15+ row reference list the user rarely
+ // edits — collapsed by default so the fields they came to change (destination,
+ // enabled, schedule) and the action bar are what the tab actually shows.
+ const [showDefaultExcludes, setShowDefaultExcludes] = useState(false);
useEffect(() => {
Promise.all([
@@ -71,8 +77,12 @@ export function BackupTab() {
const savedDisabled = asArray(backup.disabledDefaultExcludes);
setDestPath(saved);
setSavedDestPath(saved);
- setEnabled(backup.enabled ?? false);
- setCronExpression(backup.cronExpression || '0 2 * * *');
+ const savedEnabledValue = backup.enabled ?? false;
+ const savedCron = backup.cronExpression || '0 2 * * *';
+ setEnabled(savedEnabledValue);
+ setSavedEnabled(savedEnabledValue);
+ setCronExpression(savedCron);
+ setSavedCronExpression(savedCron);
setExcludePaths(savedExcludes);
setSavedExcludePaths(savedExcludes);
setDisabledDefaultExcludes(savedDisabled);
@@ -91,6 +101,8 @@ export function BackupTab() {
try {
await updateSettings({ backup: { destPath, enabled, cronExpression, excludePaths, disabledDefaultExcludes } }, { silent: true });
setSavedDestPath(destPath);
+ setSavedEnabled(enabled);
+ setSavedCronExpression(cronExpression);
setSavedExcludePaths(excludePaths);
setSavedDisabledDefaultExcludes(disabledDefaultExcludes);
toast.success('Settings saved');
@@ -162,6 +174,8 @@ export function BackupTab() {
}
const dirty = destPath !== savedDestPath
+ || enabled !== savedEnabled
+ || cronExpression !== savedCronExpression
|| !sameSet(excludePaths, savedExcludePaths)
|| !sameSet(disabledDefaultExcludes, savedDisabledDefaultExcludes);
const canRun = !!savedDestPath && !running && !saving && !dirty;
@@ -173,6 +187,25 @@ export function BackupTab() {
? 'Save your changes before running — the backup uses saved settings.'
: 'Run a backup snapshot now using saved settings';
+ // Per-default row state, derived once so the collapsed summary count and the
+ // expanded rows can never disagree about what is actually being excluded.
+ // Custom excludes can shadow a default via exact match (`loras/...`) OR a
+ // broader pattern (`loras/`, `loras/**`, `/cos/`). The broader check is
+ // necessary because rsync still applies the custom pattern even when the
+ // default toggle says "included".
+ const defaultExcludeRows = defaultExcludes.map((d) => {
+ const shadowingCustom = excludePaths.find(p => shadowsDefault(p, d.path));
+ const defaultActive = !(d.overridable && disabledDefaultExcludes.includes(d.path));
+ return {
+ ...d,
+ shadowingCustom,
+ isExcluded: defaultActive || !!shadowingCustom,
+ shadowedByCustom: !defaultActive && !!shadowingCustom,
+ };
+ });
+ const skippedCount = defaultExcludeRows.filter(r => r.isExcluded).length;
+ const includedCount = defaultExcludeRows.length - skippedCount;
+
const renderPgStatus = () => {
if (!pgBackup) return <span className="text-gray-500">No backup run yet</span>;
if (pgBackup.status === 'ok') {
@@ -275,49 +308,49 @@ export function BackupTab() {
<p className="text-xs text-gray-500">Default: 2:00 AM daily</p>
</div>
- {defaultExcludes.length > 0 && (
+ {defaultExcludeRows.length > 0 && (
<div className="space-y-2">
- <div className="flex items-center gap-2">
- <ShieldOff size={14} className="text-gray-500" />
- <span className="block text-sm text-gray-400">Default Exclusions</span>
- </div>
- <p className="text-xs text-gray-500">Built-in paths skipped by default to keep snapshots small. Overridable entries (large re-downloadable assets) can be re-enabled below; fixed entries hold ephemeral data and stay off.</p>
- <ul className="space-y-1.5 mt-1">
- {defaultExcludes.map((d, i) => {
- const isDisabled = disabledDefaultExcludes.includes(d.path);
- // Custom excludes can shadow a default via exact match (`loras/...`)
- // OR a broader pattern (`loras/`, `loras/**`, `/cos/`). The broader
- // check is necessary because rsync still applies the custom pattern
- // even when the default toggle says "included".
- const shadowingCustom = excludePaths.find(p => shadowsDefault(p, d.path));
- const defaultActive = !(d.overridable && isDisabled);
- const isExcluded = defaultActive || !!shadowingCustom;
- const shadowedByCustom = !defaultActive && !!shadowingCustom;
- return (
- <li key={i} className="flex items-start gap-2 text-xs">
- {d.overridable ? (
- <ToggleSwitch
- enabled={!isExcluded}
- onChange={() => toggleDefaultExclude(d.path)}
- size="sm"
- ariaLabel={isExcluded ? `Include ${d.path} in backups` : `Exclude ${d.path} from backups`}
- className="mt-0.5"
- />
- ) : (
- <span className="inline-flex items-center justify-center w-12 h-7 shrink-0 text-gray-600" title="Always excluded — cannot be backed up">
- <ShieldOff size={14} />
+ <button
+ type="button"
+ onClick={() => setShowDefaultExcludes(v => !v)}
+ aria-expanded={showDefaultExcludes}
+ className="flex items-center gap-2 w-full text-left text-sm text-gray-400 hover:text-white transition-colors"
+ >
+ {showDefaultExcludes ? <ChevronDown size={14} className="shrink-0" /> : <ChevronRight size={14} className="shrink-0" />}
+ <ShieldOff size={14} className="text-gray-500 shrink-0" />
+ <span>Default exclusions — {skippedCount} path{skippedCount === 1 ? '' : 's'} skipped</span>
+ {includedCount > 0 && <span className="text-xs text-port-success/80">({includedCount} re-included)</span>}
+ </button>
+ {showDefaultExcludes && (
+ <>
+ <p className="text-xs text-gray-500">Built-in paths skipped by default to keep snapshots small. Overridable entries (large re-downloadable assets) can be re-enabled below; fixed entries hold ephemeral data and stay off.</p>
+ <ul className="space-y-1.5 mt-1">
+ {defaultExcludeRows.map((d, i) => (
+ <li key={i} className="flex items-start gap-2 text-xs">
+ {d.overridable ? (
+ <ToggleSwitch
+ enabled={!d.isExcluded}
+ onChange={() => toggleDefaultExclude(d.path)}
+ size="sm"
+ ariaLabel={d.isExcluded ? `Include ${d.path} in backups` : `Exclude ${d.path} from backups`}
+ className="mt-0.5"
+ />
+ ) : (
+ <span className="inline-flex items-center justify-center w-12 h-7 shrink-0 text-gray-600" title="Always excluded — cannot be backed up">
+ <ShieldOff size={14} />
+ </span>
+ )}
+ <code className={`px-1.5 py-0.5 bg-port-bg border rounded shrink-0 ${d.isExcluded ? 'text-gray-300 border-port-border' : 'text-port-success border-port-success/30'}`}>{d.path}</code>
+ <span className="text-gray-500">
+ {d.reason}
+ {!d.isExcluded && <span className="text-port-success/80 ml-1">(included)</span>}
+ {d.shadowedByCustom && <span className="text-port-warning ml-1">(still excluded via Additional Exclude Paths — remove <code>{d.shadowingCustom}</code> below)</span>}
</span>
- )}
- <code className={`px-1.5 py-0.5 bg-port-bg border rounded shrink-0 ${isExcluded ? 'text-gray-300 border-port-border' : 'text-port-success border-port-success/30'}`}>{d.path}</code>
- <span className="text-gray-500">
- {d.reason}
- {!isExcluded && <span className="text-port-success/80 ml-1">(included)</span>}
- {shadowedByCustom && <span className="text-port-warning ml-1">(still excluded via Additional Exclude Paths — remove <code>{shadowingCustom}</code> below)</span>}
- </span>
- </li>
- );
- })}
- </ul>
+ </li>
+ ))}
+ </ul>
+ </>
+ )}
</div>
)}
@@ -397,7 +430,11 @@ export function BackupTab() {
</div>
</Modal>
- <div className="flex flex-wrap items-center gap-2 pt-2 border-t border-port-border">
+ {/* Sticky action bar — Save and Run Backup Now stay reachable no matter how
+ far the exclusions/snapshot lists push the page, and the bar carries the
+ unsaved-changes state so an edit at the top of the tab is never
+ committed blind. Negative margins bleed it to the card edges. */}
+ <div className="sticky bottom-0 z-20 flex flex-wrap items-center gap-2 -mx-4 sm:-mx-6 -mb-4 sm:-mb-6 px-4 sm:px-6 py-3 bg-port-card/95 sm:backdrop-blur border-t border-port-border rounded-b-xl">
<button
onClick={handleSave}
disabled={saving}
@@ -415,6 +452,9 @@ export function BackupTab() {
{running ? <BrailleSpinner /> : <Play size={16} />}
{running ? 'Running…' : 'Run Backup Now'}
</button>
+ <span className="text-xs text-gray-500" aria-live="polite">
+ {saving ? 'Saving…' : dirty ? 'Unsaved changes' : ''}
+ </span>
</div>
</div>
);
diff --git a/client/src/components/settings/BackupTab.test.jsx b/client/src/components/settings/BackupTab.test.jsx
index 40e82406c6..ded30dec04 100644
--- a/client/src/components/settings/BackupTab.test.jsx
+++ b/client/src/components/settings/BackupTab.test.jsx
@@ -254,6 +254,81 @@ describe('BackupTab', () => {
await act(async () => { resolveSave({}); });
expect(screen.getByRole('button', { name: /Run Backup Now/i }).disabled).toBe(false);
});
+
+ // `enabled` and `cronExpression` are saved by the same PATCH as destPath, so
+ // they belong in the dirty check too — otherwise a user flips the schedule
+ // and Run Backup Now stays live against the stale saved value.
+ it('disables Run Backup Now while the Enabled toggle is edited-but-unsaved', async () => {
+ await renderTab();
+ expect(screen.getByRole('button', { name: /Run Backup Now/i }).disabled).toBe(false);
+
+ fireEvent.click(screen.getByRole('switch', { name: /Scheduled backups/i }));
+
+ const runBtn = screen.getByRole('button', { name: /Run Backup Now/i });
+ expect(runBtn.disabled).toBe(true);
+ expect(runBtn.title).toMatch(/Save your changes before running/i);
+ });
+
+ it('disables Run Backup Now while the cron schedule is edited-but-unsaved', async () => {
+ updateSettings.mockResolvedValue({});
+ await renderTab();
+
+ fireEvent.change(screen.getByLabelText(/Schedule \(cron\)/i), { target: { value: '30 3 * * *' } });
+ expect(screen.getByRole('button', { name: /Run Backup Now/i }).disabled).toBe(true);
+
+ await act(async () => {
+ fireEvent.click(screen.getByRole('button', { name: /^Save$/i }));
+ });
+
+ expect(screen.getByRole('button', { name: /Run Backup Now/i }).disabled).toBe(false);
+ });
+ });
+
+ describe('action bar + default-exclusions disclosure', () => {
+ const EXCLUDES = [
+ { path: '/cache', reason: 'Regenerable cache', overridable: false },
+ { path: '/models', reason: 'Large re-downloadable assets', overridable: true },
+ ];
+
+ it('surfaces an unsaved-changes hint next to Save and clears it on save', async () => {
+ updateSettings.mockResolvedValue({});
+ await renderTab();
+ expect(screen.queryByText(/Unsaved changes/i)).toBeNull();
+
+ fireEvent.change(screen.getByLabelText(/Destination Path/i), { target: { value: '/backups/edited' } });
+ expect(screen.getByText(/Unsaved changes/i)).toBeTruthy();
+
+ await act(async () => {
+ fireEvent.click(screen.getByRole('button', { name: /^Save$/i }));
+ });
+ expect(screen.queryByText(/Unsaved changes/i)).toBeNull();
+ });
+
+ it('collapses the default-exclusions catalog behind a disclosure summarizing the count', async () => {
+ getBackupStatus.mockResolvedValue({ status: 'never', defaultExcludes: EXCLUDES, pgBackup: null });
+ await renderTab();
+
+ const disclosure = screen.getByRole('button', { name: /Default exclusions/i });
+ expect(disclosure.getAttribute('aria-expanded')).toBe('false');
+ expect(disclosure.textContent).toMatch(/2 paths skipped/);
+ // Collapsed: the per-path rows (and their toggles) are not in the DOM, so
+ // the tab's actionable content isn't pushed below the fold.
+ expect(screen.queryByRole('switch', { name: /Include \/models in backups/i })).toBeNull();
+
+ fireEvent.click(disclosure);
+ expect(disclosure.getAttribute('aria-expanded')).toBe('true');
+ expect(screen.getByRole('switch', { name: /Include \/models in backups/i })).toBeTruthy();
+ });
+
+ it('counts a re-included default as no longer skipped in the collapsed summary', async () => {
+ getSettings.mockResolvedValue({ backup: { destPath: '/backups', enabled: false, cronExpression: '0 2 * * *', excludePaths: [], disabledDefaultExcludes: ['/models'] } });
+ getBackupStatus.mockResolvedValue({ status: 'never', defaultExcludes: EXCLUDES, pgBackup: null });
+ await renderTab();
+
+ const disclosure = screen.getByRole('button', { name: /Default exclusions/i });
+ expect(disclosure.textContent).toMatch(/1 path skipped/);
+ expect(disclosure.textContent).toMatch(/1 re-included/);
+ });
});
describe('Run Now — backup-already-running skip path', () => {