From aee543c7de74c38eb2abb9a970c33661d2443006 Mon Sep 17 00:00:00 2001 From: DrSmoothl <1787882683@qq.com> Date: Thu, 18 Jun 2026 16:16:26 +0800 Subject: [PATCH] fix(protocol): record inviter identity for uid-bearing group_invite MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit A group_invite carrying a fromUid is routed to the async dispatchGroupInvite enrich path, which only resolved the requester profile when needsProfile (uin missing/polluted) — so when the uin was already known it bypassed the synchronous rememberRequestIdentity that friend_request uses, and the inviter's uid↔uin was never stored. Record it up-front (mirrors the sync path), and re-record after a profile resolve so a previously-unknown uin self-heals. Fixes the long-standing bridge-member-identity test failure (core now fully green: 387 passed). --- packages/protocol/src/packet-pipeline.ts | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/packages/protocol/src/packet-pipeline.ts b/packages/protocol/src/packet-pipeline.ts index ac5e388d..5b4f66ab 100644 --- a/packages/protocol/src/packet-pipeline.ts +++ b/packages/protocol/src/packet-pipeline.ts @@ -163,6 +163,19 @@ export class IncomingPacketPipeline { private async dispatchGroupInvite(event: Extract): Promise { const uid = event.fromUid; if (uid) { + // Record the requester's identity up-front (synchronously), mirroring the + // friend_request path — uid-bearing group_invites take this async branch + // and would otherwise never store the inviter's uid↔uin when the uin is + // already known (needsProfile=false). uin equal to the group's own uin is + // the legacy decoder-pollution signature → pass 0 so the map write is + // skipped (rememberUidUin short-circuits on uin <= 0). + this.deps.identity.rememberRequestIdentity({ + groupId: event.groupId, + uid, + uin: event.fromUin > 0 && event.fromUin !== event.groupId ? event.fromUin : 0, + source: 'group_request', + }); + const subType = event.subType === 'invite' ? 'invite' : 'add'; // ALWAYS fetch the verify comment (it's never in the push). Resolve // the UID→UIN profile only when the requester isn't already known — @@ -180,6 +193,13 @@ export class IncomingPacketPipeline { if (needsProfile) { if (profileR.status === 'fulfilled' && profileR.value && profileR.value.uin > 0) { event.fromUin = profileR.value.uin; + // uin was unknown/polluted at entry; now resolved → self-heal the map. + this.deps.identity.rememberRequestIdentity({ + groupId: event.groupId, + uid, + uin: event.fromUin, + source: 'group_request', + }); } else if (profileR.status === 'rejected') { this.log.warn('failed to resolve stranger profile: uid=%s err=%s', uid, profileR.reason instanceof Error ? profileR.reason.message : String(profileR.reason));