Skip to content

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

Open
juliusmarminge wants to merge 7 commits into
mainfrom
factory/pr-30590-a1794883884
Open

juliusmarminge wants to merge 7 commits into
mainfrom
factory/pr-30590-a1794883884

Conversation

@juliusmarminge

@juliusmarminge juliusmarminge commented Nov 17, 2026 •

Copy link
Copy Markdown
Member

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 #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.

Case Before — f39ecd3df8 After — 1f28e20f1e
Focused, available thread Before: log inline After: log attached
Focused, unavailable environment Before: log inline After: log attached
Window-level, available thread Before: log inline After: log attached
Window-level, unavailable environment Before: log inline After: log attached
Large log without link Before: attached After: attached
Short URL Before: thread chip After: thread chip
Copied chip Before: chip retained After: chip retained
Paste as text Before: inline After: inline
Large copied T3 context Before: inline After: 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.

juliusmarminge and others added 7 commits November 4, 2026 03:01
A large plain-text paste that contains one thread URL goes inline instead of
folding into pasted-text.txt, both when pasted into the composer and when a
window paste is routed to the blurred composer. These tests reproduce it.

The fake environment now advertises file attachment uploads like a real
server does, so the composer can stage a folded paste in browser tests.
A large plain-text paste that only mentioned a thread URL stayed inline,
because both paste paths skipped folding whenever the clipboard yielded
context records, and plain thread links now synthesize records too.

Folding is now skipped only when the paste references context copied from
T3 (the composer clipboard format or its HTML fragment), so copied chips
still import while plain links in a large paste fold like any other text.

AI-assisted; verified with the tests and tools listed above.
# Conflicts:
#	apps/web/src/components/ChatView.browser.test.tsx
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@github-actions github-actions Bot added vouch:trusted Author is trusted by repo permissions or the VOUCHED list. size:M 30-99 changed lines (additions + deletions). labels Nov 17, 2026
@macroscopeapp

macroscopeapp Bot commented Nov 17, 2026

Copy link
Copy Markdown
Contributor

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.

@coderabbitai

coderabbitai Bot commented Nov 17, 2026 •

Copy link
Copy Markdown
Contributor

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 name Status Explanation
Title check Passed 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…
Linked Issues check Passed 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…
Out of Scope Changes check Passed The changes fall into these groups, all tied to issue #30577:
- composerInlineTokenPaste.ts: adds readCopiedComposerContext and pastesCopiedComposerContext. readPastedComposerContext gains an optional…
Description check Passed 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 …
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 86a028c and 1f28e20.

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.

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

size:M 30-99 changed lines (additions + deletions). vouch:trusted Author is trusted by repo permissions or the VOUCHED list.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

A thread URL inside a large web paste bypasses automatic text folding

1 participant