Repository navigation
fix(matrix): preserve escaped characters, links, and image labels - #128382
Conversation
|
🦞👀 Pull request received. I will update this pull request when review starts. |
|
Codex review: needs maintainer review before merge. Reviewed August 23, 2026, 6:48 PM ET / 22:48 UTC. ClawSweeper reviewWhat this changesThe PR replaces a fixed escaped-mention marker in Matrix Markdown rendering with a per-message collision-free marker, preserves link metadata, and renders special image-label text safely. Regression provenancePossible regression — suspected (reviewed change). No predecessor PR is attributed. Merge readinessNo source-backed blocking defect was found. Keep this protected maintainer PR open for a final dependency-contract check and normal maintainer landing review. Priority: P2 Review scores
Verification
Live VerificationCommand: Result: PASS (completed) Assertions:
How this fits togetherThe Matrix extension converts Markdown into Matrix-safe HTML and mention metadata before sending room events. Its formatter must preserve literal user text while distinguishing escaped mentions, links, and image fallback labels. flowchart LR
A[Markdown message] --> B[Escaped mention masking]
B --> C[Markdown token parsing]
C --> D[Matrix HTML rendering]
D --> E[Matrix room event]
C --> F[Link and image metadata]
F --> D
Decision needed
Why: The relevant dependency source was unavailable locally and external source lookup failed, so repository policy requires a maintainer-visible contract check before a merge recommendation. Before merge
Agent review detailsSecurityNone. PR surfaceSource +16, Tests +81. Total +97 across 2 files. View PR surface stats
Review metrics
Merge-risk optionsMaintainer options:
Technical reviewBest possible solution: Land this focused formatter repair after directly checking the pinned markdown-it 14.3.0 renderer contract and exact-head validation; retain the shared Matrix private-marker allocator as the sole collision owner. Do we have a high-confidence way to reproduce the issue? Yes. Current main’s fixed sentinel at Is this the best way to solve the issue? Yes, with one dependency-proof gap. Reusing the Matrix marker allocator and metadata-range owner is preferable to another fixed placeholder or a downstream rendering workaround. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning high; reviewed against ca0af9c96030. LabelsLabel justifications:
EvidenceWhat I checked:
Likely related people:
Rank-up movesOptional improvements that raise the rating; they are not merge blockers.
Rating scale
Overall follows the weaker of proof and patch quality. Workflow
HistoryReview history (1 earlier review cycle)
|
|
Merged via squash.
|
What Problem This Solves
Fixes an issue where Matrix users sending messages with private-use Unicode characters, escaped mentions, links, or image fallback labels would see corrupted text, broken destinations, leaked formatting markers, or
<>instead of the intended characters.Three symptoms shared the same Markdown token-ownership boundary:
@.<>because special text tokens had no renderer.Why This Change Was Made
The Matrix formatter now lazily reserves a collision-free marker using its existing private-marker owner, keeps Markdown link metadata outside mention masking, restores owned markers in nested tokens, and HTML-escapes special image-label text through the normal renderer. The change stays within private Matrix formatting; mention notification policy, authorization, public interfaces, configuration, and persistence do not change.
The production delta is +16 lines because marker ownership must follow each individual message through ordinary text, block code, links, and nested image tokens; this replaces the unsafe global marker and reuses the existing collision-aware allocator and Markdown metadata-range owner instead of adding parallel formatting paths.
User Impact
Matrix messages preserve their actual characters, escaped mentions remain visible without triggering notifications, link destinations stay intact, and image fallback labels display decoded entities and escaped punctuation correctly.
Examples verified against the real production renderer:
@.@roominstead of exposing a private formatting marker.@keeps its/@alicedestination instead of being rewritten to a percent-encoded marker.A, private-use entities, or\*literalrender asA, the intended Unicode character, or*literalinstead of<>.Evidence
e39fa7ae429d32536481d2b50cb0decfa2bc7289.main; there are zero Matrix diagnostics.