Skip to content

Image pasting disabled when task is active - inconsistent with message queueing behaviorΒ #6395

@hannesrudolph

Description

@hannesrudolph

App Version

v3.3.1 (or latest)

API Provider

Not Applicable / Other

Model Used

N/A

πŸ” Steps to Reproduce

  1. Open Roo Code in VS Code
  2. Start any task (e.g., type "explain this code" and press Enter)
  3. While the AI is processing (you'll see the response being generated):
    • Copy an image to your clipboard (e.g., screenshot)
    • Try to paste it into the chat input area (Ctrl/Cmd+V)
  4. Observe that the image is not pasted

πŸ’₯ Outcome Summary

Expected: Image should be pasted and queued along with any text message, just like text messages are queued when the AI is busy.
Actual: Image paste is completely blocked while a task is active, even though text can still be typed and queued.

πŸ” Comprehensive Issue Scoping

Root Cause / Implementation Target

The bug is caused by an inconsistency in the chat interface logic. While text messages can be queued when sendingDisabled is true (AI is busy), the image paste handler explicitly blocks image pasting during this state.

Affected Components

  • Primary Files:

    • webview-ui/src/components/chat/ChatView.tsx (lines 813-815): Contains the shouldDisableImages logic
    • webview-ui/src/components/chat/ChatTextArea.tsx (lines 667): Contains the paste handler that checks shouldDisableImages
  • Secondary Impact:

    • webview-ui/src/components/chat/QueuedMessages.tsx: Already supports displaying images in queued messages
    • Message queue processing logic: Already handles messages with images

Current Implementation Analysis

The shouldDisableImages flag at line 813 in ChatView.tsx is calculated as:

const shouldDisableImages = !model?.supportsImages || sendingDisabled || selectedImages.length >= MAX_IMAGES_PER_MESSAGE

When sendingDisabled is true (AI is processing), this makes shouldDisableImages true, which causes the paste handler in ChatTextArea.tsx to skip image processing entirely.

Proposed Implementation

Step 1: Update the shouldDisableImages logic

  • File: webview-ui/src/components/chat/ChatView.tsx
  • Changes: Remove sendingDisabled from the shouldDisableImages calculation
  • Rationale: Allow images to be selected/pasted even when sending is disabled, consistent with text input behavior

Step 2: Ensure paste handler processes images regardless of sending state

  • File: webview-ui/src/components/chat/ChatTextArea.tsx
  • Changes: The paste handler will now process images when shouldDisableImages is false (which it will be after Step 1)
  • Rationale: Images should be added to selectedImages state for queueing

Code Architecture Considerations

  • The existing message queue already supports images (QueuedMessage type includes images: string[])
  • The queue display component already renders image thumbnails
  • No changes needed to the queue processing logic

Testing Requirements

  • Unit Tests:
    • Test that shouldDisableImages is false when only sendingDisabled is true
    • Test that paste handler adds images to selectedImages when AI is busy
  • Integration Tests:
    • Test full flow: paste image while AI busy β†’ image queued β†’ message sent when AI ready
  • Edge Cases:
    • Test pasting when already at MAX_IMAGES_PER_MESSAGE limit
    • Test pasting multiple images while AI is busy

Performance Impact

  • Expected performance change: Neutral
  • No additional processing or state management required

Security Considerations

  • No new security risks - existing image validation remains in place

Dependencies and Breaking Changes

  • No external dependencies affected
  • No API contract changes
  • No breaking changes for users

Metadata

Metadata

Assignees

No one assigned

    Labels

    Issue - In ProgressSomeone is actively working on this. Should link to a PR soon.bugSomething isn't working

    Type

    No type

    Projects

    Status

    Done

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions