t3code icon indicating copy to clipboard operation
t3code copied to clipboard

[Bug]: A rule typed under a line turns that line into a heading when sent

Open Iweisc opened this issue 1 month ago • 2 comments

Before submitting

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

Area

apps/web

Steps to reproduce

  1. Open a finished thread and click the message box.
  2. Type Please review the clamp helper changes, press Shift+Enter and type ---. The composer draws a horizontal rule.
  3. Type Then run the tests under the rule.
  4. Press Enter and look at the sent message in the thread.

Expected behavior

The sent message shows the line, a rule and the second line, as the composer did. docs/user/composer.md says lines starting with --- become rules and that what you typed is what the agent receives.

Actual behavior

"Please review the clamp helper changes" is rendered as a heading (<h2>), there is no rule, and "Then run the tests" follows as plain text. The agent receives the same Markdown, so it reads the first line as a section heading.

Cause: the composer joins top-level blocks with a single newline and only adds a blank line after a quote. That sends line\n---, and in Markdown a --- directly under a paragraph line is a setext heading underline, not a rule.

https://github.com/pingdotgg/t3code/blob/60aec28a9c6fdb7417a7382ec094ccc4984d0738/apps/web/src/composer-rich-text-doc.ts#L1007-L1012

https://github.com/pingdotgg/t3code/blob/60aec28a9c6fdb7417a7382ec094ccc4984d0738/apps/web/src/composer-rich-text-doc.ts#L1456-L1459

This is the same class as #19409, which was fixed for quotes in #19450. That fix notes that rules "open their own block and keep the single newline", which doesn't hold for a rule right under a paragraph. Open PR #29016 covers a paragraph after a list. Neither covers a rule after a paragraph.

Impact

Minor bug or occasional failure

Version or commit

main @ 60aec28a9c (reproduced on a dev server built from 0847a448fd). v0.1.6 has the same code.

Environment

Linux, Chromium 151, Node 26.12.1, Replay (dev) provider thread

Logs or stack traces

No response

Screenshots, recordings, or supporting files

Session replay: https://bugreels.com/sessions/cbb18f95-2e0b-4e6e-9c55-ca05f95d98c3/recording?t=86 (the rule in the composer at 1:28, the sent message with a heading and no rule at 2:05). Typed text is masked in the replay.

Workaround

No response


Drafted with Claude Code (Claude Opus 5.5). I reproduced it on a local dev server and checked the cause against the linked source.

Iweisc avatar Nov 02 '26 21:11 Iweisc

I'd like to work on this.

BilalIrfanContact avatar Nov 02 '26 22:11 BilalIrfanContact

@juliusmarminge Btw, was this bug report helpful? 😛

Iweisc avatar Nov 17 '26 06:11 Iweisc