Skip to content

Conversation

@roomote
Copy link
Contributor

@roomote roomote bot commented Jan 9, 2026

Related GitHub Issue

Closes: #10329

Roo Code Task Context (Optional)

This PR was created with Roo Code assistance.

Description

This PR attempts to address Issue #10329 where the UI hangs when a user sends a message while a command is running (during command_output state).

Root Cause:
When a user sends a message during command_output:

  1. handleSendMessage() sends askResponse which resolves the ask
  2. In the backend, runInBackground becomes true, preventing new command_output asks
  3. handleChatReset() disables the UI (sendingDisabled: true, clineAsk: undefined, enableButtons: false)
  4. No new command_output ask is sent to re-enable the UI, causing the hang

Solution:
Instead of sending askResponse for command_output messages, we now:

  1. Send terminalOperation: "continue" with the user's text/images attached
  2. Clear input fields but skip handleChatReset() to keep UI responsive
  3. In the backend, if terminalOperation includes text/images, resolve the pending ask via handleWebviewAskResponse() so the loop can continue with the user's message

Files Changed:

  • webview-ui/src/components/chat/ChatView.tsx: Special case for command_output in handleSendMessage()
  • src/core/webview/webviewMessageHandler.ts: Pass text/images from terminalOperation to Task
  • src/core/task/Task.ts: Extended handleTerminalOperation() to optionally resolve pending ask

Test Procedure

  1. Start Roo Code and give it a task that runs a long-running command (e.g., npm install in a large project)
  2. While the command is running (showing "Proceed While Running" button), type a message in the input and press send
  3. Verify that:
    • The UI remains responsive (not grayed out/disabled)
    • The command continues running in the background
    • Your message is captured and will be included in the next assistant response

TypeScript compilation passes for both src/ and webview-ui/.

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: New and/or updated tests have been added to cover my changes (if applicable).
  • Documentation Impact: I have considered if my changes require documentation updates (see "Documentation Updates" section below).
  • Contribution Guidelines: I have read and agree to the Contributor Guidelines.

Screenshots / Videos

N/A - This is a behavior/timing fix, not a UI change.

Documentation Updates

  • No documentation updates are required.

Additional Notes

This is a draft PR. Feedback and guidance are welcome. The fix takes a different approach than the existing "Proceed While Running" button - it allows user messages to be captured and passed through while keeping the UI responsive.

Note: There is a separate PR #10563 that addresses a related but different issue (inline terminal shell configuration). This PR specifically fixes the original hang bug.

Get in Touch

N/A - Automated contribution


Important

Fix UI hang by sending terminalOperation instead of askResponse during command_output in ChatView.tsx and webviewMessageHandler.ts.

  • Behavior:
    • In ChatView.tsx, handleSendMessage() now sends terminalOperation: "continue" for command_output messages, skipping handleChatReset() to keep the UI responsive.
    • In webviewMessageHandler.ts, terminalOperation messages pass text/images to handleTerminalOperation().
  • Functions:
    • handleTerminalOperation() in Task.ts resolves pending asks with user messages if terminalOperation includes text/images.
  • Misc:
    • Adjustments ensure the UI does not hang when sending messages during command_output state.

This description was created by Ellipsis for 2712853. You can customize this summary. It will automatically update as commits are pushed.

When a user sends a message while a command is running (command_output state),
the UI would hang because handleChatReset() disabled all inputs but no new
command_output ask was sent to re-enable them (since runInBackground became true).

This fix changes the behavior so that:
1. For command_output, send terminalOperation with the user message instead of
   askResponse
2. Clear the input fields but skip handleChatReset() to keep UI responsive
3. In backend, if terminalOperation includes text/images, resolve the pending
   ask so the loop can continue

Fixes #10329
@roomote
Copy link
Contributor Author

roomote bot commented Jan 9, 2026

Rooviewer Clock   See task on Roo Cloud

Review complete. No issues found.

The implementation correctly addresses the root cause of the UI hang when sending messages during command_output state:

  • Type Safety: The WebviewMessage interface already supports text and images fields, so the changes are type-safe.
  • Logic Correctness: Routing command_output messages through terminalOperation instead of askResponse prevents the UI reset that caused the hang.
  • Edge Cases: The existing api_req_started handler properly disables the UI when a new API request begins.
  • Backward Compatibility: Existing button handlers continue to work correctly.

Note: The Testing checkbox is unchecked in the PR checklist. Adding unit tests for handleTerminalOperation() with text/images parameters would be valuable.

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 Jan 9, 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] Send Message to Proceed While Running Hangs Roo

3 participants