Skip to content

fix(whatsapp): add listGroupsLive for real-time group directory - #93996

Closed
xialonglee wants to merge 0 commit into
openclaw:mainfrom
xialonglee:fix/issue-76722-whatsapp-directory-groups-live
Closed

xialonglee wants to merge 0 commit into
openclaw:mainfrom
xialonglee:fix/issue-76722-whatsapp-directory-groups-live

Conversation

@xialonglee

@xialonglee xialonglee commented Jun 17, 2026 •

Copy link
Copy Markdown
Contributor

What Problem This Solves

The WhatsApp directory exposed only configured group allowlist keys. A linked account with real group memberships but no configured group entries therefore saw no live groups from the directory command.

Fixes #76722.

Maintainer Rewrite

The original patch registered a config-backed alias as the live lookup. The maintained head instead:

  • queries live group membership through the active gateway-owned Baileys socket;
  • uses an exclusive owner-managed helper for standalone CLI lookup;
  • disables temporary-socket message, call, receipt, notification, presence, dirty-state, and offline processing;
  • awaits transport closure and credential persistence before releasing ownership;
  • reports typed availability errors instead of silently substituting configured groups;
  • covers ownership, shutdown, cleanup, filtering, and failure paths.

No config or environment surface is added.

User Impact

Linked WhatsApp users can discover participating group JIDs and names. A running or connecting gateway remains the connection owner; the CLI never opens a competing socket. Live lookup failures are explicit.

Evidence

Maintained head b2d0f62664e4:

  • Focused WhatsApp suite: 5 files passed, 89 tests passed.
  • Affected cleanup suite: 2 files passed, 40 tests passed.
  • Targeted Oxlint and git diff check passed.
  • Hosted changed gate passed production and test typechecks, full extension lint, SDK baseline, plugin boundaries, docs formatting, and runtime guards: https://github.com/openclaw/openclaw/actions/runs/29569431549
  • Final autoreview: no accepted or actionable findings. The final export cleanup received a separate clean commit review.
  • Direct Baileys 7.0.0-rc13 source inspection confirms groupFetchAllParticipating performs the live group IQ query and fireInitQueries disables automatic initialization queries.

The contributor's linked-account proof on the earlier standalone-socket implementation returned four Baileys group entries and matched the phone's three visible groups, with one Community represented by announcement and subgroup JIDs. Current-head transport behavior is covered with mocked Baileys sockets, as approved for this rewrite.

@openclaw-barnacle openclaw-barnacle Bot added channel: whatsapp-web Channel integration: whatsapp-web size: M proof: supplied External PR includes structured after-fix real behavior proof. labels Jun 17, 2026
@clawsweeper

clawsweeper Bot commented Jun 17, 2026 •

Copy link
Copy Markdown
Contributor

Codex review: needs real behavior proof before merge. Reviewed July 17, 2026, 3:41 AM ET / 07:41 UTC.

Summary
The PR registers WhatsApp listGroupsLive but implements it as a call to the existing config-backed group listing, with tests for that static behavior.

PR surface: Source +13, Tests +48. Total +61 across 3 files.

Reproducibility: yes. at source level: with an empty channels.whatsapp.groups map, both the ordinary and newly registered live methods resolve through the same config-backed helper and return no memberships. No current-head live execution was established.

Review metrics: 1 noteworthy metric.

  • Live discovery behavior: 0 live queries, 1 static alias added. The PR exposes a live adapter name without adding any provider or Gateway lookup, so the measured implementation does not address its stated behavior.

Root-cause cluster
Relationship: fixed_by_candidate
Canonical: #76722
Summary: This PR is the linked candidate fix for the canonical WhatsApp group-directory issue, but its current head does not yet implement the required live lookup.

Members:

Proposal only: this assessment does not dispatch repair, suppress jobs, mutate sibling items, close, or merge anything.

Merge readiness
Overall: 🧂 unranked krab
Proof: 🧂 unranked krab
Patch quality: 🦪 silver shellfish
Result: blocked until stronger real behavior proof is added.

Overall follows the weaker of proof and patch quality, so missing proof can cap an otherwise strong patch.

Rank-up moves:

  • [P1] After owner direction, implement the Gateway-owned lookup and provide redacted current-head CLI plus Gateway evidence showing configured-empty memberships are returned.

Proof guidance:

  • [P1] Needs stronger real behavior proof before merge: The live CLI output is from c65f61a12921b101b7407a9fdfc5d18607b33df4, before the current static-defer rewrite; add redacted final-head CLI output and Gateway-side diagnostic evidence after implementing the real query, then update the PR body to trigger review or ask a maintainer for @clawsweeper re-review.

Risk before merge

  • [P1] Merging this head would advertise a live directory capability while still returning only configured allowlist entries, leaving the reported setup failure unresolved and creating a misleading adapter contract.
  • [P1] The eventual implementation must query the gateway-owned authenticated WhatsApp session; reopening the same credential store from a standalone CLI process risks connection conflicts and credential-state races.

Maintainer options:

  1. Decide the mitigation before merge
    Add an authenticated generic Gateway directory query that executes WhatsApp group discovery through the Gateway-owned Baileys socket, retains config-backed results when the Gateway is unavailable, and proves both paths on the final head.
  2. Pause or close
    Do not merge this PR until maintainers decide whether the risk is worth taking.

Next step before merge

  • [P1] A WhatsApp and Gateway owner must select the authenticated cross-process directory seam before the contributor or an automated repair can safely complete this PR.

Maintainer decision needed

  • Question: Which authenticated Gateway-owned seam should the standalone directory CLI use to query live WhatsApp group memberships?
  • Rationale: The correct fix crosses a process and credential-ownership boundary; inventing a channel-specific socket or RPC without owner direction could conflict with the active Baileys session or create a parallel control-plane contract.
  • Likely owner: steipete — The history most strongly connects this person to both WhatsApp runtime ownership and the generic directory boundary.
  • Options:
    • Generic Gateway directory RPC (recommended): Add a channel-agnostic authenticated directory method that invokes the installed plugin's live adapter inside the Gateway and lets the CLI fall back to static data when unreachable.
    • WhatsApp plugin Gateway action: Expose a narrower WhatsApp-owned authenticated action for group discovery, accepting the extra channel-specific control-plane surface.
    • Pause this PR: Do not merge the static alias and leave the linked issue open until the intended Gateway query contract is designed.

Security
Cleared: The current diff does not open sockets, read credentials directly, change dependencies, or broaden permissions, so no concrete security or supply-chain regression is introduced.

Review findings

  • [P1] Implement the live lookup before registering it — extensions/whatsapp/src/directory-config.ts:50
Review details

Best possible solution:

Add an authenticated generic Gateway directory query that executes WhatsApp group discovery through the Gateway-owned Baileys socket, retains config-backed results when the Gateway is unavailable, and proves both paths on the final head.

Do we have a high-confidence way to reproduce the issue?

Yes at source level: with an empty channels.whatsapp.groups map, both the ordinary and newly registered live methods resolve through the same config-backed helper and return no memberships. No current-head live execution was established.

Is this the best way to solve the issue?

No. Registering a static helper as listGroupsLive neither fixes the reported behavior nor respects the Gateway's ownership of the active WhatsApp session; an authenticated Gateway query is the maintainable boundary.

Full review comments:

  • [P1] Implement the live lookup before registering it — extensions/whatsapp/src/directory-config.ts:50
    listGroupsLive currently calls the same config-backed helper as listGroups, so an account with real memberships and an empty groups map still receives []—the exact linked failure. The tests only confirm this static behavior, and the PR body's groupFetchAllParticipating() output is from an older head. Route this through the authenticated Gateway-owned WhatsApp session before exposing the live adapter.
    Confidence: 0.99

Overall correctness: patch is incorrect
Overall confidence: 0.99

AGENTS.md: found and applied where relevant.

Codex review notes: model internal, reasoning high; reviewed against 2b18ef742648.

Label changes

Label changes:

  • add rating: 🧂 unranked krab: Overall readiness is 🧂 unranked krab; proof is 🧂 unranked krab and patch quality is 🦪 silver shellfish.
  • remove rating: 🦪 silver shellfish: Current PR rating is rating: 🧂 unranked krab, so this older rating label is no longer current.

Label justifications:

  • P1: The linked WhatsApp workflow remains broken for users who need group JIDs to complete group setup, and the proposed fix currently cannot discover them.
  • rating: 🧂 unranked krab: Overall readiness is 🧂 unranked krab; proof is 🧂 unranked krab and patch quality is 🦪 silver shellfish.
  • status: 📣 needs proof: The PR needs real behavior proof before ClawSweeper can clear the contributor ask. Needs stronger real behavior proof before merge: The live CLI output is from c65f61a12921b101b7407a9fdfc5d18607b33df4, before the current static-defer rewrite; add redacted final-head CLI output and Gateway-side diagnostic evidence after implementing the real query, then update the PR body to trigger review or ask a maintainer for @clawsweeper re-review.
Evidence reviewed

PR surface:

Source +13, Tests +48. Total +61 across 3 files.

View PR surface stats
Area Files Added Removed Net
Source 2 13 0 +13
Tests 1 48 0 +48
Docs 0 0 0 0
Config 0 0 0 0
Generated 0 0 0 0
Other 0 0 0 0
Total 3 61 0 +61

What I checked:

Likely related people:

  • steipete: Repeatedly maintained the WhatsApp runtime boundary and the shared directory input behavior used by this adapter. (role: feature owner and recent area contributor; confidence: high; commits: 30a94dfd3b7c, 2e1979a600f7, 1246e2b; files: extensions/whatsapp/src/channel.ts, docs/concepts/architecture.md)
  • vincentkoc: Introduced the lazy-loaded WhatsApp channel directory seam and authored several adjacent runtime-boundary refactors. (role: directory-seam and runtime-boundary contributor; confidence: medium; commits: 2050ef2740df, 7d691a3, 79aa212; files: extensions/whatsapp/src/channel.ts, extensions/whatsapp/src/directory-config.ts)
What the crustacean ranks mean
  • 🦀 challenger crab: rare, exceptional readiness with strong proof, clean implementation, and convincing validation.
  • 🦞 diamond lobster: very strong readiness with only minor maintainer review expected.
  • 🐚 platinum hermit: good normal PR, likely mergeable with ordinary maintainer review.
  • 🦐 gold shrimp: useful signal, but proof or patch confidence is still limited.
  • 🦪 silver shellfish: thin signal; proof, validation, or implementation needs work.
  • 🧂 unranked krab: not merge-ready because proof is missing/unusable or there are serious correctness or safety concerns.
  • 🌊 off-meta tidepool: rating does not apply to this item.

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
  • ClawSweeper keeps one durable marker-backed review comment per issue or PR.
  • Re-runs edit this comment so the latest verdict, findings, and automation markers stay together instead of adding duplicate bot comments.
  • A fresh review can be triggered by eligible @clawsweeper re-review comments, exact-item GitHub events, scheduled/background review runs, or manual workflow dispatch.
  • PR/issue authors and users with repository write access can comment @clawsweeper re-review or @clawsweeper re-run on an open PR or issue to request a fresh review only.
  • Maintainers can also comment @clawsweeper review to request a fresh review only.
  • Fresh-review commands do not start repair, autofix, rebase, CI repair, or automerge.
  • Maintainer-only repair and merge flows require explicit commands such as @clawsweeper autofix, @clawsweeper automerge, @clawsweeper fix ci, or @clawsweeper address review.
  • Maintainers can comment @clawsweeper explain to ask for more context, or @clawsweeper stop to stop active automation.
Review history (4 earlier review cycles)
  • reviewed 2026-07-01T13:58:06.385Z sha c65f61a12921b101b7407a9fdfc5d18607b33df4 :: needs maintainer review before merge. :: none
  • reviewed 2026-07-16T05:13:48.971Z sha 78715be6428f6e4ba933f45d987ea03145b6a3b3 :: found issues before merge. :: [P1] Route live lookup through the gateway-owned session | [P2] Bound the standalone connection wait
  • reviewed 2026-07-16T05:57:13.111Z sha 78715be6428f6e4ba933f45d987ea03145b6a3b3 :: found issues before merge. :: [P1] Reuse the gateway socket instead of opening the session twice
  • reviewed 2026-07-17T07:21:05.107Z sha a83f024c422bd4f993e52c1dc80bf3201913e59b :: needs real behavior proof before merge. :: [P1] Route the CLI lookup across the gateway process boundary

@xialonglee
xialonglee force-pushed the fix/issue-76722-whatsapp-directory-groups-live branch from 10f5aa4 to 680b194 Compare June 17, 2026 10:43
@openclaw-barnacle openclaw-barnacle Bot added the channel: voice-call Channel integration: voice-call label Jun 17, 2026
@xialonglee

Copy link
Copy Markdown
Contributor Author

The checks-node-core-tooling failure is unrelated to this PR. It has 2 failing tests:

  1. test/plugin-clawhub-release.test.ts — rm: cannot remove '...': Directory not empty — ClawHub pack temp dir cleanup issue
  2. test/scripts/openclaw-cross-os-release-checks.test.ts — socket close timed out — socket timeout

Both are infrastructure/flaky issues in test/ — this PR only touches extensions/whatsapp/ and extensions/voice-call/ (4 files, +246 -5). Re-running the failed job should resolve it.

@clawsweeper clawsweeper Bot added rating: 🧂 unranked krab Not merge-ready due to missing proof or serious correctness/safety concerns. status: 📣 needs proof The PR needs real behavior proof before ClawSweeper can clear the contributor ask. P2 Normal backlog priority with limited blast radius. labels Jun 17, 2026
@xialonglee

Copy link
Copy Markdown
Contributor Author

@clawsweeper re-review

@clawsweeper

clawsweeper Bot commented Jun 19, 2026 •

Copy link
Copy Markdown
Contributor

🦞🧹
ClawSweeper re-review requested.

I asked ClawSweeper to review this item again.
Action: item re-review queued (workflow sweep.yml, event repository_dispatch).
Result: the existing ClawSweeper review comment will be edited in place when the review finishes.

@xialonglee
xialonglee force-pushed the fix/issue-76722-whatsapp-directory-groups-live branch from e7ac40e to 8cfdf2d Compare July 1, 2026 07:43
@openclaw-barnacle openclaw-barnacle Bot added triage: needs-pr-context Candidate: external PR body lacks required problem context or evidence. and removed channel: voice-call Channel integration: voice-call triage: needs-pr-context Candidate: external PR body lacks required problem context or evidence. labels Jul 1, 2026
@clawsweeper clawsweeper Bot added the merge-risk: 🚨 other 🚨 Merging this PR has meaningful risk outside the owned taxonomy. label Jul 1, 2026
@xialonglee
xialonglee force-pushed the fix/issue-76722-whatsapp-directory-groups-live branch from 8cfdf2d to b47b624 Compare July 1, 2026 11:10
@xialonglee

Copy link
Copy Markdown
Contributor Author

@clawsweeper re-review

@clawsweeper

clawsweeper Bot commented Jul 1, 2026 •

Copy link
Copy Markdown
Contributor

🦞🧹
ClawSweeper re-review requested.

I asked ClawSweeper to review this item again.
Action: item re-review queued (workflow sweep.yml, event repository_dispatch).
Result: the existing ClawSweeper review comment will be edited in place when the review finishes.

@clawsweeper clawsweeper Bot added proof: sufficient ClawSweeper judged the real behavior proof convincing. rating: 🦐 gold shrimp Decent PR readiness signal, but merge confidence is limited. status: ⏳ waiting on author ClawSweeper has contributor-facing work open and is waiting for author action. and removed rating: 🧂 unranked krab Not merge-ready due to missing proof or serious correctness/safety concerns. status: 📣 needs proof The PR needs real behavior proof before ClawSweeper can clear the contributor ask. merge-risk: 🚨 other 🚨 Merging this PR has meaningful risk outside the owned taxonomy. labels Jul 1, 2026
@xialonglee

Copy link
Copy Markdown
Contributor Author

@clawsweeper re-review

@clawsweeper

clawsweeper Bot commented Jul 1, 2026 •

Copy link
Copy Markdown
Contributor

🦞🧹
ClawSweeper re-review requested.

I asked ClawSweeper to review this item again.
Action: item re-review queued (workflow sweep.yml, event repository_dispatch).
Result: the existing ClawSweeper review comment will be edited in place when the review finishes.

@clawsweeper clawsweeper Bot removed the rating: 🦐 gold shrimp Decent PR readiness signal, but merge confidence is limited. label Jul 1, 2026
@clawsweeper clawsweeper Bot added rating: 🦪 silver shellfish Thin PR readiness signal; proof, validation, or implementation needs work. status: 📣 needs proof The PR needs real behavior proof before ClawSweeper can clear the contributor ask. P1 High-priority user-facing bug, regression, or broken workflow. and removed proof: sufficient ClawSweeper judged the real behavior proof convincing. rating: 🦐 gold shrimp Decent PR readiness signal, but merge confidence is limited. status: ⏳ waiting on author ClawSweeper has contributor-facing work open and is waiting for author action. P2 Normal backlog priority with limited blast radius. merge-risk: 🚨 session-state 🚨 May lose, corrupt, stale, or mis-associate session, agent, or context state. merge-risk: 🚨 security-boundary 🚨 May affect sandboxing, authorization, credentials, or sensitive data. merge-risk: 🚨 availability 🚨 May cause crashes, hangs, restart loops, stalls, or process outages. labels Jul 17, 2026
@xialonglee
xialonglee force-pushed the fix/issue-76722-whatsapp-directory-groups-live branch from a83f024 to 1f411a0 Compare July 17, 2026 07:35
@clawsweeper clawsweeper Bot added rating: 🧂 unranked krab Not merge-ready due to missing proof or serious correctness/safety concerns. and removed rating: 🦪 silver shellfish Thin PR readiness signal; proof, validation, or implementation needs work. labels Jul 17, 2026
@steipete steipete self-assigned this Jul 17, 2026
@steipete
steipete force-pushed the fix/issue-76722-whatsapp-directory-groups-live branch from 1f411a0 to 359ed2b Compare July 17, 2026 09:22
@openclaw-barnacle openclaw-barnacle Bot added docs Improvements or additions to documentation size: XL and removed size: S labels Jul 17, 2026
@steipete
steipete force-pushed the fix/issue-76722-whatsapp-directory-groups-live branch 3 times, most recently from b1f2c90 to b2d0f62 Compare July 17, 2026 09:37
@steipete steipete closed this Jul 17, 2026
@steipete
steipete force-pushed the fix/issue-76722-whatsapp-directory-groups-live branch from b2d0f62 to e0478e2 Compare July 17, 2026 09:43
@xialonglee
xialonglee deleted the fix/issue-76722-whatsapp-directory-groups-live branch July 17, 2026 09:47
@steipete

Copy link
Copy Markdown
Contributor

AI-assisted (approved by Peter)

This capability was relanded as #109886 with xialonglee / Peter Lee preserved as co-author.

The maintained implementation was reworked around safe socket and credential ownership: gateway lookups reuse the active owner-controlled Baileys socket; standalone CLI lookups acquire an exclusive owner lease, disable inbound processing, and await socket closure plus credential persistence before releasing ownership.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

channel: whatsapp-web Channel integration: whatsapp-web docs Improvements or additions to documentation P1 High-priority user-facing bug, regression, or broken workflow. proof: supplied External PR includes structured after-fix real behavior proof. rating: 🧂 unranked krab Not merge-ready due to missing proof or serious correctness/safety concerns. size: XS status: 📣 needs proof The PR needs real behavior proof before ClawSweeper can clear the contributor ask.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Bug: WhatsApp group directory returns empty even when account is member of groups

2 participants