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
fix: preserve maintenance setup after refresh failures
[._.]/ Adam Eivy675358f2913d
diff --git a/client/src/components/cos/tabs/ScheduleTab.jsx b/client/src/components/cos/tabs/ScheduleTab.jsxindex 1529498149..3de78b3fb1 100644--- a/client/src/components/cos/tabs/ScheduleTab.jsx+++ b/client/src/components/cos/tabs/ScheduleTab.jsx@@ -86,7 +86,7 @@ export default function ScheduleTab({ apps, providers, providersLoaded, activePrconst fetchSchedule = useCallback(async () => {const data = await api.getCosSchedule().catch(() => null);- setSchedule(data);+ setSchedule(current => data || current);setLoading(false);return data;}, []);diff --git a/client/src/components/cos/tabs/ScheduleTab.test.jsx b/client/src/components/cos/tabs/ScheduleTab.test.jsxindex 0e14d6dc33..a9e40d7870 100644--- a/client/src/components/cos/tabs/ScheduleTab.test.jsx+++ b/client/src/components/cos/tabs/ScheduleTab.test.jsx@@ -182,3 +182,17 @@ describe('Schedule labels', () => {expect(await screen.findByRole('option', { name: 'backend (1)' })).toBeTruthy();});});++it('keeps maintenance selections and the last saved schedule after a refresh failure', async () => {+ const user = userEvent.setup();+ api.getCodeReviewDefaults.mockResolvedValue({});+ api.getCosSchedule.mockReset().mockResolvedValueOnce({ tasks: {} }).mockRejectedValueOnce(new Error('offline'));+ render(<MemoryRouter><ScheduleTab apps={[{ id: 'example', name: 'Example App' }]} providers={[]} providersLoaded /></MemoryRouter>);+ await user.click(await screen.findByText('Run maintenance now'));+ await user.selectOptions(screen.getByLabelText('App'), 'example');+ await user.click(screen.getByRole('button', { name: 'Refresh' }));+ await waitFor(() => expect(api.getCosSchedule).toHaveBeenCalledTimes(2));+ expect(screen.getByLabelText('App')).toHaveValue('example');+ expect(screen.getByRole('button', { name: 'Run now' })).toBeDisabled();+ expect(screen.queryByText('Failed to load task schedule')).not.toBeInTheDocument();+});diff --git a/client/src/components/cos/tabs/schedule/MaintenanceRunForm.jsx b/client/src/components/cos/tabs/schedule/MaintenanceRunForm.jsxindex be2e05992b..7d02e0b8d2 100644--- a/client/src/components/cos/tabs/schedule/MaintenanceRunForm.jsx+++ b/client/src/components/cos/tabs/schedule/MaintenanceRunForm.jsx@@ -48,8 +48,10 @@ export default function MaintenanceRunForm({ schedule, apps = [], providers = []});// Refresh even after a partial save so retries use the persisted settings.const refreshed = await onRefresh().catch(() => false);- if (!refreshed) setMessage('Could not refresh task settings. Refresh the schedule before running maintenance.');- else if (saved) setMessage('Required tasks enabled. You can now run maintenance.');+ if (!refreshed) setMessage(current => saved+ ? 'Could not refresh task settings. Refresh the schedule before running maintenance.'+ : `${current} Refreshing the schedule also failed.`);+ else if (saved) setMessage('Required task settings saved.');setPreparing(false);setBusy(false);};diff --git a/client/src/components/cos/tabs/schedule/MaintenanceRunForm.test.jsx b/client/src/components/cos/tabs/schedule/MaintenanceRunForm.test.jsxindex 3ad6c2e8ff..7c2300ea82 100644--- a/client/src/components/cos/tabs/schedule/MaintenanceRunForm.test.jsx+++ b/client/src/components/cos/tabs/schedule/MaintenanceRunForm.test.jsx@@ -95,11 +95,12 @@ describe('maintenance launch', () => {});it('blocks missing task eligibility and a stopped daemon', async () => {const user = userEvent.setup();- show({ schedule: { tasks: {} }, daemonRunning: false });+ show({ schedule: { tasks: {} }, daemonRunning: false, onRefresh: vi.fn() });await select(user);expect(screen.getByRole('button', { name: 'Run now' })).toBeDisabled();expect(screen.getByText(/Run now needs these saved task settings/)).toBeInTheDocument();expect(screen.getByText(/start the CoS daemon/)).toBeInTheDocument();+ expect(screen.queryByRole('button', { name: 'Enable required tasks' })).not.toBeInTheDocument();expect(api.saveQuotaBurn).not.toHaveBeenCalled();});});@@ -143,13 +144,14 @@ it('enables only missing prerequisites and waits for refreshed saved settings beit('refreshes partial setup after failure without saving a plan or starting work', async () => {const user = userEvent.setup();- const onRefresh = vi.fn().mockResolvedValue({ tasks });+ const onRefresh = vi.fn().mockRejectedValue(new Error('refresh unavailable'));api.updateAppTaskTypeOverride.mockRejectedValueOnce(new Error('save unavailable'));show({ schedule: { tasks: { ...tasks, simplify: { ...tasks.simplify, enabled: false, appOverrides: {} } } }, onRefresh });await select(user);await user.click(screen.getByRole('button', { name: 'Enable required tasks' }));expect(await screen.findByText(/Setup incomplete: save unavailable/)).toBeInTheDocument();expect(onRefresh).toHaveBeenCalledOnce();+ expect(screen.getByText(/Refreshing the schedule also failed/)).toBeInTheDocument();expect(screen.getByRole('button', { name: 'Run now' })).toBeDisabled();expect(api.saveQuotaBurn).not.toHaveBeenCalled();expect(api.runQuotaBurn).not.toHaveBeenCalled();