fix(msteams): persist first-DM conversation reference in pairing path#43414
fix(msteams): persist first-DM conversation reference in pairing path#43414xingsy97 wants to merge 1 commit intoopenclaw:mainfrom
Conversation
In MS Teams pairing mode, the first DM from a new user triggers a pairing request but returns early before saving the conversation reference. This means `openclaw pairing approve msteams <code> --notify` cannot deliver the approval notification because no conversation reference exists for the just-approved user. Fix: construct the conversation reference before the pairing early-return and persist it when the DM triggers a pairing request. Uses an idempotent helper to avoid double-persisting on the normal (allowed) message path. Closes openclaw#43323
Greptile SummaryThis PR fixes a bug in the MS Teams pairing flow where the first DM from a new user would trigger a pairing request but never persist the conversation reference needed for proactive Key changes:
The implementation is clean and minimal. One thing worth noting: Confidence Score: 5/5
Last reviewed commit: 61b67c1 |
|
@Takhoffman would appreciate a review. CI green, greptile 5/5. |
|
@frankekn could you help review? A simple fix for a known MS Teams first-DM pairing bug (plus test). CI green, greptile 5/5. |
Fix #43323
Problem
In MS Teams pairing mode, the first DM from a new user triggers a pairing request but returns early before saving the conversation reference. This means
openclaw pairing approve msteams <code> --notifycannot deliver the approval notification — no conversation reference exists for the just-approved user.Root Cause
The conversation reference construction and persistence happened after the pairing early-return path at line ~230. When
access.decision === 'pairing', the handler creates the pairing request but immediately returns, never reaching the conversation reference save at line ~337.Fix
Move conversation reference construction before the pairing early-return. Persist for pairing DMs with an idempotent helper so the normal (allowed) message path doesn't double-persist.
Validation
3 tests passing including a new test that verifies conversation reference IS persisted when a DM triggers a pairing request.