Skip to content

Support pipe paths for CLI attachments - #1857

Merged
simonw merged 1 commit into
simonw:mainfrom
remote-controlled-man:codex/prflow-5e6c84af647a
Nov 6, 2026
Merged

simonw merged 1 commit into
simonw:mainfrom
remote-controlled-man:codex/prflow-5e6c84af647a

Conversation

@remote-controlled-man

Copy link
Copy Markdown
Contributor

Fixes #971.

Attachments passed through Bash process substitution, such as llm "Describe this image" -a <(cat image.png), could not be detected because MIME probing expects a seekable file. With an explicit --at type, hashing and subsequent reads could instead consume the pipe and lose its content.

Read FIFO attachments once and retain their bytes for type detection, model requests and logging. Both -a and --at use this behavior; regular file attachments keep their resolved paths.

Validation: full pytest suite, Black, mypy, Ruff, Cog, package build and plugin-loading script. Regression coverage checks both CLI options, repeated content reads and stored attachment bytes; the Bash process-substitution command was also exercised with the local echo model.

Copilot AI balanced review requested due to automatic review settings November 6, 2026 05:22

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot was unable to review this pull request because the user who requested the review has insufficient remaining quota. Try requesting a review at a lower effort level.

@simonw simonw added bug Something isn't working attachments labels Nov 6, 2026
@simonw

simonw commented Nov 6, 2026

Copy link
Copy Markdown
Owner

Nice fix:

~/dev/llm % uv run llm "Describe this image" -a <(cat zelda-card.jpg)
Usage: llm prompt [OPTIONS] [PROMPT]
Try 'llm prompt --help' for help.

Error: Invalid value for '-a' / '--attachment': Could not determine mimetype of /dev/fd/11
~/dev/llm % gh pr checkout 1857                               
M	tests/test_chat.py
Switched to branch 'codex/prflow-5e6c84af647a'
~/dev/llm % uv run llm "Describe this image" -a <(cat zelda-card.jpg)
**Describing the handheld device**

I need to describe the image of a handheld gaming device. It has a transparent blue case and a screen displaying pixel art that resembles a Zelda-like game, possibly from emulation, with overlay control mappings. I don’t need to identify any specific game, just focus on the retro game style and character map. The device appears close-up, resting against a dark gray background, showcasing its buttons. I’ll ensure not to include anything unsupported.
A close-up of a small handheld gaming device in a translucent blue case. Its screen shows a colorful, top-down pixel-art adventure game, with a character on a path amid green grass, water, and stairways. Blue emulator-style labels and control hints run down the sides of the display. The device rests against a dark, plain background.

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

Labels

attachments bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Enable mac clipboard via pngpaste (Support unseekable attachments)

3 participants