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: address review (codex): preserve in-flight mind profile drafts

Adam Eivyed8cb873894c
diff --git a/client/src/components/cos/PersistentMindProfileControls.jsx b/client/src/components/cos/PersistentMindProfileControls.jsx
index 22c8dcd2c5..a748446352 100644
--- a/client/src/components/cos/PersistentMindProfileControls.jsx
+++ b/client/src/components/cos/PersistentMindProfileControls.jsx
@@ -46,6 +46,11 @@ export default function PersistentMindProfileControls({
// its setDraft call into an unconditional render loop in those hosts.
// eslint-disable-next-line react-hooks/exhaustive-deps
useEffect(() => {
+ // A socket/manual history refresh can return the pre-PUT profile while an
+ // optimistic save is still in flight. Keep the draft authoritative until
+ // the request settles; onSaved publishes the successful snapshot, while
+ // the catch path restores the last known saved value.
+ if (pendingSavesRef.current > 0) return;
const next = normalizeProfile(profile);
draftRef.current = next;
publishedProfileRef.current = next;
diff --git a/client/src/components/cos/tabs/MindTab.test.jsx b/client/src/components/cos/tabs/MindTab.test.jsx
index a5c3f14275..7d340f27fc 100644
--- a/client/src/components/cos/tabs/MindTab.test.jsx
+++ b/client/src/components/cos/tabs/MindTab.test.jsx
@@ -172,6 +172,11 @@ describe('MindTab', () => {
{ silent: true },
);
+ await user.click(screen.getByRole('button', { name: 'Reload' }));
+ await waitFor(() => expect(api.getPersistentMind).toHaveBeenCalledTimes(2));
+ expect(screen.getByLabelText('Model')).toHaveValue('gpt-5-mini');
+ expect(start).toBeDisabled();
+
finishSave({ success: true });
await waitFor(() => expect(start).toBeEnabled());
await user.click(start);