Skip to content

Conversation

@roomote
Copy link
Contributor

@roomote roomote bot commented Jul 23, 2025

This PR fixes issue #6137 where Roo Code gets stuck with a spinning indicator when using OpenRouter with Claude Sonnet 4.

Problem

Users were experiencing indefinite hanging when using OpenRouter as their API provider. The application would show a spinning indicator and never proceed after displaying the file list.

Solution

Added timeout mechanisms to prevent OpenRouter streams from hanging:

  1. First chunk timeout (30 seconds): Added a timeout specifically for OpenRouter in Task.ts that prevents the first chunk await from hanging indefinitely
  2. Stream chunk timeout (60 seconds): Added monitoring in OpenRouterHandler to detect when no data has been received for an extended period
  3. Clear error messages: When timeouts occur, users now receive informative error messages explaining the issue and suggesting alternatives

Changes

  • Modified src/core/task/Task.ts to add timeout logic for OpenRouter first chunk
  • Modified src/api/providers/openrouter.ts to add stream timeout monitoring
  • All tests pass and linting issues have been resolved

Testing

  • Ran unit tests for both modified files
  • All type checks pass
  • Linting passes with no warnings

Fixes #6137


Important

Adds timeout mechanisms in Task.ts and openrouter.ts to prevent OpenRouter stream hanging, with clear error messages for users.

  • Behavior:
    • Adds a 30-second timeout for the first chunk in Task.ts to prevent indefinite hanging with OpenRouter.
    • Implements a 60-second timeout between stream chunks in OpenRouterHandler in openrouter.ts.
    • Provides clear error messages to users when timeouts occur, suggesting alternatives.
  • Files Modified:
    • Task.ts: Adds timeout logic for OpenRouter's first chunk.
    • openrouter.ts: Adds stream timeout monitoring.
  • Testing:
    • All unit tests pass.
    • Type checks and linting pass with no warnings.

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

- Add 30-second timeout for first chunk in Task.ts specifically for OpenRouter
- Add chunk timeout monitoring in OpenRouterHandler to detect hanging streams
- Provide clear error messages when timeouts occur
- Fixes #6137 where OpenRouter requests would hang indefinitely
@roomote roomote bot requested review from cte, jr and mrubens as code owners July 23, 2025 20:59
@dosubot dosubot bot added size:M This PR changes 30-99 lines, ignoring generated files. bug Something isn't working labels Jul 23, 2025
@roomote roomote bot mentioned this pull request Jul 23, 2025
@hannesrudolph hannesrudolph added the Issue/PR - Triage New issue. Needs quick review to confirm validity and assign labels. label Jul 23, 2025
@daniel-lxs
Copy link
Member

This fix is too specific, the issue doesn't have enough information to propose a fix just yet

@daniel-lxs daniel-lxs closed this Jul 24, 2025
@github-project-automation github-project-automation bot moved this from Triage to Done in Roo Code Roadmap Jul 24, 2025
@github-project-automation github-project-automation bot moved this from New to Done in Roo Code Roadmap Jul 24, 2025
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:M This PR changes 30-99 lines, ignoring generated files.

Projects

Archived in project

Development

Successfully merging this pull request may close these issues.

Roocode gets stuck

4 participants