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: log peer and cause when peer backfill fails (#13027)
[._.]/90076560f143
diff --git a/server/services/sharing/peerSync.js b/server/services/sharing/peerSync.jsindex 3f955be828..fde5f56b6f 100644--- a/server/services/sharing/peerSync.js+++ b/server/services/sharing/peerSync.js@@ -260,8 +260,8 @@ export async function autoSubscribePeerToAllRecords(peerId, recordKind) {const peers = await getPeers().catch(() => []);const peer = peers.find(p => p.instanceId === peerId);if (!peer || !peerAllowsOutbound(peer) || !peerHasCategory(peer, recordKind)) return [];- const records = await listRecordsForKind(recordKind).catch(() => {- console.error(`⚠️ peerSync: backfill inventory unavailable for ${recordKind}/records`);+ const records = await listRecordsForKind(recordKind).catch((err) => {+ logFailureWithStack(`⚠️ peerSync: backfill inventory unavailable for ${recordKind} → ${peer.name || peerId}`, err);return [];});if (records.length === 0) return [];@@ -843,8 +843,8 @@ export async function syncNowForPeer(peerId) {if (!peer?.instanceId) return { ok: false };for (const kind of PEER_SUBSCRIBABLE_KINDS) {if (peerHasCategory(peer, kind)) {- await autoSubscribePeerToAllRecords(peer.instanceId, kind).catch(() => {- console.error(`⚠️ peerSync: syncNow backfill failed for ${kind}`);+ await autoSubscribePeerToAllRecords(peer.instanceId, kind).catch((err) => {+ logFailureWithStack(`⚠️ peerSync: syncNow backfill failed for ${kind} → ${peer.name || peer.instanceId}`, err);});}}@@ -922,8 +922,8 @@ export function installPeerSyncListener() {// full-sync peer whose instanceId we only just learned) still back-// subscribes every kind here.if (peerHasCategory(peer, kind)) {- await autoSubscribePeerToAllRecords(peer.instanceId, kind).catch(() => {- console.error(`⚠️ peerSync: peer:online backfill failed for ${kind}`);+ await autoSubscribePeerToAllRecords(peer.instanceId, kind).catch((err) => {+ logFailureWithStack(`⚠️ peerSync: peer:online backfill failed for ${kind} → ${peer.name || peer.instanceId}`, err);});}}diff --git a/server/services/sharing/peerSync.test.js b/server/services/sharing/peerSync.test.jsindex d63027bd30..3a26b5a2c5 100644--- a/server/services/sharing/peerSync.test.js+++ b/server/services/sharing/peerSync.test.js@@ -1290,7 +1290,7 @@ describe('peerSync', () => {expect(vi.mocked(peerFetch)).not.toHaveBeenCalled();});- it('continues peer-online backfill after a kind inventory fails without logging private errors', async () => {+ it('continues peer-online backfill after a kind inventory fails, logging the peer and cause', async () => {const log = vi.spyOn(console, 'log').mockImplementation(() => {});const errorLog = vi.spyOn(console, 'error').mockImplementation(() => {});const { instanceEvents } = await import('../instanceEvents.js');@@ -1306,8 +1306,9 @@ describe('peerSync', () => {});await __drainForTests();expect(await findPeerSubscription('peer-a', 'series', 'ser-1')).not.toBeNull();- expect(errorLog).toHaveBeenCalledWith('⚠️ peerSync: backfill inventory unavailable for universe/records');- expect([...log.mock.calls, ...errorLog.mock.calls].flat().join(' ')).not.toContain('private inventory details');+ const logged = errorLog.mock.calls.flat().join(' ');+ expect(logged).toContain('backfill inventory unavailable for universe → A');+ expect(logged).toContain('private inventory details');log.mockRestore();errorLog.mockRestore();});