Skip to content

[Bug]: Rich text composer turns underscores in pasted URLs and paths into asterisks #25180

Open

Description

@xorwyrm

Before submitting

  • I searched existing issues and did not find a duplicate.
  • I included enough detail to reproduce or investigate the problem.

Area

apps/web

Steps to reproduce

  1. Leave the rich text composer on (the default).
  2. Paste this into the composer:
    Read https://example.com/_handle_/status/1 and open src/__test__.tsx
    
  3. Send it, or select all in the composer and copy.

Expected behavior

The agent receives exactly what was pasted:

Read https://example.com/_handle_/status/1 and open src/__test__.tsx

Actual behavior

The composer shows handle in italics and test in bold with the underscores hidden, and the agent receives:

Read https://example.com/*handle*/status/1 and open src/**test**.tsx

The link is broken and the path does not exist.

  • The same happens whenever a draft is rebuilt from its stored Markdown: reload, thread switch, history recall, stash restore. A URL that was typed character by character, which fix(web): keep typed underscores literal in the rich text composer #19186 keeps literal, is rewritten the next time the draft is rebuilt.
  • Pasting into inline code splits the paste out of the span. Pasting a_b_ **c** inside `xy` gives `x`a_b_ **c**`y`.
  • Pasting see `**x**` now sends see **`x`** now.

Cause: parseInlineMarkdown in apps/web/src/composer-rich-text.ts has no notion of URLs, so /_handle_/ qualifies as emphasis, and appendInlineRuns in apps/web/src/composer-rich-text-doc.ts writes every italic as * and every bold as ** (RICH_TEXT_DELIMITERS), whatever produced it. Paste (handlePaste) and every draft rebuild (buildDocJson) go through that parser. The code span case comes from Tiptap's paste rules, which run again over text handlePaste already parsed; the composer's code mark does not exclude bold, so **x** inside the span becomes bold. The chat renders the same text correctly because GFM autolinks a URL before looking for emphasis.

Impact

Minor bug or occasional failure

Version or commit

main @ c58beff

Environment

Linux (NixOS), web client via vp run dev in Chromium 155, pasting with Ctrl+V. First noticed in the desktop app.

Logs or stack traces

Screenshots, recordings, or supporting files

composer-underscores-before.png
composer-underscores-after.png

Workaround

Paste into a fenced code block, escape the underscores (\_), or turn rich text off.

I have a fix with focused tests ready, and can open a PR if you agree with the direction.

Activity

  1. added
    bugSomething is broken or behaving incorrectly.
    needs-triageIssue needs maintainer review and initial categorization.
    on Oct 26, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething is broken or behaving incorrectly.needs-triageIssue needs maintainer review and initial categorization.

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions