Skip to content

Automatically convert large pasted text into an attachment, following Codex Desktop #4910

Description

@aotd1

The workflow

I want to paste a large HAR, log, or other text into a bb message, add a short request such as “Analyze the errors,” and send it to the agent. The editor and history should stay compact, while the agent can read the entire original text from a file.

Codex Desktop already provides this workflow: a large text paste becomes an ordinary Pasted text.txt attachment, and the user writes the request separately. This proposal is a behavioral clone of that feature, using bb's existing file attachment pipeline.

What happens today

Large plain-text pastes remain inline in bb's composer. The workaround is to save the clipboard contents as a file and attach it manually.

The candidate branch is based on upstream main commit 5d31d8c32d85d7bde75d211b8295836b33fc2a26 (2026-10-05). Relevant automated checks were rerun on this base, including compatibility with upstream's new thread-link Paste conversion and Undo/Redo. The full manual scenario below was performed on the earlier prototype, not repeated after updating the base.

What you would expect

  • Convert a single large plain-text clipboard paste into an ordinary UTF-8 .txt attachment. Keep short pastes, typing, and programmatic editor updates unchanged.
  • Preserve the clipboard text exactly, including whitespace and line endings. Keep the existing request, selected text, and editor focus.
  • Reuse the normal attachment UI for preview, removal, and opening the file. Allow multiple independent pastes with collision-free names.
  • Make conversion one Undo/Redo action, in normal order with subsequent typing.
  • Persist the attachment with the draft and history. Keep the complete text recoverable if preparation fails; block sending until preparation succeeds, with explicit retry or insertion-as-text actions.
  • Reuse the existing attachment size limits and provider delivery. Stage the file on the actual agent host before starting the turn, including remote/container execution. Keep the request separate from file contents; reject unsupported delivery before starting the agent.
  • Preserve the existing priority and behavior of pasted files and images.

The prototype uses an inclusive threshold of 5,000 Unicode code points. Read-only inspection of the installed Codex Desktop bundle (26.930.31730, build 12947, inspected 2026-10-05) found a >= 5,000 JavaScript string-length condition and a text/plain file named Pasted text.txt. Codex therefore counts UTF-16 units, while the prototype counts Unicode code points. This is evidence about one installed build, not a published Codex contract. The threshold and counting rule are proposals for maintainer agreement.

Context and alternatives

Prepared fork PR: aotd1#3, branch pasted-text-attachments-upstream. Its base, aotd1/bb:upstream-main, is an exact copy of the upstream commit above, so the diff is the candidate upstream change. The current prototype head is 3d03fc806. This is a draft prototype PR in my fork; this issue requests feature sign-off before opening a PR against get-bb/bb.

BB prototype screenshot from the original manual verification (not a Codex Desktop screenshot):

BB prototype: a pasted text attachment beside a short request

Initial implementation and validation report.

Before the latest review fixes, at 8e737c379, 985 tests passed: shared composer/history (323), client-core drafts (19), thread-view (90), daemon dispatch/staging (33), Codex (336), Pi (183), and a focused ACP resource-link contract (1). Pi has one existing skipped test; other ACP tests were filtered out. All 15 selected typecheck/lint Turbo tasks passed with existing repository warnings. Coverage includes threshold boundaries, exact UTF-8 preservation, Undo/Redo, recovery, asynchronous races, draft/history persistence, and attachment delivery contracts.

Review of the prototype found two lifecycle defects, both fixed in 3d03fc806:

  • If the user switched away and back during upload, removed the attachment, waited for upload to finish, and then used Undo, the new editor could restore a stale temporary attachment after recovery data had been deleted. Managers now share the in-flight result and retain failed-upload recovery data while another active manager still needs it.
  • An attachment introduced through another editor of the same draft could appear in the UI but fail to respond to Remove. Removal now adopts the attachment from the current draft.

Six permanent regression tests cover these cases in the manager and actual composer component, plus recovery cleanup and shared retry. 245 relevant app tests passed after the fixes, including all six new tests; app typecheck, lint (with existing warnings), formatting, and git diff --check passed. This is a focused rerun that overlaps the earlier 985 tests, not an additional full-suite run. Manager regression tests and composer regression tests.

The earlier prototype was manually tested with synthetic text of 3,638,577 UTF-8 bytes and 75,151 lines, including draft reload, history reload, and an actual local Codex file read. Actual staging/adapter code also ran in an isolated Docker container without a shared attachment directory. A full agent turn on another enrolled host/container, native mobile clipboard events, and live non-Codex providers remain unverified. The focused ACP contract does not establish live OpenCode compatibility. No user HAR or private clipboard data is included.

The current plugin SDK has no shared Paste/Undo attachment hook, so the prototype changes the shared composer rather than implementing a standalone plugin.

Related work found in open and closed issues/PRs:

I did not find a direct duplicate of this feature request.

Checks

  • I searched open and closed issues for the same request.
  • If an agent wrote this, the body ends with > AGENT GENERATED.

AGENT GENERATED

Activity

  1. added
    ui
    threads
    on Oct 5, 2026
  2. bb-slop-cop commented on Oct 5, 2026

    @bb-slop-cop
    Contributor

    🚨 SLOP COP 🚨 · new-issue-autopilot

    Applied the missing classification:

    • Type: Feature — adds automatic paste-to-attachment behavior.
    • Priority: Medium — a meaningful workflow improvement with manual file attachment as a workaround.
    • Effort: High — introduces a composer interaction spanning Undo/Redo, asynchronous recovery, draft/history persistence, and attachment delivery.
    • Labels: ui, threads.

    No existing classifications were replaced. Re-read and verified the final Type and all applied values. No reproduction report or fix PR: this is a feature request requiring product decisions, not a bug eligible for the simple-fix path.

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

    threadsui

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions