镜像站点 · 本页由第三方 GitHub 只读镜像提供,非 GitHub 官方站点,不接受任何登录或凭据输入。前往 github.com
Skip to content

[Bug]: Rich-text paste corrupts Python multiplication and exponentiation before sending to agent #31079

Open

Description

@Michael-Ott-03

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

  1. Enable the rich-text composer.
  2. 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
  1. 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)**4

Actual 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, and ComposerBoldExtension / ComposerItalicExtension / ComposerStrikeExtension implementations.
  • An actual Tiptap Editor and ProseMirror document in jsdom.
  • @tiptap/core, @tiptap/starter-kit, and the bold/italic/strike extensions at version 3.31.3.
  • Node v24.22.2, jsdom 26.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

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

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

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

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions