Skip to content

Conversation

@hannesrudolph
Copy link
Collaborator

@hannesrudolph hannesrudolph commented Dec 3, 2025

Summary

Persist the chat input text across VSCode restarts and crashes at the workspace level, so each workspace maintains its own draft message. This ensures users don't lose their work-in-progress messages if the extension crashes or VSCode restarts.

Changes

Backend (src/)

  • Added DRAFT_MESSAGE_KEY constant and draft management methods to ClineProvider.ts:
    • saveDraftMessage(text, images) - saves draft to workspace state
    • getDraftMessage() - retrieves saved draft
    • clearDraftMessage() - clears the draft
  • Added webview message handlers for saveDraftMessage, getDraftMessage, and clearDraftMessage

Types

  • Added saveDraftMessage, getDraftMessage, clearDraftMessage to WebviewMessage types
  • Added draftMessage to ExtensionMessage types

Frontend (webview-ui/)

  • Added debounced draft save (500ms) to prevent excessive writes
  • Request saved draft on component mount
  • Handle draftMessage response to restore draft
  • Created handleInputValueChange wrapper to auto-save draft
  • Clear draft on message send and chat reset

Tests

  • Added unit tests for draft message webview handlers

Behavior

  • Draft messages are saved at the workspace level (each workspace has its own draft)
  • Both text and images are persisted
  • Drafts are cleared when:
    • A message is sent
    • The user starts a new task
  • Drafts persist across:
    • Webview reloads
    • Extension restarts
    • VSCode restarts
    • VSCode crashes (workspaceState is disk-backed)
    • Task switching (viewing different tasks in history)

- Add draft message storage key and methods to ClineProvider
- Add saveDraftMessage, getDraftMessage, clearDraftMessage WebviewMessage types
- Add draftMessage ExtensionMessage type
- Add webview message handlers for draft persistence
- Update ChatView.tsx with debounced save/restore logic (500ms debounce)
- Clear draft on task switch, message send, and chat reset
- Draft persists at workspace level (each workspace maintains its own draft)
- Add unit tests for draft message handlers
@dosubot dosubot bot added size:L This PR changes 100-499 lines, ignoring generated files. enhancement New feature or request labels Dec 3, 2025
@roomote
Copy link
Contributor

roomote bot commented Dec 3, 2025

Oroocle Clock   Follow along on Roo Cloud

Reviewing your PR now. Feedback coming soon!

Previous reviews

Mention @roomote in a comment to request specific changes to this pull request or fix all unresolved issues.

@hannesrudolph hannesrudolph added the Issue/PR - Triage New issue. Needs quick review to confirm validity and assign labels. label Dec 3, 2025
The draft should persist at the workspace level regardless of which task
you're viewing. Removed the clearDraftMessage() call from showTaskWithId()
so the draft is only cleared when the message is actually sent, not when
switching between tasks.
@hannesrudolph hannesrudolph moved this from Triage to PR [Needs Prelim Review] in Roo Code Roadmap Dec 3, 2025
@hannesrudolph hannesrudolph added PR - Needs Preliminary Review and removed Issue/PR - Triage New issue. Needs quick review to confirm validity and assign labels. labels Dec 4, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request PR - Needs Preliminary Review size:L This PR changes 100-499 lines, ignoring generated files.

Projects

Status: PR [Needs Prelim Review]

Development

Successfully merging this pull request may close these issues.

2 participants