Skip to content

fix(whatsapp): avoid mentions inside unterminated inline code - #129281

Merged
steipete merged 3 commits into
mainfrom
codex/qa-whatsapp-inline-mention-protection-20260825
Aug 25, 2026
Merged

steipete merged 3 commits into
mainfrom
codex/qa-whatsapp-inline-mention-protection-20260825

Conversation

@steipete

@steipete steipete commented Aug 25, 2026 •

Copy link
Copy Markdown
Contributor

What Problem This Solves

WhatsApp turns phone numbers inside unfinished Markdown inline code into native participant mentions, including when the inline code crosses a soft line break or uses multi-backtick delimiters containing embedded shorter backticks. Escaped literal backticks can also incorrectly suppress legitimate intended mentions.

Why This Change Was Made

The canonical Markdown code-span parser matches equal-length delimiter runs, protects unmatched inline delimiters through the end of the input, permits soft line breaks, and distinguishes escaped literal delimiters. WhatsApp's separate outbound mention scanner originally recognized only closed spans; intermediate fixes missed soft newlines and multi-backtick delimiter runs. The scanner now follows the canonical rules without adding a new Plugin SDK surface.

User Impact

Phone numbers inside unfinished single-line, multiline, or multi-backtick inline code remain literal instead of sending native WhatsApp mentions. Escaped literal backticks do not suppress legitimate native mentions. Ordinary intended mentions, balanced inline code, fenced code, and other outbound behavior remain unchanged.

Evidence

  • The ClawSweeper-identified multiline, delimiter-run, and escaped-literal owner/actual-Baileys regressions failed before their respective follow-up repairs; the final review pass adds seven authentic adversarial failures.
  • node scripts/run-vitest.mjs extensions/whatsapp/src/inbound/outbound-mentions.test.ts extensions/whatsapp/src/inbound/send-api.test.ts now passes all 73 tests.
  • The complete production formatter-to-fake-Baileys chain suppresses protected native mentions for multiline and multi-backtick code while preserving legitimate mentions after escaped literal backticks.
  • Focused type-aware lint, formatting, and both local-change and complete-branch independent structured reviews passed.
  • Production delta is net zero: one regular-expression line replaces one line.
  • The previously reported ClawSweeper blockers and all requested owner/transport delimiter-run regression cases are addressed at this head without expanding the public Plugin SDK.

@clawsweeper

clawsweeper Bot commented Aug 25, 2026

Copy link
Copy Markdown
Contributor

🦞👀
ClawSweeper picked this up.

Pull request received. I will update this pull request when review starts.

@openclaw-barnacle openclaw-barnacle Bot added channel: whatsapp-web Channel integration: whatsapp-web size: XS maintainer Maintainer-authored PR labels Aug 25, 2026
@clawsweeper clawsweeper Bot added merge-risk: 🚨 message-delivery 🚨 May drop, duplicate, misroute, suppress, or wrongly target messages. P2 Normal backlog priority with limited blast radius. 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. labels Aug 25, 2026
@clawsweeper

clawsweeper Bot commented Aug 25, 2026 •

Copy link
Copy Markdown
Contributor

Codex review: needs maintainer review before merge. Reviewed August 25, 2026, 10:11 AM ET / 14:11 UTC.

ClawSweeper review

What this changes

The PR makes WhatsApp outbound mention resolution ignore numeric mentions inside balanced or unterminated inline Markdown code, including multiline and multi-backtick spans.

Regression provenance

Possible regression — suspected (reviewed change). No predecessor PR is attributed.

Merge readiness

⚠️ Ready for maintainer review - 2 items remain

No blocking correctness finding. The branch repairs the current resolver’s closed-single-line-only inline-code masking and covers both resolver output and the send payload boundary; it remains active and maintainer-labeled.

Priority: P2
Reviewed head: 6382d1a2dbf4378630bcd0db7c993ff6d7aeaee2

Review scores

Measure Result What it means
Overall readiness 🐚 platinum hermit (4/6) A focused, net-neutral repair with resolver and payload-boundary regression coverage; exact-head validation remains the material merge check.
Proof confidence 🌊 off-meta tidepool Not applicable: This maintainer-authored PR is exempt from the external-contributor proof gate; its body nonetheless supplies focused mocked transport-boundary evidence.
Patch quality 🐚 platinum hermit (4/6) No actionable review findings were identified.

Verification

Check Result Evidence
Real behavior Not applicable Not applicable: This maintainer-authored PR is exempt from the external-contributor proof gate; its body nonetheless supplies focused mocked transport-boundary evidence.
Evidence reviewed 5 items Current-main defect: Current main uses a matcher that accepts only closed, non-newline single-backtick spans, so unterminated spans, soft line breaks, and delimiter runs are not excluded before native mention resolution.
Owner boundary and caller: The resolver builds code ranges before collecting mention metadata, and both direct replies and the web send API pass its result into the final WhatsApp payload.
Branch coverage: The changed tests cover unmatched single and multiline spans, equal-length delimiter runs containing shorter backticks, escaped literals, and the final mocked transport payload.
Findings None None.
Security None None.

Live Verification

Command: node scripts/run-vitest.mjs extensions/whatsapp/src/inbound/outbound-mentions.test.ts extensions/whatsapp/src/inbound/send-api.test.ts

Result: PASS (completed)

node scripts/run-vitest.mjs extensions/whatsapp/src/inbound/outbound-mentions.test.ts extensions/whatsapp/src/inbound/send-api.test.ts
runner@runnervm76f27:/tmp/clawsweeper-live-proof-129281-TXxpKJ/target$ node scripts/run-vitest.mjs extensions/whatsapp/src/inbound/outbound-mentions.test.ts ext
ensions/whatsapp/src/inbound/send-api.test.ts
node scripts/run-vitest.mjs extensions/whatsapp/src/inbound/outbound-mentions.test.ts extensions/whatsapp/src/inbound/send-api.test.ts
[test] starting test/vitest/vitest.extension-whatsapp.config.ts

 RUN  v4.1.10 /tmp/clawsweeper-live-proof-129281-TXxpKJ/target

 ✓  extension-whatsapp  extensions/whatsapp/src/inbound/outbound-mentions.test.ts (16 tests) 149ms










































Assertions:

  • PASS expect_output: outbound-mentions.test.ts

How this fits together

Outgoing WhatsApp text is formatted, resolved against group participants, and then sent with native mention metadata. The mention resolver decides which visible numeric tokens are rewritten and passed to the transport payload.

flowchart LR
A[Outgoing Markdown message] --> B[WhatsApp formatter]
B --> C[Mention resolver]
C --> D[Code-span exclusion]
D --> E[Native mention payload]
E --> F[WhatsApp transport]
Loading

Before merge

  • Resolve merge risk (P1) - This changes which numeric tokens become native WhatsApp mentions; an incorrect delimiter interpretation could suppress an intended ping or attach an unwanted one.
  • Complete next step (P2) - This is an active maintainer-owned implementation PR with no concrete repair finding for a separate automation lane.
Agent review details

Security

None.

PR surface

Source 0, Tests +68. Total +68 across 3 files.

View PR surface stats
Area Files Added Removed Net
Source 1 1 1 0
Tests 2 71 3 +68
Docs 0 0 0 0
Config 0 0 0 0
Generated 0 0 0 0
Other 0 0 0 0
Total 3 72 4 +68

Review metrics

Metric Value Why it matters
Production vs test LOC production +1/-1 (net 0); tests +71/-3 (net +68) The matcher replacement is net-neutral production code, while the added lines exercise resolver and payload behavior.

Merge-risk options

Maintainer options:

  1. Verify the payload boundary before merge (recommended)
    Run the focused resolver and send-payload regressions on the exact PR head to confirm protected and visible phone numbers produce the intended mention metadata.
  2. Accept the scoped delivery behavior
    Land with the existing focused cases only if maintainers accept the residual risk of unusual Markdown delimiters changing native mention targeting.
Copy recommended automerge instruction
@clawsweeper automerge

Special instructions:
Run the focused WhatsApp resolver and send-payload regressions on the current head.

Technical review

Best possible solution:

Keep the resolver-local delimiter-aware masking and its resolver-plus-payload regressions, then land only after exact-head validation is green.

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

Yes, source-reproducible: current main’s closed single-line matcher at extensions/whatsapp/src/inbound/outbound-mentions.ts:19 cannot protect the reported unterminated, multiline, or multi-backtick forms.

Is this the best way to solve the issue?

Yes. Updating the plugin-owned range decision before mention resolution is narrower and safer than compensating in the transport payload; the branch also tests that final boundary.

AGENTS.md: found and applied where relevant.

Codex review notes: model internal, reasoning high; reviewed against 47ba4ab30e8d.

Labels

Label changes:

  • add rating: 🐚 platinum hermit: Overall readiness is 🐚 platinum hermit; proof is 🌊 off-meta tidepool and patch quality is 🐚 platinum hermit.
  • add status: 👀 ready for maintainer look: ClawSweeper has no concrete contributor-facing blocker left for this PR. Not applicable: This maintainer-authored PR is exempt from the external-contributor proof gate; its body nonetheless supplies focused mocked transport-boundary evidence.
  • remove rating: 🦐 gold shrimp: Current PR rating is rating: 🐚 platinum hermit, so this older rating label is no longer current.
  • remove status: ⏳ waiting on author: Current PR status label is status: 👀 ready for maintainer look.

Label justifications:

  • P2: The PR changes a bounded WhatsApp group-message behavior without evidence of broad availability or security impact.
  • merge-risk: 🚨 message-delivery: The changed exclusion rule directly determines whether WhatsApp receives native mention metadata for outgoing group messages.
  • rating: 🐚 platinum hermit: Overall readiness is 🐚 platinum hermit; proof is 🌊 off-meta tidepool and patch quality is 🐚 platinum hermit.
  • status: 👀 ready for maintainer look: ClawSweeper has no concrete contributor-facing blocker left for this PR. Not applicable: This maintainer-authored PR is exempt from the external-contributor proof gate; its body nonetheless supplies focused mocked transport-boundary evidence.

Evidence

What I checked:

Likely related people:

  • steipete: Current-main blame and recent WhatsApp send-path history attribute the resolver area to Peter Steinberger; this PR continues that work. (role: recent area contributor; confidence: high; commits: 9f472253d49a, 6382d1a2dbf4; files: extensions/whatsapp/src/inbound/outbound-mentions.ts, extensions/whatsapp/src/inbound/send-api.ts)
  • BunsDev: The original native outbound mention feature commit records BunsDev as co-author and reviewer. (role: feature reviewer and co-author; confidence: medium; commits: 22748b1c363a; files: extensions/whatsapp/src/inbound/outbound-mentions.ts)

Rank-up moves

Optional improvements that raise the rating; they are not merge blockers.

  • Finish the focused exact-head validation before merge.

Rating scale

Score Internal tier Crab rank Meaning
6/6 S 🦀 challenger crab Exceptional readiness
5/6 A 🦞 diamond lobster Very strong readiness
4/6 B 🐚 platinum hermit Good normal PR; ordinary maintainer review
3/6 C 🦐 gold shrimp Useful, but confidence is limited
2/6 D 🦪 silver shellfish Proof or implementation needs work
1/6 F 🧂 unranked krab Not merge-ready
N/A NA 🌊 off-meta tidepool Rating does not apply

Overall follows the weaker of proof and patch quality.
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.

Workflow

  • 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.

History

Review history (4 earlier review cycles)
  • reviewed 2026-08-25T11:43:24.187Z sha 44a710b :: found issues before merge. :: [P2] Protect unterminated inline code across soft line breaks
  • reviewed 2026-08-25T12:22:27.502Z sha 44a710b :: needs changes before merge. :: [P2] Protect unterminated inline code across soft line breaks
  • reviewed 2026-08-25T12:55:03.632Z sha 44a710b :: found issues before merge. :: [P2] Handle soft line breaks in unterminated inline code
  • reviewed 2026-08-25T13:36:29.584Z sha 228234e :: found issues before merge. :: [P2] Honor backtick-run delimiters

@clawsweeper clawsweeper Bot added rating: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. status: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR. and removed 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. labels Aug 25, 2026
@steipete
steipete force-pushed the codex/qa-whatsapp-inline-mention-protection-20260825 branch from 6382d1a to 572bda9 Compare August 25, 2026 14:59
@steipete
steipete merged commit d53ea9c into main Aug 25, 2026
101 checks passed
@steipete
steipete deleted the codex/qa-whatsapp-inline-mention-protection-20260825 branch August 25, 2026 15:15
@steipete

Copy link
Copy Markdown
Contributor Author

Merged via squash.

github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Aug 26, 2026
…aw#129281)

* fix(whatsapp): avoid mentions inside unterminated inline code

* fix(whatsapp): protect mentions across soft code line breaks

* fix(whatsapp): honor escaped multiline code delimiter runs
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 maintainer Maintainer-authored PR merge-risk: 🚨 message-delivery 🚨 May drop, duplicate, misroute, suppress, or wrongly target messages. P2 Normal backlog priority with limited blast radius. rating: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. size: S status: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant