Skip to content

fix(native-chat): wrap long URLs in item comment bubbles instead of widening the chat - #47998

Merged
nwparker merged 1 commit into
stablyai:mainfrom
tech-hoon:fix/item-comment-long-url-wrap
Nov 24, 2026
Merged

nwparker merged 1 commit into
stablyai:mainfrom
tech-hoon:fix/item-comment-long-url-wrap

Conversation

@tech-hoon

@tech-hoon tech-hoon commented Nov 24, 2026 •

Copy link
Copy Markdown
Contributor

ELI5

When you reply on a bot item, the reply shows up in the bot chat as your message bubble with the item's name on top. If the reply had a very long link with no spaces, the chat kept the whole link on one line, so it ran past the bubble and the chat got a sideways scrollbar. Now the link wraps onto several lines inside the bubble, the way it already does in a normal message, and even a huge unbroken reply stays fast to draw.

What Changed

  • Before: the text of an item comment (CommentRow in NativeChatBotItemNoteRow.tsx) never broke inside a long token. A long URL ran past the bubble's right edge and the transcript scrolled sideways (848px of horizontal overflow at a 420px pane, 928px at 320px).
  • After: the text wraps inside the bubble and the transcript has no horizontal overflow. Text with normal spaces and CJK text wrap as before.
  • Mechanism:
    • The comment text div was whitespace-pre-wrap with the default overflow-wrap: normal, so an unbroken token set its min-content width, which passed up through the transcript's flex ancestors. It now has [overflow-wrap:anywhere], the same utility markdown links, NativeChatEventRow bodies and background task summaries (fix(native-chat): wrap long background task summaries instead of widening the chat #47359) use.
    • Wrapping a long kerned run with no break opportunity makes Chromium reshape it at every wrap point, which is quadratic in its length. The div now reuses the unkerned-run helper from fix(native-chat): keep a huge unbroken paste from freezing the chat (#32355) #36031 (nativeChatTextHasUnkernedRun / NATIVE_CHAT_UNKERNED_CSS), memoized per text, the same way user prompts and queued messages already do. Only text that contains such a run gets font-kerning: none.

Why

This fixes the element that causes the overflow and nothing else. break-words would not work, because overflow-wrap: break-word does not lower min-content. overflow-x: hidden on the scroller would hide the scrollbar but clip the text, and adding min-w-0 up the ancestor chain would touch many components to fix one leaf. Reusing the existing unkerned-run helper keeps the wrap from turning a pathological comment into a long layout stall.

Linked Issue

Fixes #47995

Visual Proof

Headless component fixture (pnpm fixtures:shot) rendering owner item comments: short, sentence, URL with text, long item title + URL, multi-line with indent. The top bar reports the transcript scroller's horizontal overflow.

320px, dark

Before (main) After
before 320 dark after 320 dark

420px, light

Before (main) After
before 420 light after 420 light

Testing

  • I manually tested these changes locally

  • Automated tests added/updated, or explained why not below

  • Every added test fails without this change and avoids the test anti-patterns

  • Reproduced on origin/main with a scratch fixture (not committed) and compared with this branch: long URL comment overflowX 928px / 848px (320px / 420px pane) on main, 0px on this branch. 'q' x 6000 and 'q' x 30000 comments also 0px.

  • All 14 existing NativeChatBotItemNoteRow fixture shots (7 fixtures, dark and light) are byte-identical (cmp) before and after.

  • No unit test: the change is one class plus one inline style on a text div, and the test guidance says not to assert CSS. The fixture measurements are the evidence.

  • oxlint, oxfmt --check, anti-slop, code-quality native plugins, ast-grep, and the changed-code quality gate: clean.

  • macOS, headless fixture renderer. Renderer CSS only; platform, SSH and remote setups are not involved.

Performance

Renderer transcript row layout only; no new I/O, IPC, polling or subprocesses. Headless fixture, one owner comment at 420px, median of 9 forced layouts (remount / resize):

comment text main wrap only this PR
typical sentence 0.1 / 0.0 ms 0.1 / 0.0 ms 0.1 / 0.0 ms
~370-char URL 0.1 / 0.0 ms (overflowX 848px) 0.1 / 0.0 ms 0.1 / 0.0 ms
'q' x 6000 0.3 / 0.0 ms (overflowX 49814px) ~39 / ~38 ms 0.3 / 0.1 ms
'q' x 30000 1.1 / 0.0 ms (overflowX 250214px) ~970 / ~970 ms 1.4-1.5 / 0.5-0.6 ms

Main's resize is ~0 because unwrapped text overflows instead of reflowing; it pays with a horizontal scrollbar. The helper is a linear scan memoized per comment text: 0.6 us typical, 0.12 ms for 30 KB.

Risk

Level: Low

Only the item comment text in bot chats changes. The riskiest part is text that previously overflowed now wrapping, which makes those rows taller; the transcript measures real row heights, so virtualization is unaffected. Comments with a long unbroken run render without kerning (barely visible, same as user prompts). Back out with a plain revert.

Review

Agent skill upstream boundary

  • Not applicable, or this change copies or mechanically translates no upstream skill-installer source, tests, fixtures, registry entries, path tables, comments, or documentation.

Notes

Original fix by @tech-hoon in #47998 (the overflow-wrap change); a maintainer added the unkerned-run perf fix on top. Authorship is kept via Co-authored-by.

Checklist

  • This PR is small and focused
  • I explained what changed and why (ELI5, the user-facing before/after, the mechanism, and why over the alternatives)
  • I stated the risk: what could break, for whom, and how to back it out
  • Before/after screenshots or videos attached for UI changes, or N/A with reason
  • Self-reviewed for correctness, security, and performance
  • Cross-platform, SSH/remote, and path/shortcut impact considered (or N/A)
  • pnpm lint, pnpm typecheck, pnpm test, and pnpm build pass (or CI will cover; local preferred)

@coderabbitai

coderabbitai Bot commented Nov 24, 2026 •

Copy link
Copy Markdown
Contributor

Explain Change →

No actionable comments were generated in the recent review.

Walkthrough

The item comment text container now allows long unbroken text, such as URLs, to wrap. It retains pre-wrapped whitespace. Empty or whitespace-only comment text remains omitted.

Severity of issue fixed: Medium

Merge Risk: Minimal · up to a5dcd

This change lets long unbroken URLs in item comments wrap inside the bubble instead of widening the transcript. It is a small CSS-level change with a low chance of user-visible harm, and I found nothing that blocks merging.

Pre-merge checks: Passed 3 · Inconclusive 1

Failed Failed checks: 1 inconclusive

Check name Status Explanation Resolution
Out of Scope Changes check Inconclusive The PR description states one change: the [overflow-wrap:anywhere] class on the comment text div. The head file supports that change, which directly implements #47995. However, the AI-generated raw … Provide the base-to-head diff for NativeChatBotItemNoteRow.tsx, or confirm that the unkerned-run logic (nativeChatTextHasUnkernedRun, NATIVE_CHAT_UNKERNED_CSS) exists at the merge base. If it is new in this PR, the author should explain…
Passed Passed checks: 3 passed

Check name Status Explanation
Title check Passed The title names the change and its scope: it wraps long URLs in item comment bubbles so the chat does not widen. This matches the raw summary, which describes applying overflow wrapping to the comment…
Description check Passed The description follows the repository template closely. It has ELI5, What Changed, Why, Linked Issue (Fixes #47995), Visual Proof with before and after images, Testing with checked items, Performance…
Linked Issues check Passed [#47995] requires a long unbroken URL in an item-comment bubble to wrap inside the bubble, as it does in a plain prompt, with no transcript horizontal scrollbar. At head, CommentRow in NativeChatBotIt…
Full details: Title check

Explanation

The title names the change and its scope: it wraps long URLs in item comment bubbles so the chat does not widen. This matches the raw summary, which describes applying overflow wrapping to the comment container in NativeChatBotItemNoteRow. The title uses the conventional fix(scope) prefix and is specific. It is 85 characters, which is slightly over a typical short-title length but still readable.

Full details: Description check

Explanation

The description follows the repository template closely. It has ELI5, What Changed, Why, Linked Issue (Fixes #47995), Visual Proof with before and after images, Testing with checked items, Performance, Risk with level Low and a revert path, AI Disclosure, Review, the upstream boundary checkbox, Notes, and Checklist. It explains the mechanism (overflow-wrap and min-content width) and why alternatives were rejected. The main gap is that the Visual Proof images are headless fixture renders, not a live app capture, which the template allows. The Linked Issue format is correct. Overall the description is mostly complete.

Full details: Linked Issues check

Explanation

[#47995] requires a long unbroken URL in an item-comment bubble to wrap inside the bubble, as it does in a plain prompt, with no transcript horizontal scrollbar. At head, CommentRow in NativeChatBotItemNoteRow.tsx renders the comment text in <div className="whitespace-pre-wrap [overflow-wrap:anywhere]"> inside NativeChatUserBubble. The utility lets the unbroken token wrap, which lowers the element's min-content width and stops the overflow from reaching the flex ancestors. The PR reports fixture measurements (transcript overflow 640px to 0px at 680px, 848px to 0px at 420px) and pixel-identical spaced-text fixtures. I did not run the fixtures. The whole-PR diff could not be read (changed blobs are missing from the checkout), so the base-to-head delta rests on the PR description and the head file. No coding requirement of #47995 is unmet.

Full details: Out of Scope Changes check

Explanation

The PR description states one change: the [overflow-wrap:anywhere] class on the comment text div. The head file supports that change, which directly implements #47995. However, the AI-generated raw summary for NativeChatBotItemNoteRow.tsx (+14/-2 lines) says the comment text now detects unkerned runs (nativeChatTextHasUnkernedRun) and applies NATIVE_CHAT_UNKERNED_CSS, with a useMemo in CommentRow. The head file contains this logic. The PR description does not mention it, and the issue does not request it. I could not read the base-to-head diff to tell whether this logic is new in this PR or already present at base, and I could not confirm any link between kerning-related styling and long-URL wrapping. The unkerned-run change is therefore unverified scope.

Resolution

Provide the base-to-head diff for NativeChatBotItemNoteRow.tsx, or confirm that the unkerned-run logic (nativeChatTextHasUnkernedRun, NATIVE_CHAT_UNKERNED_CSS) exists at the merge base. If it is new in this PR, the author should explain how it serves #47995, add it to the PR description, and add its evidence, or remove it from this PR.

  • 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: db4830d7-0e76-4af7-8c4b-80c95674449b
Commits

Reviewing files that changed from the base of the PR and between 54dbc19 and a5dcd5a.

Files selected for processing: 1

  • src/renderer/src/components/native-chat/bot-items/NativeChatBotItemNoteRow.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.

…idening the chat

An item comment's text was a whitespace-pre-wrap div with the default
overflow-wrap, so a long unbroken token (URL, path) set its min-content
width: the text ran past the bubble and the transcript scrolled sideways.
Add overflow-wrap:anywhere, as markdown links and other native chat rows
already use.

Wrapping makes Chromium reshape a kerned run with no break opportunity at
every wrap point, quadratic in its length ('q' x 30000: ~970 ms per
layout vs 1.1 ms on main). Reuse the unkerned-run helper user prompts and
queued messages use (stablyai#36031), memoized per text; that comment now lays
out in ~1.5 ms.

Fixes stablyai#47995

Co-authored-by: Taekhun Nam <[email protected]>
@nwparker
nwparker force-pushed the fix/item-comment-long-url-wrap branch from 54dbc19 to a5dcd5a Compare November 24, 2026 03:51
@nwparker
nwparker merged commit aefd4db into stablyai:main Nov 24, 2026
55 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.

[Bug]: Bot chat: a long URL in an item comment runs past the bubble and adds a horizontal scrollbar

2 participants