fix: pass image file path to Claude Code model#28
Conversation
…ding Images uploaded as attachments were previously sent to the model with only metadata (filename, MIME type, size) causing hallucination of image content. This change aligns image handling with PDFs and text files by passing the file path so the model can use the Read tool to access the actual image data saved to disk. Changes: - Include images in attachmentPaths map resolution (previously skipped) - Pass file path to model with 'Read the image file at:' instruction - Maintain fallback metadata for cases where file is unavailable
There was a problem hiding this comment.
💡 Codex Review
t3code/apps/server/src/provider/Layers/ClaudeCodeAdapter.ts
Lines 2047 to 2048 in 665dda9
This loop now adds image attachments to attachmentPaths whenever resolveAttachmentPath returns a non-null string, but that helper only computes a normalized path and does not check filesystem existence (see apps/server/src/attachmentStore.ts), so deleted/missing images still look "resolvable" here. In that case buildUserMessage emits Read the image file at: ... and never falls back to metadata, which makes Claude try to read a nonexistent file during replay/retry/cleanup scenarios and hurts turn reliability.
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
What Changed
Pass file path to Claude Code model when processing image attachments, enabling the model to read actual image content instead of generating hallucinated descriptions.
Why
When users uploaded images as attachments, the ClaudeCodeAdapter sent only metadata (filename, MIME type, size) to the model, causing hallucinations. PDFs and text files already worked correctly by passing the disk file path. Images now follow the same pattern.
How It Works
Checklist