fix(whatsapp): guard updateLastRoute when dmScope isolates DM sessions#24949
Merged
steipete merged 3 commits intoFeb 24, 2026
Conversation
4 tasks
When session.dmScope is set to 'per-channel-peer', WhatsApp DMs correctly resolve isolated session keys, but updateLastRouteInBackground unconditionally wrote lastTo to the main session key. This caused reply routing corruption and privacy violations. Only update main session's lastRoute when the DM session actually IS the main session (sessionKey === mainSessionKey). Fixes openclaw#24912
steipete
force-pushed
the
fix/whatsapp-dm-last-route
branch
from
February 24, 2026 03:55
7296045 to
5d79c90
Compare
Contributor
|
Landed via temp rebase onto main.
Thanks @kevinWangSheng! |
This was referenced Feb 24, 2026
plgs2005
pushed a commit
to plgs2005/openclaw
that referenced
this pull request
Feb 24, 2026
margulans
pushed a commit
to margulans/Neiron-AI-assistant
that referenced
this pull request
Feb 25, 2026
kevinWangSheng
pushed a commit
to kevinWangSheng/openclaw
that referenced
this pull request
Feb 26, 2026
kevinWangSheng
pushed a commit
to kevinWangSheng/openclaw
that referenced
this pull request
Feb 26, 2026
2 tasks
mylukin
pushed a commit
to mylukin/openclaw
that referenced
this pull request
Feb 26, 2026
r4jiv007
pushed a commit
to r4jiv007/openclaw
that referenced
this pull request
Feb 28, 2026
6 tasks
hughdidit
pushed a commit
to hughdidit/DAISy-Agency
that referenced
this pull request
Mar 1, 2026
…@kevinWangSheng) (cherry picked from commit ebde897) # Conflicts: # CHANGELOG.md # src/web/auto-reply/monitor/process-message.inbound-contract.test.ts
hughdidit
pushed a commit
to hughdidit/DAISy-Agency
that referenced
this pull request
Mar 3, 2026
…@kevinWangSheng) (cherry picked from commit ebde897) # Conflicts: # CHANGELOG.md # src/web/auto-reply/monitor/process-message.inbound-contract.test.ts
18 tasks
lovewanwan
pushed a commit
to lovewanwan/openclaw
that referenced
this pull request
Apr 28, 2026
ogt-redknie
pushed a commit
to ogt-redknie/OPENX
that referenced
this pull request
May 2, 2026
github-actions Bot
pushed a commit
to Desicool/openclaw
that referenced
this pull request
May 9, 2026
This was referenced Jun 28, 2026
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.
Problem
When
session.dmScopeis set to"per-channel-peer", WhatsApp DMs correctly resolve isolated session keys, butupdateLastRouteInBackgroundunconditionally wrotelastToto the main session key. This caused:lastTo— subsequent auto-replies route to whoever messaged lastchannel: "last"resolve against the corrupted main sessionRoot Cause
In
src/web/auto-reply/monitor/process-message.ts,updateLastRouteInBackgroundalways wrote toparams.route.mainSessionKeyregardless of whether the DM was isolated.Fix
Only update main session's
lastRoutewhen the DM session actually IS the main session (sessionKey === mainSessionKey):Testing
pnpm buildpassespnpm tsgopassespnpm lintpassesBehavior
dmScope="main"(default):sessionKey === mainSessionKey→updateLastRoutefires as before. No behavior change.dmScope="per-channel-peer":sessionKey !== mainSessionKey→updateLastRouteis skipped, preventing main session corruption.Fixes #24912
Greptile Summary
Prevented WhatsApp DM routing corruption when
session.dmScope="per-channel-peer"by guardingupdateLastRouteInBackgroundto only update the main session'slastRoutewhen the DM session actually IS the main session.sessionKey !== mainSessionKey) were overwriting the main session'slastRoute, causing replies to route to whoever messaged last instead of the intended recipientparams.route.sessionKey === params.route.mainSessionKeyto guard the update (line 330 insrc/web/auto-reply/monitor/process-message.ts:330)dmScope="main"(default),sessionKey === mainSessionKeyso behavior is unchangedPR_STATUS.mdtracking file for agent workflow coordination (non-functional change)Confidence Score: 5/5
lastRoutewhen DM sessions are isolated. The logic is sound - whendmScope="per-channel-peer", isolated DM sessions have differentsessionKeyvalues frommainSessionKey, and updating the main session with isolated DM routing data breaks reply routing. The guard preserves existing behavior for defaultdmScope="main"since those keys are equal. All CI checks passed.Last reviewed commit: 7296045