Skip to content
Source
Sign inSign up
pingdotgg/t3code

fix(web): large pastes with a thread link fold into an attachment again #37889

Openjuliusmarmingewants to merge 7 commits intomain fromrefs/pull/37889/headopened View on GitHub

juliusmarmingecommented

Nothing needed changing this round. All 7 required checks passed on 1f28e20 and Macroscope approved the PR with no comments on lines, so there was no finding to fix or dismiss. One check named "Check", which is not required, was still queued when the watch ended. The fix itself: ChatComposer's paste handler and the paste-to-focus redirect skip folding only when the clipboard carries copied T3 composer context that the pasted text references (pastesCopiedComposerContext). A thread URL that merely appears in a large paste no longer keeps the text inline, so it folds into pasted-text.txt again. Copied chips still stay inline.

Fixes pingdotgg/t3code#30577

Supersedes #30590. The change is @juliusmarminge's; their commits are kept.

Reproduction on main

In the web app, open a thread with attachment uploads available. Copy a plain-text log larger than 32 KiB containing one hosted T3 thread URL among ordinary log lines, then paste normally into the focused composer: main leaves the log inline, whereas this change creates pasted-text.txt. Clear the draft, click the conversation to blur the composer, and paste again to exercise window-level paste; repeat with a thread URL naming an unavailable environment. As controls, paste the large log without a link, a short thread URL alone, and a copied T3 thread chip.

Evidence

Real web client and server, driven by scenarios:prove in Chromium on Linux. Fresh synthetic project and replay-backed threads; light theme and 1280×800 viewport on both commits. Stills crop the same sidebar/chat area; recordings omit initial pairing/loading.

Paste an approximately 43 KiB plain-text log containing one hosted thread URL with Ctrl+V into the focused composer. Clear and repeat with an unavailable-environment URL. Clear, click the conversation to blur the composer, then repeat both URLs through window-level paste. Run controls for a large unlinked log, a short thread URL, a copied chip, paste-as-text, and large copied T3 context.

Proven: the base leaves all four linked logs inline; the head folds all four into attachments. Successive attachments are named pasted-text.txt through pasted-text-4.txt. Controls behave identically on both commits.

CaseBefore — f39ecd3df8After — 1f28e20f1e
Focused, available threadBefore: log inlineAfter: log attached
Focused, unavailable environmentBefore: log inlineAfter: log attached
Window-level, available threadBefore: log inlineAfter: log attached
Window-level, unavailable environmentBefore: log inlineAfter: log attached
Large log without linkBefore: attachedAfter: attached
Short URLBefore: thread chipAfter: thread chip
Copied chipBefore: chip retainedAfter: chip retained
Paste as textBefore: inlineAfter: inline
Large copied T3 contextBefore: inlineAfter: inline

Before recording · After recording

Scenario source · Runner-generated evidence with paired captures

Tests

No new commands this round; CI ran on 1f28e20 and all 7 required checks passed. From the earlier round on the same head: composerInlineTokenPaste.test.ts (6 passed), ChatView.browser.test.tsx (14 passed, and the new case fails with main's guard), vp run check:changed (all pass).

Not in this change

  • The file-paste guard in ChatComposer and the Tiptap handlePaste still treat a bare thread link as context, which blocks file handling for clipboards with files plus a thread URL. That is main's behaviour and separate from text folding.
  • The file-paste guard in ChatComposer and the Tiptap handlePaste still treat a bare thread link as context, which blocks file handling when the clipboard has files plus a thread URL. That is main's behaviour and separate from text folding.

Who did the work

  • Written by Claude Opus 5.5, in Claude Code
  • Reviewed by GPT-6.1 Sol, in Codex, and by Claude Opus 5.5, each on its own
  • Proof captured by GPT-6.1 Sol and checked by Claude Opus 5.5

Run by the t3code factory in T3 Code.

    1. tanstack-source added labelsbug

    2. github-actions[bot](GitHub profile, opens in a new tab) added labelsvouch:trusted

    3. Approvability

      Verdict: Approved at 1f28e20

      Macroscope's review found this PR approvable — Large text pastes containing thread links can again fold into attachments, while copied T3 context remains protected. The change reuses existing paste handling and preserves the paste-as-text bypass.

      You can add or adjust custom eligibility rules. [Learn more](https://docs.macroscope.com/approvability#example-custom-eligibility-rules).
    4. coderabbitai[bot](GitHub profile, opens in a new tab)commented
      Explain Change →

      No actionable comments were generated in the recent review.

      Walkthrough

      Composer paste handling now distinguishes copied composer context from thread URLs found in pasted text. Paste routing uses this distinction, and tests cover context matching and large pasted logs.

      Changes: Composer paste handling

      Layer / File(s)Summary
      Copied composer context detection
      apps/web/src/components/composerInlineTokenPaste.ts, apps/web/src/components/composerInlineTokenPaste.test.ts
      Clipboard context decoding is centralized. The new pastesCopiedComposerContext helper returns true when pasted text references a record in the copied context. Tests cover matching records, bare thread links, and unmatched records.
      Paste routing and large-text coverage
      apps/web/src/components/chat/ChatComposer.tsx, apps/web/src/components/chat/usePasteToFocusComposer.ts, apps/web/src/components/ChatView.browser.test.tsx, apps/web/test/fakeEnvironment.ts
      Paste routing uses the copied-context check. A browser test verifies that a large paste containing a thread URL produces a pasted-text.txt attachment and does not leave the log’s final retry line in the editor. The fake environment advertises a file attachment size limit.

      Estimated code review effort: 2 (Simple) | ~10 minutes

      Change: Bug fix · Severity of issue fixed: Low

      Suggested reviewers: maria-rcks, t3dotgg, only21mil

      Merge Risk: Minimal · up to 1f28e

      Large pastes containing a thread link should fold into an attachment again, while copied composer chips stay inline. The change is small and localized to the web paste handling, and no merge-blocking risk was found.

      Pre-merge checks: Passed 4

      Check nameStatusExplanation
      Title checkPassedThe title names the main change: large pastes that contain a thread link fold into a pasted-text attachment again. It follows conventional commit form, and the changeset matches it: the fold guard now…
      Linked Issues checkPassedIssue #30577 requires that a large mixed prose or log paste fold when it contains an incidental T3 thread URL, including a URL for an unreadable environment. Structured clipboard context and link-only…
      Out of Scope Changes checkPassedThe changes fall into these groups, all tied to issue #30577:
      - composerInlineTokenPaste.ts: adds readCopiedComposerContext and pastesCopiedComposerContext. readPastedComposerContext gains an optional…
      Description checkPassedThe description follows the required template sections (Problem, Change, Scope, Verification) with substantive content. It states the fix, links issue #30577, and gives detailed before/after evidence …
      Full details: Title check

      Explanation

      The title names the main change: large pastes that contain a thread link fold into a pasted-text attachment again. It follows conventional commit form, and the changeset matches it: the fold guard now uses pastesCopiedComposerContext instead of the thread-link record count.

      Full details: Linked Issues check

      Explanation

      Issue #30577 requires that a large mixed prose or log paste fold when it contains an incidental T3 thread URL, including a URL for an unreadable environment. Structured clipboard context and link-only pastes may keep context behavior.

      The change replaces the early return in ChatComposer's paste handler and the paste-to-focus redirect (usePasteToFocusComposer.ts). Both now use pastesCopiedComposerContext instead of readPastedComposerContext(...).records.length. pastesCopiedComposerContext returns true only when a copied composer-context fragment (custom MIME or HTML) decodes and one of its record IDs appears in the pasted text. A bare thread link therefore no longer blocks folding. The check does not read environment availability, so the unreadable-environment case follows the same path.

      Unit tests in composerInlineTokenPaste.test.ts cover true for a copied chip, false for a bare thread link, and false for an unreferenced fragment. A browser test in ChatView.browser.test.tsx covers the large-log paste with a thread link and expects pasted-text.txt. The browser test was reported to fail when the guard reverts to main's pastedContext.

      Limits: the PR reports a single browser case. The unreadable-environment variant is listed as a manual repro step, and the real-app Evidence section is still being captured. The code path does not depend on environment state, so this does not change the verdict.

      Full details: Out of Scope Changes check

      Explanation

      The changes fall into these groups, all tied to issue #30577:

      • composerInlineTokenPaste.ts: adds readCopiedComposerContext and pastesCopiedComposerContext. readPastedComposerContext gains an optional decodedFragment parameter. Its default preserves existing behavior for main's callers.
      • ChatComposer.tsx and usePasteToFocusComposer.ts: switch the fold guard to pastesCopiedComposerContext. The !isLiteralPendingAnswer condition is kept.
      • composerInlineTokenPaste.test.ts and ChatView.browser.test.tsx: regression tests for the new behavior.
      • fakeEnvironment.ts: adds a fileAttachments capability with PROVIDER_SEND_TURN_MAX_FILE_BYTES. The PR states this lets the attachment chip render in the browser test. It supports the test and does not change production behavior.

      The file-paste guard in ChatComposer and the Tiptap handlePaste are unchanged. The PR states that these paths still call readPastedComposerContext. The merge of origin/main adds no unrelated production change in the reviewed summary. The PR description and raw summary show no unrelated feature work.

      Limit: this verdict uses the PR summary and description. No focused diff read of each hunk was run.

      Full details: Description check

      Explanation

      The description follows the required template sections (Problem, Change, Scope, Verification) with substantive content. It states the fix, links issue #30577, and gives detailed before/after evidence and test results. Gaps: the Problem section is not stated as a standalone problem description (it appears only in the Change and Reproduction text), the Scope section does not explicitly justify the fix as a bug fix beyond the issue link, and the Verification section lists tests from an earlier round rather than the current head. The 'Not in this change' section repeats the same bullet twice. The author also gives a PR-only asset link to an external host, which the template says to avoid for committed assets. These items are non-critical, so the check passes.

      Finishing Touches

      Generate unit tests (beta)

      • Commit to this branch
      • Create a new PR
      • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts
      Recent review info

      Run configuration

      Commits

      Reviewing files that changed from the base of the PR and between 86a028cbd4c829adab5611dcf170173c35abd170 and 1f28e20f1e0a6140e9d209f106b2d14842fa8256.

      Files selected for processing: 6

      • apps/web/src/components/ChatView.browser.test.tsx
      • apps/web/src/components/chat/ChatComposer.tsx
      • apps/web/src/components/chat/usePasteToFocusComposer.ts
      • apps/web/src/components/composerInlineTokenPaste.test.ts
      • apps/web/src/components/composerInlineTokenPaste.ts
      • apps/web/test/fakeEnvironment.ts

      Limit details: You’ve used all 10 included reviews currently available.

Sign in to join this conversation.