Fix WhatsApp group access when senders are opaque LIDs.

Resolve LID to phone aliases before allowlist and @mention checks so
group prompts are not silently dropped after a working direct chat.

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
oliver 2026-09-05 15:56:24 +08:00
parent 7f1b9bd480
commit d9edca4d5f
9 changed files with 472 additions and 203 deletions

View file

@ -228,7 +228,11 @@ export class TextHarnessBridge {
const hasFiles = hasInboundFiles(normalized);
const decision = accessDecision ?? evaluateInboundAccess(this.#accessPolicy, {
conversationType: kind,
senderIds: [senderId, cleanText(normalized.senderAlternateId)].filter(Boolean),
senderIds: [
senderId,
cleanText(normalized.senderAlternateId),
...(Array.isArray(normalized.senderAliasIds) ? normalized.senderAliasIds : []),
].filter(Boolean),
text: normalized.content,
hasImages,
hasFiles,
@ -244,8 +248,14 @@ export class TextHarnessBridge {
messageId,
decision.reason === 'command-not-allowed'
? t(COMMAND_PERMISSION_DENIED_MESSAGE)
: null,
{ recordReceived: decision.reason === 'command-not-allowed' },
: (decision.reason === 'sender-not-allowed'
&& (normalized.kind !== 'group' || normalized.addressed === true)
? t('你不在当前机器人的访问白名单中。')
: null),
{
recordReceived: decision.reason === 'command-not-allowed'
|| decision.reason === 'sender-not-allowed',
},
);
}
}