Repository navigation
fix(matrix): bot ignores valid plain-text room mentions - #117764
Conversation
|
Codex review: needs maintainer review before merge. Reviewed August 2, 2026, 1:14 AM ET / 05:14 UTC. ClawSweeper reviewWhat this changesThe PR lets Matrix room messages with exact native Merge readinessThis PR is still necessary: current Priority: P1 Review scores
Verification
How this fits togetherThe Matrix plugin converts incoming room events into an agent-session decision. Its mention resolver combines native Matrix metadata with visible message content before the room handler decides whether a group message may invoke the bot. flowchart LR
A[Matrix room event] --> B[Native mention metadata]
A --> C[Visible plain text or HTML]
B --> D[Mention resolver]
C --> D
D --> E[Group-message invocation decision]
E --> F[Agent session and bot reply]
Decision needed
Why: The patch is source-backed and proof-positive, but the protected Before merge
Agent review detailsSecurityNone. PR surfaceSource +16, Tests +311. Total +327 across 3 files. View PR surface stats
Review metricsNone. Merge-risk optionsMaintainer options:
Technical reviewBest possible solution: Merge the narrow resolver change after Matrix ownership review confirms the protected delivery and spoofing boundary, preserving exact Do we have a high-confidence way to reproduce the issue? Yes—source establishes the current-main path: exact native metadata plus a visible plain Is this the best way to solve the issue? Yes. The resolver owns the combined metadata-and-visibility decision, and this patch extends that canonical check instead of adding a handler-side exception or trusting metadata alone. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning high; reviewed against ceb8a8b3a198. LabelsLabel changes:
Label justifications:
EvidenceWhat I checked:
Likely related people:
Rating scale
Overall follows the weaker of proof and patch quality. Workflow
HistoryReview history (3 earlier review cycles)
|
|
Maintainer security decision and exact-head runtime proof for 4da7051: historical Matrix localparts can legally contain punctuation and Unicode, so bare shorthand now starts only at message start or Unicode White_Space and ends only at message end, Unicode White_Space, or colon followed by Unicode White_Space. Ambiguous punctuation/Markdown shorthand is intentionally rejected; exact native mention ownership and exact full Matrix IDs remain supported. A real pinned Tuwunel homeserver plus a real ephemeral Gateway and mock provider received visible bare @localpart with exact m.mentions.user_ids and no format/formatted_body, producing exactly one actual bot reply; punctuation-suffixed account spoof produced no reply. Sanitized marker MATRIX_NATIVE_PLAIN_11683285; driver event $L3aY-KXDcRzAVlPtFefKSYFJ-06k4Y8SwQNWAdDJWiQ; reply event $1YzUjLudcA34PYioLn3zn2lyowVulJVNBj_wdOWnKdo; spoof event $oL9jZztCXID144DyrXTtx5hLYtkilA9ThxFJI2a00Rc. Live proof https://github.com/openclaw/openclaw/actions/runs/30731236764. All 347 owner/handler tests and the exact-three-path changed gate passed on the frozen source: https://github.com/openclaw/openclaw/actions/runs/30731633656. Independent adversarial security review and fresh committed-branch P0/P1 structured review found no issues; TruffleHog clean; all remote leases stopped. |
|
Final exact-head proof and previous P1 resolution: bb0004e adds the safe full-MXID colon+Unicode-whitespace command separator without weakening shorthand or spoof boundaries. Genuine pinned Tuwunel homeserver + real Gateway + mock provider exercised actual plaintext native Matrix events with NO HTML: bare @localpart => exactly one reply $EfoR4xEghoo00SeaurTkfY4JeVf2COdbVp3kMKW1eR0; exact full @bot:server followed colon+U+2003 => exactly one reply $1YHyHLrY06cuiiRgisfXBeW8YpjiqxMhP5NztrKGEOQ; punctuation/account spoof => no reply, event $y9LLqwl0AxcHAtgD5I35CypGrdP7Jkv3pP7c5kB5tp0. Live evidence https://github.com/openclaw/openclaw/actions/runs/30733079526. Expanded actual resolver+room-handler suites 364/364 and complete exact-three-file gate pass: https://github.com/openclaw/openclaw/actions/runs/30733197734. 762 independent security probes, clean full-branch P0/P1 review, clean TruffleHog, and both leases independently completed. PR body now contains full inspectable exact-head evidence. |
|
Explicit Matrix owner/maintainer security-boundary decision for exact head bb0004e: ACCEPT the deliberately strict native plain-text grammar. Invocation requires both exact trusted m.mentions user ownership and a visible exact full Matrix ID or safely bounded bare localpart; shorthand punctuation/Markdown/account continuations remain intentionally unsupported, full-ID colon plus genuine Unicode whitespace is permitted, and hostile Unicode/invisible controls, room aliases, alternate accounts/domains/ports, and metadata-only spoofing remain denied. The exact-head real Tuwunel/Gateway positive+negative events, 364 owner/handler tests, full remote gate, adversarial security reviews, latest 5/6 ClawSweeper proof-sufficient/no-findings verdict, and green hosted required openclaw/ci-gate satisfy both message-delivery and security-boundary merge risks. As the owning maintainer I approve this exact protected-boundary change for native landing. |
|
Merged via squash.
|
What Problem This Solves
Fixes an issue where Matrix operators mentioning their bot with native m.mentions metadata and visible plain text would receive no reply when the message had no HTML formatting and no custom mention patterns.
Why This Change Was Made
Recognize a visible exact Matrix account ID or safely bounded localpart only when native mention metadata names the exact bot account. Preserve HTML mentions, custom patterns, homeserver and port identity, and defenses against forged metadata or invisible Unicode separators.
User Impact
Bots now respond to legitimate plain-text room mentions with default settings while rejecting spoofed cross-server and hidden mentions.
Evidence
Final exact-head live Matrix proof: bb0004e
bb0004e48bf05cc971327076816e7fd09484fb10.m.mentions.user_ids: exactly one bot reply$EfoR4xEghoo00SeaurTkfY4JeVf2COdbVp3kMKW1eR0, markerMATRIX_NATIVE_PLAIN_C60D26C8.$1YHyHLrY06cuiiRgisfXBeW8YpjiqxMhP5NztrKGEOQ, markerMATRIX_FULL_MXID_C60D26C8.$y9LLqwl0AxcHAtgD5I35CypGrdP7Jkv3pP7c5kB5tp0.