Repository navigation
Description
Area
apps/web — rich-text message composer / paste handling
Summary
Pasting valid Python arithmetic into the rich-text composer can change literal multiplication and exponentiation operators during the parse → paste-rules → serialize round trip. The serialized text sent to the coding agent can become invalid Python.
The example below is entirely synthetic. No original user code, original pasted text, private workspace paths, or conversation transcript are included.
Steps to reproduce
- Enable the rich-text composer.
- Paste the following line as ordinary text into an empty composer, without wrapping it in a fenced code block:
signal = (7 * 2**3 * 5)**4- Inspect the serialized message text (or send it and compare the text received by the agent) against the pasted input.
Expected behavior
The literal arithmetic operators and spaces are preserved:
signal = (7 * 2**3 * 5)**4Actual behavior established by the editor integration reproduction
The resulting serialized text is:
signal = (7 *2**3***** 5)**4
Python's ast.parse accepts the input and rejects the serialized output with invalid syntax.
A separate numeric-only arithmetic example in the same test also loses multiplication operators. This is not dependent on URLs, underscores, private identifiers, or domain-specific code.
Verification and scope
Reproduced in a temporary, isolated source-level editor integration harness using:
- T3 Code source pinned to commit
95e53a54dbd312fea7e8a2ef94514dc5f1c8ee3d. - The unmodified production
parseInlineMarkdown,appendInlineRuns, andComposerBoldExtension/ComposerItalicExtension/ComposerStrikeExtensionimplementations. - An actual Tiptap
Editorand ProseMirror document in jsdom. @tiptap/core,@tiptap/starter-kit, and the bold/italic/strike extensions at version3.31.3.- Node
v24.22.2, jsdom26.1.0, Linux x64.
The harness parses the synthetic plain-text paragraph into marked text spans, inserts that paragraph into the editor using a transaction marked with uiEvent: "paste", and serializes the resulting document with the production inline serializer. This exercises the relevant plain-paragraph parse/paste/serialize path; it is not a claim of a full application/browser E2E run.
Controls actually executed:
| Test | Result |
|---|---|
| Production inline parser + serializer, without editor paste processing | Input preserved |
| Tiptap paste processing enabled | Corrupted output shown above |
Same Tiptap test with enablePasteRules: false |
Input preserved exactly |
Synthetic compact variant signal = (7*2**3*5)**4 |
Preserved with paste rules enabled |
| Python syntax validation | Original and control output valid; corrupted output invalid |
These controls point to paste rules reinterpreting already-parsed arithmetic text, rather than the language model inventing syntax errors.
Relevant source
- composer-rich-text.ts at the tested commit
- composer-rich-text-doc.ts at the tested commit
- ComposerPromptEditorTiptap.tsx at the tested commit
The composer's handlePaste parses incoming text before inserting content through a transaction marked as a paste. The rich-text marks retain paste rules, which can reinterpret literal operators in the inserted text.
Impact
Coding agents can receive code that differs from what the user copied. They then report syntax errors absent from the original file, leading to misleading debugging advice and repeated disagreement about the pasted code.
Related reports
- [Bug]: Rich text composer turns underscores in pasted URLs and paths into asterisks #25180 documents rich-text paste/draft reconstruction rewriting URLs and paths and also notes paste-rule interactions with inline code.
- [Bug]: Rich text composer consumes typed underscores in snake_case text, including inside inline code #19169 documents typed underscore handling.
This report adds a tested plain-Python-arithmetic case with no underscores or inline-code spans. It may share underlying paste processing with parts of those reports.
Environment / version notes
The user-facing report came from a session connected to a T3 server reporting version 0.1.6. The client build and browser version were not independently captured. The source-level reproduction above is pinned separately and states its exact tested versions.
Workaround
Use a fenced code block for pasted source, or turn off rich-text composition. The enablePasteRules: false control is a diagnostic result, not a proposed product change or a claim that all paste rules should be disabled.
Activity