feat: add WhatsApp phone-code login#101294
Conversation
|
Codex review: needs maintainer review before merge. Reviewed July 12, 2026, 12:02 AM ET / 04:02 UTC. Summary PR surface: Source +499, Tests +812, Docs +3, Config +1, Other +8. Total +1323 across 28 files. Reproducibility: not applicable. as a conventional bug reproduction: this PR adds a new pairing mode, while the headless limitation and partial-credential state are source-clear and the competing PR demonstrates phone-code pairing on a physical device. Review metrics: 1 noteworthy metric.
Stored data model Root-cause cluster Members:
Proposal only: this assessment does not dispatch repair, suppress jobs, mutate sibling items, close, or merge anything. Merge readiness Overall follows the weaker of proof and patch quality, so missing proof can cap an otherwise strong patch. Rank-up moves:
Proof guidance:
Risk before merge
Maintainer options:
Next step before merge
Maintainer decision needed
Security Review detailsBest possible solution: Ship one canonical plugin-local login flow with QR as the default, retain the serialized managed-auth recovery design, and merge only after redacted exact-head device evidence proves phone-code pairing, QR pairing, interrupted retry, existing-session reconnect, and linked-device identity, with the dependency graph explicitly approved. Do we have a high-confidence way to reproduce the issue? Not applicable as a conventional bug reproduction: this PR adds a new pairing mode, while the headless limitation and partial-credential state are source-clear and the competing PR demonstrates phone-code pairing on a physical device. Is this the best way to solve the issue? Yes for architecture: the plugin-local prompt is narrower and better aligned with channel ownership than a generic CLI flag, but merge still requires product confirmation, exact-head device proof, and dependency authorization. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning high; reviewed against a4cc24d113a4. Label changesLabel justifications:
Evidence reviewedPR surface: Source +499, Tests +812, Docs +3, Config +1, Other +8. Total +1323 across 28 files. View PR surface stats
What I checked:
Likely related people:
What the crustacean ranks mean
Shiny media proof means a screenshot, video, or linked artifact directly shows the changed behavior. Runtime, network, CSP, and security claims still need visible diagnostics. How this review workflow works
Review history (18 earlier review cycles; latest 8 shown)
|
ccede60 to
68937b2
Compare
Dependency GuardThis PR changes dependency-related files. Maintainers should confirm these changes are intentional. Changed files:
Maintainer follow-up:
|
Dependency graph changes are blockedOpenClaw does not accept dependency graph changes through PRs unless a repository admin or security explicitly authorizes the current head SHA. Dependency updates are generated internally by maintainers so external PRs cannot change the resolved graph. Detected dependency graph changes:
Auto-scrub was not attempted because this PR changes package manifest dependency graph fields:
Dependency graph changes must be reviewed by security or handled by maintainers internally. Please remove lockfile changes manually if they are not needed. To remove lockfile changes, restore them from the target branch: git fetch origin
git checkout 'origin/main' -- 'extensions/whatsapp/npm-shrinkwrap.json' 'pnpm-lock.yaml'
git commit -m 'chore: remove dependency lockfile change'
git pushIf this PR intentionally needs a dependency graph change, ask a repository admin or member of The action will approve the current head SHA ( |
e37fe7c to
db5fef5
Compare
|
03308363013 |
|
ClawSweeper status: review started. I am starting a fresh review of this pull request: feat: add WhatsApp phone-code login This is item 1/1 in the current shard. Shard 9/22. This placeholder means the worker is alive and reading the current context. I will edit this same comment with the actual review when the claws are done clicking. Crustacean status: shell secured, claws on keyboard, evidence pebbles being sorted. |
Closes #85867
What Problem This Solves
Fixes an issue where users connecting WhatsApp from a headless, remote, or QR-unavailable environment had no first-class alternative to scanning a QR code.
It also fixes a retry edge case where an interrupted phone-code attempt could leave partial Baileys credentials on disk. Those incomplete credentials could be mistaken for a linked account and prevent a clean QR or phone-code retry.
Why This Change Was Made
WhatsApp now owns an interactive login choice inside its existing channel login callback, following the established plugin-local setup pattern. Running
openclaw channels login --channel whatsappprompts the user to either scan a QR code or link with a phone number; QR remains the default choice.The WhatsApp plugin owns phone-number validation, Baileys
requestPairingCodehandling, pairing-code display, socket restart behavior, and stale partial-credential cleanup. The cleanup reuses the existing credential-save queue and logout ownership checks so it cannot race a completed pairing save or delete an unmanaged auth directory.Baileys
7.0.0-rc13derives linked-device metadata differently across its QR and phone-code pairing paths. During QR registration, OpenClaw's existing"cli"client name falls back to the Chrome platform type while preserving"openclaw"as the device name, producing the observedGoogle Chrome (openclaw)label. Phone-code pairing maps the browser name separately and sends its companion platform type and display metadata directly, so the same"cli"tuple would not carry the Chrome identity.Rather than introduce a phone-code-only browser override, every WhatsApp socket now uses the canonical
["openclaw", "Chrome", VERSION]tuple. This keeps one socket-identity definition across QR, phone-code pairing, startup, and reconnect. Based on the metadata Baileys sends, both pairing methods are expected to appear asGoogle Chrome (openclaw); physical-device verification remains outstanding.This normalization does not re-pair or rename existing linked accounts. With saved credentials, Baileys uses its authenticated login path; under OpenClaw's current socket settings, the old
"cli"and new"Chrome"tuples produce a byte-identical login payload. Normal startup and reconnect continue using the established session credentials.This PR adds no production core CLI, channel-login, or Plugin SDK contract.
User Impact
Users can link WhatsApp in either of two ways from the same command:
Both methods are expected to create the same
Google Chrome (openclaw)Linked Devices identity. Existing linked sessions, account selection through--account, and normal send/receive/status behavior remain on the existing WhatsApp session path.If phone-code pairing is interrupted, OpenClaw no longer reports the partial credentials as linked. A later QR or phone-code login can safely clear managed stale state and retry.
Evidence
Validated on exact head
336aa3f33c0ed427250d43fae60e8d82dbb2cf12:tbx_01kx96g5keh29qervsrk57kzq2.tbx_01kx98stb6n0rpjfffx3x2ccev:pnpm check:changedpnpm buildgit diff --checkRemaining proof gap: this exact head has not been exercised against a physical WhatsApp device. Before merge, live verification should cover phone-number pairing and its native restart, QR login, an existing linked session, and the
Google Chrome (openclaw)Linked Devices label.