Skip to content

Conversation

@roomote
Copy link
Contributor

@roomote roomote bot commented Nov 18, 2025

Description

This PR attempts to address Issue #9341 where user messages disappear when an editing error occurs during the Save/Reject prompt.

Problem

When users type a message during a file edit approval prompt and an editing error occurs, their message disappears instead of being preserved. This forces users to retype their message, which is frustrating especially for longer messages with important context.

Solution

Modified the ChatView component to:

  • Not clear the input immediately when the user clicks Save/Approve
  • Only clear the input after successful tool execution (when api_req_started is received)
  • Preserve the input when errors occur, allowing users to retry without retyping
  • Still clear input when user explicitly rejects (since that's an intentional action)

Changes

  • Modified to not clear input state immediately
  • Added logic to clear input only after successful api_req_started
  • Added comprehensive tests to verify the input preservation behavior

Testing

  • Added new test suite with 4 test cases
  • Verified existing ChatView tests still pass
  • Tests cover:
    • Input preservation on tool errors
    • Input clearing on explicit rejection
    • Input clearing on successful execution
    • Multiple sequential errors

Fixes #9341

Feedback and guidance are welcome!

- Modified ChatView to not clear input immediately on approval
- Input is only cleared after successful tool execution (api_req_started)
- Input is preserved when errors occur, allowing users to retry without retyping
- Added comprehensive tests for input preservation behavior

Fixes #9341
@roomote roomote bot requested review from cte, jr and mrubens as code owners November 18, 2025 07:14
@dosubot dosubot bot added size:XL This PR changes 500-999 lines, ignoring generated files. bug Something isn't working labels Nov 18, 2025
@roomote
Copy link
Contributor Author

roomote bot commented Nov 18, 2025

Rooviewer Clock   See task on Roo Cloud

I've reviewed this PR and found an issue with the scope of the input preservation changes.

Issues Found

  • Input clearing was removed for ALL ask types in handlePrimaryButtonClick, but the clearing logic only handles tool asks. This means commands, browser actions, and MCP server operations will never clear their input, even on success.

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 Nov 18, 2025
setInputValue("")
setSelectedImages([])
// Don't clear input here - let handleChatReset do it when the tool succeeds
// This preserves the input if the tool fails
Copy link
Contributor Author

Choose a reason for hiding this comment

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

The input preservation logic is applied too broadly. Input is no longer cleared for ANY approval in this switch (including command, browser_action_launch, use_mcp_server, etc.), but the clearing logic on lines 384-393 only handles tool asks. This creates inconsistent behavior where approving a command or browser action will preserve the input even on success, causing it to never be cleared.

The fix should only skip clearing input for tool asks, since the issue #9341 specifically mentions file editing errors. Other ask types should clear input immediately on approval as they did before.

Fix it with Roo Code or mention @roomote and request a fix.

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

Labels

bug Something isn't working Issue/PR - Triage New issue. Needs quick review to confirm validity and assign labels. size:XL This PR changes 500-999 lines, ignoring generated files.

Projects

Status: Triage

Development

Successfully merging this pull request may close these issues.

[BUG] My message disappears if editing attempt fails

3 participants