Skip to content

[Bug]: Claude text generation never sends image attachments, so titles and branch names ignore screenshots #38611

Closed

Description

@KamilDev

Before submitting

  • I searched existing issues and did not find a duplicate.
  • I included enough detail to reproduce or investigate the problem.

Area

apps/server

Steps to reproduce

  1. Set the thread title (or branch name) model to a Claude model, for example Haiku.
  2. Start a new thread with a screenshot and a short message such as "fix this".
  3. Look at the generated title.

Expected behavior

The title model sees the screenshot, the way it does when the text generation model is Codex (--image <path> in CodexTextGeneration.ts) or OpenCode 2 (prompt files, hardened in #29819). The shared branch-name prompt even says "If images are attached, use them as primary context for visual/UI issues."

Actual behavior

ClaudeTextGeneration.ts ignores request.attachments. It pipes only the text prompt into claude -p --output-format json, so the model gets just the attachment metadata line (- screen.png (image/png, 48213 bytes)) and guesses the title from the text and the file name. This affects every text generation that receives the message's attachments (thread titles, title regeneration, branch names), not only titles.

Impact

Minor bug or occasional failure

Version or commit

main @ f4b988a

Environment

Any OS; Claude Code 2.1.x as the text generation provider.

Logs or stack traces

# Plain -p stdin is text only. stream-json input is the CLI's way to send images, and it requires stream-json output with --verbose:
$ claude -p --input-format stream-json --output-format json
Error: --input-format=stream-json requires output-format=stream-json.
$ claude -p --input-format stream-json --output-format stream-json
Error: When using --print, --output-format=stream-json requires --verbose

Workaround

Pick a Codex model for text generation.

Suggested fix

When the request has native image attachments (isProviderNativeImageAttachment) whose files can be read, send one stream-json user message: the prompt as a text block plus a base64 image block per image, the same shape ClaudeAdapterV2 uses for turns. Run with --input-format stream-json --output-format stream-json --verbose, and join the output lines into the JSON array that decodeClaudeOutput already accepts (the result line carries structured_output). Skip unreadable or unsupported images so the title still generates from the text, as #29819 does for OpenCode. Requests without images keep the current plain-text path. Checked against the real CLI with Haiku: the result line returned a schema-valid title describing the image.

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