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: accept the numeric memory cursor that peers older than v1.26 send
Adam Eivy7a99ba3b9fff
diff --git a/server/services/syncOrchestrator.js b/server/services/syncOrchestrator.jsindex 5cb952fc7d..825a3fd2e1 100644--- a/server/services/syncOrchestrator.js+++ b/server/services/syncOrchestrator.js@@ -332,13 +332,14 @@ async function syncMemoryFromPeer(peer, cursor) {const result = await memorySync.applyRemoteChanges(data.memories, data.schemaVersion ?? 0);totalApplied += result.inserted + result.updated;- // Same non-advancing-cursor guard as the brain drain above.- if (typeof data.maxSequence !== 'string' || !/^\d+$/.test(data.maxSequence)- || safeBigInt(data.maxSequence) <= safeBigInt(memorySeq)) {+ // Same non-advancing-cursor guard as the brain drain above. Peers older+ // than v1.26.0 send the cursor as a number; newer ones send a string.+ const next = Number.isSafeInteger(data.maxSequence) && data.maxSequence >= 0 ? String(data.maxSequence) : data.maxSequence;+ if (typeof next !== 'string' || !/^\d+$/.test(next) || safeBigInt(next) <= safeBigInt(memorySeq)) {console.warn(`⚠️ Memory sync from ${peer.name}: cursor did not advance past ${memorySeq} — stopping this pull`);break;}- memorySeq = data.maxSequence;+ memorySeq = next;hasMore = data.hasMore === true;}diff --git a/server/services/syncOrchestrator.test.js b/server/services/syncOrchestrator.test.jsindex 0405309882..81550d6af7 100644--- a/server/services/syncOrchestrator.test.js+++ b/server/services/syncOrchestrator.test.js@@ -352,6 +352,23 @@ describe('syncOrchestrator', () => {expect(result.memory.memorySeq).toBe('0');});+ it('advances on the numeric memory cursor older peers send', async () => {+ let memoryPages = 0;+ mockFetch.mockImplementation(async (url) => {+ if (url.includes('/api/memory/sync')) {+ memoryPages += 1;+ return { ok: true, json: async () => ({ memories: [{ id: `m${memoryPages}` }], maxSequence: memoryPages * 100, hasMore: memoryPages < 2 }) };+ }+ return { ok: true, json: async () => ({}) };+ });+ applyMemoryChanges.mockResolvedValue({ inserted: 1, updated: 0 });++ const result = await syncWithPeer(mockPeer);++ expect(applyMemoryChanges).toHaveBeenCalledTimes(2);+ expect(result.memory.memorySeq).toBe('200');+ });+it('handles pagination loop with hasMore=true', async () => {// First brain batch: hasMore=truemockFetch