Enables image attachments in plan follow-ups#2016
Enables image attachments in plan follow-ups#2016Aaltuj wants to merge 1 commit intopingdotgg:mainfrom
Conversation
- Capture composer images for plan follow-up submissions - Convert images to attachments with data URLs - Include optimistic attachments in message UI - Send attachments to API with turn message
|
Important Review skippedAuto reviews are disabled on this repository. Please check the settings in the CodeRabbit UI or the ⚙️ Run configurationConfiguration used: Repository UI Review profile: CHILL Plan: Pro Run ID: You can disable this status message by setting the Use the checkbox below for a quick retry:
✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
🟡 Medium
t3code/apps/web/src/components/ChatView.tsx
Line 2951 in 0a9122b
When onSubmitPlanFollowUp catches an error at line 2951, it removes the optimistic message but never revokes the blob URLs from optimisticAttachments, leaking memory. The main onSend function properly calls revokeUserMessagePreviewUrls on its error path, but onSubmitPlanFollowUp does not. Add the same cleanup call before filtering the optimistic message to prevent the leak.
🤖 Copy this AI Prompt to have your agent fix this:
In file apps/web/src/components/ChatView.tsx around line 2951:
When `onSubmitPlanFollowUp` catches an error at line 2951, it removes the optimistic message but never revokes the blob URLs from `optimisticAttachments`, leaking memory. The main `onSend` function properly calls `revokeUserMessagePreviewUrls` on its error path, but `onSubmitPlanFollowUp` does not. Add the same cleanup call before filtering the optimistic message to prevent the leak.
Evidence trail:
apps/web/src/components/ChatView.tsx lines 2807-2962 (onSubmitPlanFollowUp function)
apps/web/src/components/ChatView.tsx lines 2866-2872 (optimisticAttachments creation with previewUrl)
apps/web/src/components/ChatView.tsx line 2893 (attachments added to optimistic message)
apps/web/src/components/ChatView.tsx lines 2951-2959 (catch block filters message without revoking URLs)
apps/web/src/components/ChatView.tsx lines 2595-2608 (onSend error handler properly calls revokeUserMessagePreviewUrls at line 2605)
apps/web/src/components/ChatView.logic.ts lines 105-122 (revokeUserMessagePreviewUrls and revokeBlobPreviewUrl functions)
ApprovabilityVerdict: Needs human review 1 blocking correctness issue found. This PR enables a new capability (image attachments in plan follow-ups) by propagating image handling to a code path that previously didn't support it. Additionally, there's an unresolved review comment identifying a memory leak in the error handling path that should be addressed before merging. You can customize Macroscope's approvability policy. Learn more. |
What Changed
The
ChatViewcomponent now captures existingcomposerImageswhen a plan follow-up is submitted. TheonSubmitPlanFollowUphandler has been updated to accept an optionalimagesarray, which includesComposerImageAttachmentobjects. These images are then processed to create:previewUrlfor quick feedback.The user message sent during a plan follow-up now includes these image attachments, both optimistically and in the final API payload.
Why
This change allows users to provide visual context and information directly within their follow-up instructions for a plan. By enabling image attachments in plan follow-up messages, the system supports richer and more descriptive interactions, making it easier for users to clarify their intent or provide visual examples when refining a plan.
UI Changes
No direct UI component changes are reflected in this diff. This PR introduces the backend logic and data handling required for attaching images to plan follow-up messages.
Checklist
Note
Medium Risk
Changes the plan follow-up send path to include image data URLs and optimistic attachment previews, which affects message payload construction and dispatch timing. Risk is moderate due to added async file-reading and potential for attachment-related regressions in sending/optimistic UI updates.
Overview
Plan follow-up submissions now carry through any current composer image attachments:
onSendsnapshotscomposerImagesand passes them intoonSubmitPlanFollowUp.onSubmitPlanFollowUpnow accepts optionalimages, builds optimistic image attachments for immediate UI rendering, converts files to data URLs viareadFileAsDataUrl, and sends those attachments in thethread.turn.startdispatch (instead of always sending an emptyattachmentsarray).Reviewed by Cursor Bugbot for commit 0a9122b. Bugbot is set up for automated code reviews on this repo. Configure here.
Note
Add image attachment support to plan follow-up submissions in
ChatViewid,name,mimeType,sizeBytes,previewUrl) for immediate UI display, and a dispatch payload (usingdataUrlfrom file reads) for thethread.turn.startcommand.📊 Macroscope summarized 0a9122b. 1 file reviewed, 1 issue evaluated, 0 issues filtered, 1 comment posted
🗂️ Filtered Issues