Skip to content

Enables image attachments in plan follow-ups#2016

Open
Aaltuj wants to merge 1 commit intopingdotgg:mainfrom
Aaltuj:main
Open

Enables image attachments in plan follow-ups#2016
Aaltuj wants to merge 1 commit intopingdotgg:mainfrom
Aaltuj:main

Conversation

@Aaltuj
Copy link
Copy Markdown

@Aaltuj Aaltuj commented Apr 14, 2026

What Changed

The ChatView component now captures existing composerImages when a plan follow-up is submitted. The onSubmitPlanFollowUp handler has been updated to accept an optional images array, which includes ComposerImageAttachment objects. These images are then processed to create:

  • Optimistic attachments for immediate display in the chat UI, using previewUrl for quick feedback.
  • Full data URL attachments for the actual API request, ensuring image data is sent to the backend.
    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

  • This PR is small and focused
  • I explained what changed and why
  • I included before/after screenshots for any UI changes
  • I included a video for animation/interaction changes

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: onSend snapshots composerImages and passes them into onSubmitPlanFollowUp.

onSubmitPlanFollowUp now accepts optional images, builds optimistic image attachments for immediate UI rendering, converts files to data URLs via readFileAsDataUrl, and sends those attachments in the thread.turn.start dispatch (instead of always sending an empty attachments array).

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 ChatView

  • Captures composer image attachments before clearing the draft and forwards them into the plan follow-up submission in ChatView.tsx.
  • Builds two attachment sets: optimistic previews (using id, name, mimeType, sizeBytes, previewUrl) for immediate UI display, and a dispatch payload (using dataUrl from file reads) for the thread.turn.start command.
  • Previously, plan follow-up submissions always sent an empty attachments array; images are now preserved end-to-end.
📊 Macroscope summarized 0a9122b. 1 file reviewed, 1 issue evaluated, 0 issues filtered, 1 comment posted

🗂️ Filtered Issues

- 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
@coderabbitai
Copy link
Copy Markdown

coderabbitai bot commented Apr 14, 2026

Important

Review skipped

Auto reviews are disabled on this repository. Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

⚙️ Run configuration

Configuration used: Repository UI

Review profile: CHILL

Plan: Pro

Run ID: b3678316-ff52-4d90-8456-ebe695ef27c5

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • 🔍 Trigger review
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

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.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@github-actions github-actions bot added size:M 30-99 changed lines (additions + deletions). vouch:unvouched PR author is not yet trusted in the VOUCHED list. labels Apr 14, 2026
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

🟡 Medium

setOptimisticUserMessages((existing) =>

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)

@macroscopeapp
Copy link
Copy Markdown
Contributor

macroscopeapp bot commented Apr 14, 2026

Approvability

Verdict: 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.

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

Labels

size:M 30-99 changed lines (additions + deletions). vouch:unvouched PR author is not yet trusted in the VOUCHED list.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant