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: preserve maintenance plans and browser-safe provider lookup

[._.]/ Adam Eivy4ea09677557e
diff --git a/client/src/components/cos/tabs/ScheduleTab.jsx b/client/src/components/cos/tabs/ScheduleTab.jsx
index cd466f55c3..ca86a79d7a 100644
--- a/client/src/components/cos/tabs/ScheduleTab.jsx
+++ b/client/src/components/cos/tabs/ScheduleTab.jsx
@@ -192,7 +192,7 @@ export default function ScheduleTab({ apps, providers, providersLoaded, activePr
<p className="text-xs mt-1">Resolve findings between audits, then document the resulting code. Quota Burn offers this sequence with perpetual claim-issue drains between steps.</p>
<details className="mt-2">
<summary className="cursor-pointer text-sm font-medium">Run maintenance now</summary>
- <MaintenanceRunForm schedule={schedule} apps={apps} providers={providers} providersLoaded={providersLoaded} improvementDisabled={improvementDisabled} daemonRunning={daemonRunning} />
+ <MaintenanceRunForm schedule={{ ...schedule, tasks }} apps={apps} providers={providers} providersLoaded={providersLoaded} improvementDisabled={improvementDisabled} daemonRunning={daemonRunning} />
</details>
</Banner>
diff --git a/client/src/components/cos/tabs/schedule/MaintenanceRunForm.jsx b/client/src/components/cos/tabs/schedule/MaintenanceRunForm.jsx
index 9ef4bd0628..ddeafd3f61 100644
--- a/client/src/components/cos/tabs/schedule/MaintenanceRunForm.jsx
+++ b/client/src/components/cos/tabs/schedule/MaintenanceRunForm.jsx
@@ -25,6 +25,16 @@ export default function MaintenanceRunForm({ schedule, apps = [], providers = []
const run = async () => {
if (busy || blocked || !jobs || !provider || !model || !consent) return;
setBusy(true);
+ setMessage('Checking existing plan…');
+ const current = await api.getQuotaBurn(false, { silent: true }).catch(error => {
+ setMessage(`Could not check existing plan: ${error.message}`);
+ return null;
+ });
+ if (!current?.config || current.config.families?.[familyId]?.jobs?.length) {
+ if (current?.config) setMessage('This family already has a plan. Manage or clear it in Quota Burn before starting another sequence.');
+ setBusy(false);
+ return;
+ }
setMessage('Saving maintenance sequence…');
// Each invocation gets fresh completion keys. Pins apply to the audits AND
// their claim drains; the scheduled tasks' saved settings remain intact.
@@ -81,10 +91,10 @@ export default function MaintenanceRunForm({ schedule, apps = [], providers = []
/>
{appId && !jobs && <p role="status">Enable every maintenance task and claim-issue for this app, and set claim-issue to perpetual, before running the sequence.</p>}
{blocked && <p role="status">Enable Improvement and start the CoS daemon before running maintenance.</p>}
- <p className="text-xs">Runs the first step now; later steps continue in order through Quota Burn, subject to its quota gates. Supports subscription CLI/TUI providers.</p>
+ <p className="text-xs">Runs the first step now, bypassing its reset window, reserve, and dispatch cap; later steps continue in order through Quota Burn, subject to its quota gates. Supports subscription CLI/TUI providers. Blank effort inherits each scheduled task’s saved effort.</p>
<label className="flex items-start gap-2" htmlFor="maintenance-run-consent">
<input id="maintenance-run-consent" type="checkbox" checked={consent} disabled={busy} onChange={event => setConsent(event.target.checked)} />
- <span>Enable Quota Burn and replace this provider family’s plan with this maintenance sequence. Other enabled family plans may also resume.</span>
+ <span>Enable Quota Burn and add this maintenance sequence to an empty provider family plan. Other enabled family plans may also resume.</span>
</label>
<div className="flex items-center gap-3 flex-wrap">
<button type="button" onClick={run} disabled={busy || blocked || !jobs || !provider || !model || !consent || !providersLoaded} className="px-3 py-1.5 bg-port-accent text-white rounded disabled:opacity-50">
diff --git a/client/src/components/cos/tabs/schedule/MaintenanceRunForm.test.jsx b/client/src/components/cos/tabs/schedule/MaintenanceRunForm.test.jsx
index 9c6a580b70..7850184d7b 100644
--- a/client/src/components/cos/tabs/schedule/MaintenanceRunForm.test.jsx
+++ b/client/src/components/cos/tabs/schedule/MaintenanceRunForm.test.jsx
@@ -5,7 +5,7 @@ import { MemoryRouter } from 'react-router';
import { MAINTENANCE_TASK_ORDER } from '../../../../lib/quotaBurnTasks';
import MaintenanceRunForm from './MaintenanceRunForm';
-const api = vi.hoisted(() => ({ saveQuotaBurn: vi.fn(), runQuotaBurn: vi.fn() }));
+const api = vi.hoisted(() => ({ getQuotaBurn: vi.fn(), saveQuotaBurn: vi.fn(), runQuotaBurn: vi.fn() }));
vi.mock('../../../../services/api', () => api);
const tasks = Object.fromEntries([...MAINTENANCE_TASK_ORDER, 'claim-issue'].map(taskType => [taskType, {
enabled: true, perpetual: taskType === 'claim-issue', appOverrides: { example: { enabled: true } },
@@ -25,6 +25,7 @@ const select = async user => {
};
beforeEach(() => {
vi.clearAllMocks();
+ api.getQuotaBurn.mockResolvedValue({ config: { families: {} } });
api.saveQuotaBurn.mockResolvedValue({ config: {} });
api.runQuotaBurn.mockResolvedValue({ result: { dispatched: true } });
});
@@ -66,6 +67,29 @@ describe('maintenance launch', () => {
await user.click(screen.getByRole('button', { name: 'Run now' }));
expect(await screen.findByText(/Sequence saved; waiting: provider unavailable/)).toBeInTheDocument();
});
+ it('preserves existing family plans and refuses to save when the plan cannot be read', async () => {
+ const user = userEvent.setup();
+ show();
+ await select(user);
+ api.getQuotaBurn.mockResolvedValueOnce({ config: { families: { claude: { jobs: [{ id: 'existing' }] } } } });
+ await user.click(screen.getByRole('button', { name: 'Run now' }));
+ expect(await screen.findByText(/This family already has a plan/)).toBeInTheDocument();
+ expect(api.saveQuotaBurn).not.toHaveBeenCalled();
+ api.getQuotaBurn.mockRejectedValueOnce(new Error('offline'));
+ await user.click(screen.getByRole('button', { name: 'Run now' }));
+ expect(await screen.findByText(/Could not check existing plan: offline/)).toBeInTheDocument();
+ expect(api.saveQuotaBurn).not.toHaveBeenCalled();
+ expect(api.runQuotaBurn).not.toHaveBeenCalled();
+ });
+ it('links to the saved plan after dispatch transport failure', async () => {
+ const user = userEvent.setup();
+ show();
+ await select(user);
+ api.runQuotaBurn.mockRejectedValueOnce(new Error('runner offline'));
+ await user.click(screen.getByRole('button', { name: 'Run now' }));
+ expect(await screen.findByText(/Sequence saved, but could not start: runner offline/)).toBeInTheDocument();
+ expect(screen.getByRole('link', { name: /Manage sequence/ })).toHaveAttribute('href', '/devtools/quota-burn/claude');
+ });
it('blocks missing task eligibility and a stopped daemon', async () => {
const user = userEvent.setup();
show({ schedule: { tasks: {} }, daemonRunning: false });
diff --git a/server/lib/importScoping.test.js b/server/lib/importScoping.test.js
index 2b1c46602f..4c785c45db 100644
--- a/server/lib/importScoping.test.js
+++ b/server/lib/importScoping.test.js
@@ -39,6 +39,8 @@ const reaches = (entry, target) => staticImportClosure(abs(entry)).files.has(abs
// Each row: the entry that was narrowed, the module it must no longer
// statically reach, and why the entry only ever needed a slice of it.
const NARROWED = [
+ ['lib/providerFamilies.js', 'lib/grok.js',
+ 'shares browser-safe family identity without Grok filesystem helpers'],
['services/promptSections/instructions.js', 'services/taskScheduleRegistry.js',
'needs task names, which scheduledTaskTypes.js declares'],
['services/agentAppWorkspace.js', 'services/promptRunner.js',
diff --git a/server/lib/providerFamilies.js b/server/lib/providerFamilies.js
index 7b4ec21dbd..1ca57cd6c7 100644
--- a/server/lib/providerFamilies.js
+++ b/server/lib/providerFamilies.js
@@ -1,6 +1,5 @@
import { isClaudeHarnessProvider } from './providerTypes.js';
import { commandBasename } from './providerModels.js';
-import { isGrokCommand } from './grok.js';
/**
* Subscription-quota FAMILY identity: which provider configs belong to the same
@@ -45,7 +44,7 @@ export const PROVIDER_FAMILIES = [
id: 'grok',
label: 'Grok',
idPattern: /grok/i,
- matches: (p) => isGrokCommand(p.command) || /grok/i.test(p.id || '')
+ matches: (p) => commandBasename(p.command) === 'grok' || /grok/i.test(p.id || '')
}
];