fix(whatsapp): resolve LID aliases on modern platforms/ session layout - #36665
Closed
fesalfayed wants to merge 1 commit into
Closed
fix(whatsapp): resolve LID aliases on modern platforms/ session layout#36665fesalfayed wants to merge 1 commit into
fesalfayed wants to merge 1 commit into
Conversation
expand_whatsapp_aliases hardcoded get_hermes_home()/whatsapp/session, but
the adapter writes lid-mapping files via get_hermes_dir("platforms/whatsapp/
session", "whatsapp/session"). On installs without the legacy directory the
two paths diverge, so the resolver finds no mappings and returns the bare LID,
which misses the allowlist and silently drops the message. Resolve through the
same helper so both sides stay in lockstep on new and legacy layouts.
Contributor
Author
|
Validation refresh and duplicate-context note:
This is the same issue as #38712; happy for maintainers to take whichever branch they prefer, but this one includes both modern and legacy layout coverage. |
Contributor
pai-scaffolde
pushed a commit
to pai-scaffolde/hermes-agent
that referenced
this pull request
Jun 28, 2026
Add an _is_user_authorized E2E for the platforms/whatsapp/session layout on top of fesalfayed's resolver fix (NousResearch#36665) — guards the actual silently-dropped-LID-sender path from NousResearch#36664.
waefrebeorn
pushed a commit
to waefrebeorn/slermes
that referenced
this pull request
Jul 2, 2026
Add an _is_user_authorized E2E for the platforms/whatsapp/session layout on top of fesalfayed's resolver fix (NousResearch#36665) — guards the actual silently-dropped-LID-sender path from NousResearch#36664.
Jasper6439
pushed a commit
to Jasper6439/hermes-agent
that referenced
this pull request
Jul 5, 2026
Add an _is_user_authorized E2E for the platforms/whatsapp/session layout on top of fesalfayed's resolver fix (NousResearch#36665) — guards the actual silently-dropped-LID-sender path from NousResearch#36664.
habarmc1223-sudo
pushed a commit
to habarmc1223-sudo/hermes-agent-fluxmem
that referenced
this pull request
Jul 8, 2026
Add an _is_user_authorized E2E for the platforms/whatsapp/session layout on top of fesalfayed's resolver fix (NousResearch#36665) — guards the actual silently-dropped-LID-sender path from NousResearch#36664.
santhreal
pushed a commit
to santhreal/hermes-agent
that referenced
this pull request
Jul 13, 2026
Add an _is_user_authorized E2E for the platforms/whatsapp/session layout on top of fesalfayed's resolver fix (NousResearch#36665) — guards the actual silently-dropped-LID-sender path from NousResearch#36664.
Gravezzz
pushed a commit
to Gravezzz/hermes-agent
that referenced
this pull request
Jul 21, 2026
Add an _is_user_authorized E2E for the platforms/whatsapp/session layout on top of fesalfayed's resolver fix (NousResearch#36665) — guards the actual silently-dropped-LID-sender path from NousResearch#36664.
leewenjie
pushed a commit
to leewenjie/hermes-agent
that referenced
this pull request
Aug 7, 2026
Add an _is_user_authorized E2E for the platforms/whatsapp/session layout on top of fesalfayed's resolver fix (NousResearch#36665) — guards the actual silently-dropped-LID-sender path from NousResearch#36664.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What does this PR do?
expand_whatsapp_aliasesingateway/whatsapp_identity.pyreads the bridge'slid-mapping-*.jsonfiles to collapse a WhatsApp LID to its phone alias, but it hardcodes the session directory:The WhatsApp adapter writes those files — and points the bridge at them via
--session— through the consolidated-layout helper instead:get_hermes_dir(new, old)returns the legacy path only when it already exists on disk, otherwise the newplatforms/...path. So on any install without a legacywhatsapp/sessiondirectory the bridge writes mappings toplatforms/whatsapp/sessionwhile the resolver looks inwhatsapp/session— empty/nonexistent. The resolver finds no mappings, returns the bare LID, the allowlist check misses, and the inbound message is silently dropped. The module docstring's "single source of truth … so the two paths can never drift apart" is contradicted by this line.This routes the resolver through the same
get_hermes_dir(...)call the adapter uses, so the read and write paths stay in lockstep on both the modern and legacy layouts and can't drift again.Same root-cause-not-symptom approach as #35859 (merged): one minimal in-style change at the divergence point, no new bookkeeping, plus a regression test that fails on the old path and passes on the fixed one.
Related Issue
Fixes #36664
Type of Change
Changes Made
gateway/whatsapp_identity.py—expand_whatsapp_aliases: resolvesession_dirviaget_hermes_dir("platforms/whatsapp/session", "whatsapp/session")(the adapter's helper) instead of the hardcodedget_hermes_home() / "whatsapp" / "session".tests/gateway/test_whatsapp_identity.py— resolution test on both the modernplatforms/whatsapp/sessionand legacywhatsapp/sessionlayouts.How to Test
The modern-layout test fails on
main(expand_whatsapp_aliases("<lid>@lid")returns{"<lid>"}only) and passes with this change (returns{"<lid>", "<phone>"}). Broader suite green:Checklist
Code
Documentation & Housekeeping