Skip to content

Conversation

@roomote
Copy link
Contributor

@roomote roomote bot commented Jan 7, 2026

Related GitHub Issue

Closes: #10504

Description

This PR attempts to address Issue #10504 by adding a progress indicator (spinner) in the chat UI when the preventFocusDisruption (Background Editing) experimental feature is enabled.

Root Cause: When Background Editing is enabled, the file writing tools skip sending a partial message to the UI that would normally trigger a progress indicator. In the normal flow, task.ask("tool", partialMessage, true) is called before showing the diff editor, which displays a loading spinner in the chat. When background editing is enabled, this step was skipped entirely.

Solution: Added a partial message call (task.ask("tool", partialMessage, true)) at the start of the isPreventFocusDisruptionEnabled code path in all file edit tools. This displays the existing ProgressIndicator component in the chat while the background file operation is in progress.

Files modified:

  • src/core/tools/WriteToFileTool.ts
  • src/core/tools/ApplyDiffTool.ts
  • src/core/tools/MultiApplyDiffTool.ts
  • src/core/tools/SearchAndReplaceTool.ts
  • src/core/tools/SearchReplaceTool.ts
  • src/core/tools/EditFileTool.ts

Test Procedure

  1. Enable the "Background Editing" experimental feature in Roo Code settings
  2. Ask Roo to create or edit a file (especially a large file)
  3. Verify that a spinner/progress indicator appears in the chat while the file operation is being prepared
  4. Verify the progress indicator transitions to the approval dialog once the file is ready

Automated Tests: All 326 existing tool tests pass. TypeScript compilation and ESLint checks pass.

Pre-Submission Checklist

  • Issue Linked: This PR is linked to an approved GitHub Issue (see "Related GitHub Issue" above).
  • Scope: My changes are focused on the linked issue (one major feature/fix per PR).
  • Self-Review: I have performed a thorough self-review of my code.
  • Testing: Existing tests pass. The change reuses existing UI components.
  • Documentation Impact: No documentation updates required - this is an internal behavior fix.
  • Contribution Guidelines: I have read and agree to the Contributor Guidelines.

Screenshots / Videos

N/A - The change uses the existing ProgressIndicator component that is already displayed for partial messages.

Documentation Updates

  • No documentation updates are required.

Additional Notes

Feedback and guidance are welcome. This is a minimal fix that adds the missing partial message calls to provide visual feedback during background file operations.

Get in Touch

Discord: @roomote

…ools

When the preventFocusDisruption (Background Editing) experiment is enabled,
file writing operations now display a progress indicator (spinner) in the
chat UI before file operations begin.

This addresses Issue #10504 where users would see no visual feedback while
Roo was preparing and writing files in the background, causing confusion
about whether the app had frozen.

Files updated:
- WriteToFileTool.ts
- ApplyDiffTool.ts
- MultiApplyDiffTool.ts
- SearchAndReplaceTool.ts
- SearchReplaceTool.ts
- EditFileTool.ts
@roomote
Copy link
Contributor Author

roomote bot commented Jan 7, 2026

Rooviewer Clock   See task on Roo Cloud

Review completed. No issues found.

The changes correctly add a progress indicator to the Background Editing feature by sending a partial message before file operations begin. The implementation is consistent across all 6 tool files and follows existing patterns in the codebase.

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

Copy link

@lemiesz lemiesz left a comment

Choose a reason for hiding this comment

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

I have an overall comment about swallowing errors in an empty catch block.

Is that considered okay in this repo?

if (isPreventFocusDisruptionEnabled) {
// Show progress indicator in UI while preparing the file
const partialMessage = JSON.stringify(sharedMessageProps)
await task.ask("tool", partialMessage, true).catch(() => {})
Copy link

Choose a reason for hiding this comment

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

why is it okay to just swallow the error here?

// Show progress indicator in UI while preparing the file when background editing is enabled
if (isPreventFocusDisruptionEnabled) {
const partialMessage = JSON.stringify(sharedMessageProps)
await task.ask("tool", partialMessage, true).catch(() => {})
Copy link

Choose a reason for hiding this comment

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

why is it okay to swallow errors?

@hannesrudolph hannesrudolph added the Issue/PR - Triage New issue. Needs quick review to confirm validity and assign labels. label Jan 7, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Issue/PR - Triage New issue. Needs quick review to confirm validity and assign labels.

Projects

Status: Triage

Development

Successfully merging this pull request may close these issues.

[BUG] No UI indicator when Background Editing writes long files

4 participants