Treat pasted image paths as literal text in shell mode

Open 💬 0 comments Opened May 27, 2026 by cauldron26

What variant of Codex are you using?

cli

What feature would you like to see?

TLDR for humans: converting image paths to [Image] is not useful when in shell mode, so it is possible to disable this behavior with an additional 'if' statement.

Feature request

When the TUI composer is in shell mode, pasted image paths should be inserted as literal text instead of being
converted into image attachments.

## Motivation

In normal chat mode, converting a pasted local image path into an image attachment is useful.

In shell mode (! prefix), the input is intended to be passed to the shell. In that context, converting a pasted path
like:

```text
/path/to/image.png

  into:

  [Image #1]

  makes shell commands harder to use. For example, if Codex generates an image path and I want to open or inspect it
  from shell mode, I expect to type:
```text
  !open-image /path/to/image.png

and have the path remain literal.

## Proposed behavior

When the composer is in shell mode, image-path paste handling should be skipped and the pasted text should be inserted
directly into the command buffer.

Normal chat-mode image paste behavior should remain unchanged.

## Proposed implementation

The image-path conversion path can be gated on shell mode, roughly:

image_paste_enabled && !is_bash_mode

I have a small branch with a regression test here:

https://github.com/cauldron26/codex/tree/codex/fix-shell-mode-image-path-paste

## Validation

  • RUST_MIN_STACK=8388608 cargo test -p codex-tui pasting_filepath --lib
  • Manual TUI check: in shell mode, pasting a PNG path keeps the path literal instead of converting to [Image #1]

Additional information

_No response_

View original on GitHub ↗