Skip to content

fix(whatsapp): render CommonMark italic correctly - #113010

Merged
steipete merged 1 commit into
mainfrom
codex/unify-p2-whatsapp
Jul 23, 2026
Merged

steipete merged 1 commit into
mainfrom
codex/unify-p2-whatsapp

Conversation

@steipete

@steipete steipete commented Jul 23, 2026 •

Copy link
Copy Markdown
Contributor

What Problem This Solves

Fixes an issue where CommonMark italic such as *text* was sent unchanged and rendered as bold in WhatsApp. The old regex converter also leaked unsupported syntax such as heading markers, labeled-link syntax, spoiler/underline markup, and fenced-code language identifiers.

Why This Change Was Made

WhatsApp now declares a static FormatCapabilityProfile and uses the shared Markdown IR renderer plus fallback engine for both direct sends and auto-replies. The old regex/placeholder converter and separate table pre-pass are removed; transport-owned mentions, media envelopes, indentation, chunk modes, and provider calls remain local. Formatting-aware chunking closes and reopens markers at boundaries and re-chunks after render expansion before the provider send.

This is AI-assisted work commissioned as part of the maintainer-directed Markdown-unification wave.

User Impact

WhatsApp users now get the intended platform dialect consistently:

  • *italic* -> _italic_ instead of WhatsApp bold
  • <u>under</u> -> under; ||secret|| -> secret
  • [docs](https://example.com) -> docs (https://example.com)
  • # Title -> *Title*
  • - one -> • one; - [x] done -> [x] done
  • fenced ts/other language identifiers are removed while code remains monospace
  • inline code uses WhatsApp triple-backtick monospace markers
  • image Markdown falls back to its alt text
  • configured table modes (off, bullets, code, block) still apply through the shared parse

Authored escapes, leading indentation, trailing newlines, newline-mode paragraph packing, private-use Unicode, and chunk-size limits remain preserved.

Evidence

Golden before/after coverage enumerates every declared construct, including the italic regression, code-language fallback, links, headings, lists/tasks, tables, blockquotes, images, mentions, escapes, indentation, and chunk boundaries.

  • node scripts/run-vitest.mjs extensions/whatsapp/src/text-runtime.test.ts extensions/whatsapp/src/send.test.ts extensions/whatsapp/src/auto-reply/deliver-reply.test.ts extensions/whatsapp/src/outbound-adapter.sendpayload.test.ts — 4 files, 147 tests passed after the final rebase.
  • Source-blind behavior contract — 13/13, then final 7/7 targeted rerun passed.
  • node scripts/check-changed.mjs -- extensions/whatsapp/src/targets-runtime.ts extensions/whatsapp/src/text-runtime.ts extensions/whatsapp/src/text-runtime.test.ts extensions/whatsapp/src/send.ts extensions/whatsapp/src/send.test.ts extensions/whatsapp/src/auto-reply/deliver-reply.ts — Blacksmith Testbox tbx_01ky79tkrz7d0xhfc94xpqn5y4, run https://github.com/openclaw/openclaw/actions/runs/30001121124, all selected formatting, typecheck, lint, boundary, ratchet, and import-cycle gates passed.
  • .agents/skills/autoreview/scripts/autoreview --mode uncommitted --stream-engine-output — accepted findings were fixed (IR-before-render chunking, indentation/trailing-byte preservation, escaped-marker safety, newline-mode parity, whitespace limiting, guard sizing, and direct-send re-chunking). The final repeated claim that only voice-note overflow was drained was rejected after verifying the common trailingTextChunks loop and the multi-provider-call regression test.
  • ClawSweeper produced no Rank-up moves: the initial exact-head lease and one explicit re-review lease both expired with only review started placeholders. After backoff, the status runbook still reported zero completed reviews in the prior hour and about 2,030 pending exact reviews while repair/reconcile workflows ran. There were therefore no moves to apply; this infrastructure gap is recorded here rather than bypassed silently.
  • git diff --check origin/main...HEAD — passed.

LOC: total +455/-110; production +226/-65; tests +229/-45. Production LOC grows because this channel now owns an explicit capability profile plus safe IR-aware transport chunking and byte-preservation guards, replacing the smaller but incorrect regex path and eliminating the separate table conversion path.

@openclaw-barnacle openclaw-barnacle Bot added channel: whatsapp-web Channel integration: whatsapp-web size: L maintainer Maintainer-authored PR labels Jul 23, 2026
@steipete steipete self-assigned this Jul 23, 2026
@steipete
steipete marked this pull request as ready for review July 23, 2026 11:05
@steipete

Copy link
Copy Markdown
Contributor Author

@clawsweeper re-review

The prior exact-head review lease expired while the PR comment remained at review started. Please review current head cafa256d022cf3083f0e18c13ef723a23d0afb7d.

@clawsweeper

clawsweeper Bot commented Jul 23, 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.

Re-review progress:

@steipete
steipete merged commit 245795c into main Jul 23, 2026
189 of 193 checks passed
@steipete
steipete deleted the codex/unify-p2-whatsapp branch July 23, 2026 12:54
@steipete

Copy link
Copy Markdown
Contributor Author

Merged via squash.

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 size: L

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant