Skip to content

fix(chat): render item comments in chat like the person's own messages - #51546

Merged
Jinwoo-H merged 1 commit into
mainfrom
item-comment-chat-markdown
Nov 28, 2026
Merged

Jinwoo-H merged 1 commit into
mainfrom
item-comment-chat-markdown

Conversation

@Jinwoo-H

@Jinwoo-H Jinwoo-H commented Nov 28, 2026 •

Copy link
Copy Markdown
Contributor

ELI5

When you comment on an item, the comment also shows up in the chat as your message with the item's name on top. That message showed exactly what you typed, symbols and all: a mention you picked from the @ menu showed as [Name](…:id), and **bold** or `code` stayed as raw characters. Now it looks like any other message you send in chat: mentions are chips, and bold, code and links are formatted.

Files Added Deleted Net
Test 1 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​42 0 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​42
Prod 3 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​68 $\color{#cf222e}{\Huge{\mathbf{−}}}$​41 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​27

What Changed

  • Before: an item comment in chat printed its text as plain, pre-wrapped text. Mentions, bold, code, links and lists all showed raw. The same comment already rendered correctly on the item's own page.
  • After: the comment's text renders exactly like the person's own chat messages. That covers mention chips (including room member @Names), Markdown, the long-message fold ("Show full message"), and long-link wrapping.
  • Mechanism:
    • The user message bubble's body (the fold, text attachments and chat Markdown) moves out of NativeChatUserMessageRow into one component, NativeChatUserMessageBody.
    • Chat's user messages and the item comment row both render through it.
    • The comment row's own text <div> goes away, along with the one-off wrapping and kerning patch from fix(native-chat): wrap long URLs in item comment bubbles instead of widening the chat #47998. The shared fold already applies both rules.

Why

The comment row had its own text renderer, separate from the user message bubble, so it never picked up chat's mention renderer or Markdown. Mentions became reachable there once the item comment box got the composer's @ picker (#46570). Sharing the real bubble body fixes it at the source, and it removes the second copy rather than teaching that copy about mentions.

Linked Issue

N/A (internal report)

Visual Proof

After, on a dev build: a comment with a picked mention, bold, code and a file path, plus a very long link that wraps inside the bubble with no sideways scroll. Before, the first bubble showed the mention as its raw link token and the bold and code as raw characters.

fixed.png

Testing

  • I manually tested these changes locally (macOS dev build with an isolated profile: posted a comment from an item's composer with a picked mention, bold, code and a file path, and a second comment with a 200-character link; checked there are no horizontal scrollers)
  • Automated tests added/updated, or explained why not below
  • Every added test fails without this change and avoids the test anti-patterns

The new test renders a real item comment note with a picked mention token, a room member @Maya and **bold**, and checks for two mention chips and a <strong>. With the old plain-text <div> restored it fails (expected [] to deeply equal ['@Layout owner', '@Maya']).

Performance

None worth measuring, because an item comment in chat now renders with the same memoized Markdown pipeline every user message in the chat already uses. It runs once per comment row, not on any hot path.

Risk

The riskiest part is how the item comment bubble looks. Comments are now Markdown, so a single newline joins lines the way it does in a chat message, and very long comments fold behind "Show full message". Chat's user messages render the same component they did before, so they don't change. Back out with a plain revert.

Level: Low

Notes

Rendering only, in the desktop renderer. Mobile already renders this comment as Markdown, and SSH, saved data and platforms are unaffected.

An item comment shown in chat printed its text raw, so picked mentions,
bold, code and links showed as Markdown source. Pull the user message
bubble's body into NativeChatUserMessageBody and render both through it.
@coderabbitai

coderabbitai Bot commented Nov 28, 2026

Copy link
Copy Markdown
Contributor

Explain Change →

No actionable comments were generated in the recent review.

Walkthrough

Adds NativeChatUserMessageBody to render folded message text, attachments, and Markdown. NativeChatUserMessageRow and bot-item note comments use the shared component. Bot-item comments receive a message ID derived from the note ID and item UID. A test checks mention chips and Markdown rendering in an owner-authored note.

Merge Risk: Minimal · up to 3ed0c

Item comments now render through the same body component as chat messages, so they get mention chips, Markdown formatting and long-message folding. No concrete regression has been identified, and the change is low risk to merge.

Pre-merge checks: Passed 4

Check name Status Explanation
Title check Passed The title names the main change: item comments in chat now render through the same body component as the person's own chat messages. It uses a conventional fix(chat) prefix and is one clear sentence. …
Description check Passed The description follows the repository template. It covers ELI5, What Changed, Why, Linked Issue (marked N/A as an internal report), Visual Proof with before/after context and an image, Testing with c…
Linked Issues check Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check Passed Check skipped because no linked issues were found for this pull request.
Full details: Title check

Explanation

The title names the main change: item comments in chat now render through the same body component as the person's own chat messages. It uses a conventional fix(chat) prefix and is one clear sentence. The title does not mention the test or the extracted NativeChatUserMessageBody component, which is expected for a title.

Full details: Description check

Explanation

The description follows the repository template. It covers ELI5, What Changed, Why, Linked Issue (marked N/A as an internal report), Visual Proof with before/after context and an image, Testing with checked items and a test-failure note, Performance with a reason, Risk with a level and revert method, and Notes. Some template items are not addressed: the Review section, the Agent skill upstream boundary checkbox, the AI Disclosure section, and the Checklist are not filled in. The Visual Proof is a single after image with a before description in text, not a switchable before/after pair. Linked Issue is N/A rather than a link, and the template says there should always be one for outside contributors. The author is likely an internal contributor, so this is a minor gap.

Resolution

Optionally, add a switchable before/after visual, complete the Agent skill upstream boundary checkbox and Checklist, and confirm whether an issue link applies.

  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

Share

Recent review info

Run configuration

  • Source mode: Auto
  • Repository: Unavailable
  • Branch: Unavailable
  • File: No configuration file from this repository applied
  • Commit: Unavailable
  • Layers: Repository UI
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: 141c402e-52fc-4426-b1f4-48a6389f0824
Commits

Reviewing files that changed from the base of the PR and between 7ceeb8f and 3ed0c06.

Files selected for processing: 4

  • src/renderer/src/components/native-chat/bot-items/NativeChatBotItemNoteRow.test.tsx
  • src/renderer/src/components/native-chat/bot-items/NativeChatBotItemNoteRow.tsx
  • src/renderer/src/components/native-chat/messages/rows/NativeChatUserMessageBody.tsx
  • src/renderer/src/components/native-chat/messages/rows/NativeChatUserMessageRow.tsx

Included review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 8 remain after this review.

@Jinwoo-H
Jinwoo-H merged commit 14f920a into main Nov 28, 2026
54 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant