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: preserve members with repeated provider child IDs (#11150)

Adam Eivy84bbecb1cd46
diff --git a/server/lib/messageBrowserIdentity.js b/server/lib/messageBrowserIdentity.js
index fbe1abe089..3ad5b79f7e 100644
--- a/server/lib/messageBrowserIdentity.js
+++ b/server/lib/messageBrowserIdentity.js
@@ -167,6 +167,15 @@ export function browserDetailIdentities(summary, details) {
date
};
});
+ const providerIdCounts = new Map();
+ for (const member of members) {
+ if (member.providerMessageId) providerIdCounts.set(member.providerMessageId, (providerIdCounts.get(member.providerMessageId) || 0) + 1);
+ }
+ // Some provider paints repeat a conversation attribute on every child. It is
+ // not a usable child ID when it fails uniqueness inside the reading pane.
+ for (const member of members) {
+ if (providerIdCounts.get(member.providerMessageId) > 1) member.providerMessageId = null;
+ }
const counts = new Map();
for (const member of members) {
const key = messageIngestionIdentity(member);
diff --git a/server/services/messageSync.test.js b/server/services/messageSync.test.js
index 35056c0264..c44d1a075d 100644
--- a/server/services/messageSync.test.js
+++ b/server/services/messageSync.test.js
@@ -1193,9 +1193,9 @@ describe('browser ingestion identity across sync, cache, and activity (#11150)',
expect(f.stored().messages.filter(m => m.providerRowId === 'row-b').map(m => m.bodyText)).toEqual(['First body', 'Second body']);
});
- it('preserves ambiguous no-child-ID members rather than overwriting one with another', async () => {
+ it.each([null, 'repeated-provider-id'])('preserves ambiguous members rather than overwriting one with another (child ID: %s)', async (providerMessageId) => {
const f = await fixture();
- const details = ['Body one', 'Body two'].map(body => ({ from: summary.from, fromEmail: summary.fromEmail, date: summary.date, body }));
+ const details = ['Body one', 'Body two'].map(body => ({ providerMessageId, from: summary.from, fromEmail: summary.fromEmail, date: summary.date, body }));
scrape([{ ...summary, providerRowId: 'row-a' }], details);
await syncAccount(VALID_UUID);
await syncAccount(VALID_UUID);