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

address review (codex): show Make mutual even when all categories are off

Adam Eivyf48688fcf968
diff --git a/client/src/pages/Instances.jsx b/client/src/pages/Instances.jsx
index d35818697d..8414ee0004 100644
--- a/client/src/pages/Instances.jsx
+++ b/client/src/pages/Instances.jsx
@@ -565,7 +565,13 @@ function SyncCategoriesPanel({ peer, onRefresh }) {
sync the same back automatically.
</p>
<div className="flex items-center justify-end gap-2 mb-1.5">
- {peer.instanceId && enabledCount > 0 && (
+ {/* Available whenever we know the peer's identity — NOT gated on
+ enabledCount. The worst stale case is disabling the LAST category
+ while the peer is offline: the peer keeps its now-stale enabled
+ set, and the reciprocate endpoint pushes our all-false map to
+ clear it. Gating on enabledCount>0 would hide the control exactly
+ when it's needed. */}
+ {peer.instanceId && (
<button
onClick={makeMutual}
className="flex items-center gap-1 mr-auto text-[10px] text-gray-500 hover:text-port-accent transition-colors"
diff --git a/server/services/instances.test.js b/server/services/instances.test.js
index d41ebed570..7fabc4bf0d 100644
--- a/server/services/instances.test.js
+++ b/server/services/instances.test.js
@@ -577,6 +577,17 @@ describe('instances.js', () => {
expect(changed).toBe(false);
});
+ it('applies an all-false map to clear a stale enabled category (the offline-disable recovery path)', async () => {
+ const peers = [{ id: 'p1', instanceId: 'inst-A', name: 'A', syncCategories: { brain: true }, syncEnabled: true }];
+ readJSONFile.mockResolvedValue({ self: { instanceId: 'me' }, peers });
+
+ const { changed, peer } = await applyReciprocalSync('inst-A', { brain: false });
+
+ expect(changed).toBe(true);
+ expect(peer.syncCategories.brain).toBe(false);
+ expect(peer.syncEnabled).toBe(false); // nothing left enabled
+ });
+
it('returns changed:false for an unknown peer instanceId', async () => {
readJSONFile.mockResolvedValue({ self: { instanceId: 'me' }, peers: [] });
const { changed, peer } = await applyReciprocalSync('nope', { brain: true });