Skip to content

TUI: pasted image paths force attachments in V2 #57298

Open

Description

@maharshi365

Description

Pasting a local image path into the TUI automatically converts it into an image attachment. Sometimes I only want to include the path as plain text.

#19892 describes the same bug. It was closed during the V1-to-V2 migration, not because a fix shipped. The bug still exists in V2.

Expected Behavior

There should be a way to keep the pasted path as plain text.
Ideally, clicking the attachment placeholder should expand it into the original path and remove the image attachment.

Actual Behavior

The path becomes an image attachment such as [Image 1]. Unlike collapsed pasted text, it cannot be expanded into editable path text.

Additional Context

Plugins

No response

OpenCode version

2.0.30

Steps to reproduce

  1. Copy the path of an existing PNG or JPEG.
  2. Paste it into the TUI prompt.
  3. Try to expand the resulting image placeholder into its original path, like a collapsed long-text paste.

Screenshot

No response

Operating System

OS: Windows 11,

Terminal

PowerShell

Activity

  1. opencode-agent commented on Oct 20, 2026

    @opencode-agent
    Contributor

    Thanks for the report, and for linking the earlier v1 issue.

    To restate the request: when you paste a local image path into the TUI prompt, you'd like to be able to keep it as plain text instead of having it turned into an [Image N] attachment. Ideally you could expand the image chip back into the original path, the way collapsed text pastes can be expanded.

    I checked the current code: turning pasted paths that point to local images or PDFs into attachments is deliberate, and only text pastes can be expanded today. So I've filed this as a feature request rather than a bug. Maintainers will consider it.

    This can't be done as a plugin right now, because plugins have no way to hook into pasting in the TUI.

    Related issues:

  2. maharshi365 commented on Oct 20, 2026

    @maharshi365
    ContributorAuthor

    This isnt a feature request. I literally cant paste in file paths to images. It always attaches and thats not a behavior i want. @opencode-agent

  3. laidz commented on Oct 22, 2026

    @laidz

    +1 on v2.1.2 (macOS 27, Apple Terminal, zsh).

    Same experience here: I copy a path as text, paste it, and it silently becomes an image chip. Often the whole point of pasting a path is to hand the agent a path, not a bitmap.

    I checked the shipped 2.1.2 binary to make sure there is no existing switch: the paste handler trims the pasted text, strips surrounding single/double quotes, then converts it whenever it resolves to an existing local file whose extension maps to avif/gif/jpeg/jpg/png/svg/webp/pdf (≤20 MB). There is no config read and no modifier check on that path. prompt.paste only chooses compact vs full text, and the prompt block in cli.json only exposes editor, paste, image_preview. Plugins also can't intercept paste, as the bot already noted.

    Concrete proposal — one setting, default keeps today's behavior:

    {
      "prompt": {
        "paste_paths": "attach"   // "attach" | "text" | "ask"
      }
    }
    • attach (default): current behavior.
    • text: never convert pasted paths; always insert the literal path.
    • ask: insert the path, then offer a one-key choice to attach instead.

    A modifier or "undo immediately after paste restores the original path" would help too, but an explicit setting is what makes it predictable. The same gate would also cover the text-only-model and context-overflow variants in #57698 and #57162.

    Related: #57162, #57698, #48190.

    Environment
    • opencode version: v2.1.2
    • OS: Darwin 27.0.0 arm64 (Apple M2, macOS 26)
    • Terminal: Apple_Terminal, TERM=xterm-256color, COLORTERM=truecolor
    • Shell: /bin/zsh
    • Install/channel: release (V2)
    • Active plugins: superpowers@git+https://github.com/obra/superpowers.git#v6.4.1
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