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: gate mind start on capability saves

Adam Eivyaba330c405e0
diff --git a/client/src/components/cos/tabs/MindTab.jsx b/client/src/components/cos/tabs/MindTab.jsx
index 687fa10fe4..9fa3fe7a0e 100644
--- a/client/src/components/cos/tabs/MindTab.jsx
+++ b/client/src/components/cos/tabs/MindTab.jsx
@@ -165,6 +165,7 @@ export default function MindTab() {
const [eventActionPending, setEventActionPending] = useState(null);
const [lifecycleError, setLifecycleError] = useState(null);
const [profileSaving, setProfileSaving] = useState(false);
+ const [capabilitiesSaving, setCapabilitiesSaving] = useState(false);
const [contextRefreshKey, setContextRefreshKey] = useState(0);
const [visitedPanels, setVisitedPanels] = useState(() => new Set(activePanel ? [activePanel] : []));
const [showActivity, setShowActivity] = useState(false);
@@ -533,7 +534,7 @@ export default function MindTab() {
.filter(([key, value]) => key !== 'schemaVersion' && value === true).length;
const { status: imageCapabilityStatus, guidance: imageCapabilityGuidance } = imageCapability(mind);
const imageAttachmentsUnavailable = imageCapabilityStatus === 'unsupported';
- const setupSaving = profileSaving;
+ const setupSaving = profileSaving || capabilitiesSaving;
const conversationItems = buildConversationItems(events || [], showActivity);
const openPanel = (panel) => setSearchParams((current) => {
const next = new URLSearchParams(current);
@@ -583,7 +584,7 @@ export default function MindTab() {
? runtime.inference.model
: mind?.profile?.model}
/>
- {!state?.started && <ActionButton label={profileReady ? 'Start' : 'Configure'} icon={profileReady ? CirclePlay : Settings2} pending={profileReady && lifecyclePending === 'start'} disabled={loading || profileSaving} onClick={() => (profileReady ? runLifecycle('start') : openPanel('settings'))} />}
+ {!state?.started && <ActionButton label={profileReady ? 'Start' : 'Configure'} icon={profileReady ? CirclePlay : Settings2} pending={profileReady && lifecyclePending === 'start'} disabled={loading || setupSaving} onClick={() => (profileReady ? runLifecycle('start') : openPanel('settings'))} />}
{state?.started && !isPaused && <ActionButton label="Pause" icon={CirclePause} pending={lifecyclePending === 'pause'} onClick={() => runLifecycle('pause')} />}
{state?.started && isPaused && <ActionButton label="Resume" icon={CirclePlay} pending={lifecyclePending === 'resume'} onClick={() => runLifecycle('resume')} />}
{state?.started && <ActionButton label="Stop" icon={Square} pending={lifecyclePending === 'stop'} onClick={() => runLifecycle('stop')} />}
@@ -734,7 +735,7 @@ export default function MindTab() {
<PersistentMindContextPanel view="memories" onMemoriesChanged={() => setContextRefreshKey((current) => current + 1)} />
</div>}
{(visitedPanels.has('tools') || activePanel === 'tools') && <div hidden={activePanel !== 'tools'}>
- <PersistentMindTools onCapabilitiesChange={(capabilities) => setMind((current) => current ? { ...current, capabilities } : current)} />
+ <PersistentMindTools onCapabilitiesChange={(capabilities) => setMind((current) => current ? { ...current, capabilities } : current)} onSavingChange={setCapabilitiesSaving} />
</div>}
{(visitedPanels.has('settings') || activePanel === 'settings') && <section hidden={activePanel !== 'settings'} aria-labelledby="mind-profile-heading" className="rounded border border-port-border bg-port-card p-4">
<div className="mb-3">
diff --git a/client/src/components/cos/tabs/MindTab.test.jsx b/client/src/components/cos/tabs/MindTab.test.jsx
index 882374bc5e..5c9a401bd8 100644
--- a/client/src/components/cos/tabs/MindTab.test.jsx
+++ b/client/src/components/cos/tabs/MindTab.test.jsx
@@ -310,6 +310,24 @@ describe('MindTab', () => {
expect(await screen.findByText('2 grants enabled')).toBeInTheDocument();
});
+ it('keeps Start gated until a capability save finishes', async () => {
+ const user = userEvent.setup();
+ let finishSave;
+ api.getPersistentMind.mockResolvedValue(response({
+ state: { enabled: true, started: false, status: 'idle', pauseReason: null },
+ }));
+ api.updateCosConfig.mockImplementation(() => new Promise((resolve) => { finishSave = resolve; }));
+ renderTab('/cos/mind?panel=tools');
+
+ const start = await screen.findByRole('button', { name: 'Start' });
+ await user.click(await screen.findByRole('checkbox', { name: 'Allow bounded PortOS reads' }));
+ expect(start).toBeDisabled();
+ expect(api.startPersistentMind).not.toHaveBeenCalled();
+
+ finishSave({ success: true });
+ await waitFor(() => expect(start).toBeEnabled());
+ });
+
it('keeps a failed message for a visible idempotent retry', async () => {
const user = userEvent.setup();
api.sendPersistentMindMessage.mockRejectedValueOnce(new Error('Provider unavailable'));
diff --git a/client/src/pages/PersistentMindTools.jsx b/client/src/pages/PersistentMindTools.jsx
index 95b6b75ad6..5ee76ecf8f 100644
--- a/client/src/pages/PersistentMindTools.jsx
+++ b/client/src/pages/PersistentMindTools.jsx
@@ -5,7 +5,7 @@ import BrailleSpinner from '../components/BrailleSpinner';
import Banner from '../components/ui/Banner';
import PersistentMindTaskAccessControls from '../components/cos/PersistentMindTaskAccessControls';
-export default function PersistentMindTools({ onCapabilitiesChange }) {
+export default function PersistentMindTools({ onCapabilitiesChange, onSavingChange }) {
const [data, setData] = useState(null);
const [loading, setLoading] = useState(true);
const [error, setError] = useState(null);
@@ -82,6 +82,7 @@ export default function PersistentMindTools({ onCapabilitiesChange }) {
<PersistentMindTaskAccessControls
capabilities={data.capabilities}
onSaved={updateCapabilities}
+ onSavingChange={onSavingChange}
/>
</div>
</section>
diff --git a/server/lib/socketEventCatalog.generated.json b/server/lib/socketEventCatalog.generated.json
index dcc9384f49..5cb879dfe7 100644
--- a/server/lib/socketEventCatalog.generated.json
+++ b/server/lib/socketEventCatalog.generated.json
@@ -999,7 +999,7 @@
{
"direction": "server-to-client",
"source": "client/src/components/cos/tabs/MindTab.jsx",
- "line": 325
+ "line": 326
},
{
"direction": "server-to-client",
@@ -1456,7 +1456,7 @@
{
"direction": "server-to-client",
"source": "client/src/components/cos/tabs/MindTab.jsx",
- "line": 326
+ "line": 327
},
{
"direction": "server-to-client",
@@ -1474,7 +1474,7 @@
{
"direction": "server-to-client",
"source": "client/src/components/cos/tabs/MindTab.jsx",
- "line": 327
+ "line": 328
},
{
"direction": "server-to-client",