-
Notifications
You must be signed in to change notification settings - Fork 2.1k
Fix gray state recovery for subtask completion failures #5893
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
…on failures - Add error recovery in Task.resumePausedTask() to handle provider disconnections gracefully - Enhance Task.recursivelyMakeClineRequests() with recovery mechanisms for API failures - Add ClineProvider.recoverFromGrayState() method with multiple recovery strategies - Enhance ClineProvider.finishSubTask() with comprehensive error handling - Add UI state validation in ChatView.tsx to detect and recover from gray state - Include comprehensive test suite for gray state recovery mechanisms Fixes #5892: Gray state issue where Orchestrator subtask completion with provider disconnection leaves parent task unusable
@roomote-agent use the switch_task tool with the pr-fixer mode to fix the unit tests of this PR, do not create a new PR |
👋 I've received your request to fix the unit tests for this PR. I can see there are TypeScript compilation errors in the test file that need to be resolved. I'll check out the branch and fix these issues now. |
- Remove invalid clineStack property from ClineProvider mock (private property) - Remove invalid webview property from ClineProvider mock (non-existent property) - Tests now compile and pass successfully (8/8 tests passing) - Fixes compilation errors that were blocking CI checks
Unit test compilation errors fixed! I have successfully resolved the TypeScript compilation errors in the gray state recovery tests. Issues Fixed:
Results:
The fix involved updating the test mocks to only use public methods and properties that actually exist on the ClineProvider class. The gray state recovery functionality itself remains intact and properly tested - this was purely a test infrastructure fix to resolve compilation issues that were blocking CI. |
I'm closing this due to a fundamental architectural issue with the approach. This PR implements recovery mechanisms for a "gray state" that shouldn't exist. The root issue is in the state management logic - when a provider disconnection occurs during Instead of adding recovery logic across multiple components, the solution should:
The current approach adds complexity and race conditions (like the 2-second timeout) without addressing the underlying issue. A new PR should focus on preventing the gray state rather than recovering from it. |
This PR implements a comprehensive solution for issue #5892 - the gray state problem where Roo gets stuck when an Orchestrator task creates a subtask that completes successfully, but the provider gets disconnected during the process.
Problem
When an Orchestrator creates a subtask using
new_task
and the subtask completes successfully, but a provider disconnection occurs duringfinishSubTask()
orresumePausedTask()
, the parent task becomes stuck in a "gray state" where:isStreaming = false
(task appears inactive)enableButtons = false
(user cannot interact)This leaves users unable to cancel, finish, or interact with the task.
Solution
Implemented multi-layer error recovery mechanisms:
1. Task-Level Recovery (
src/core/task/Task.ts
)resumePausedTask()
with graceful error handling instead of throwing exceptionsrecursivelyMakeClineRequests()
for API failures2. Provider-Level Recovery (
src/core/webview/ClineProvider.ts
)recoverFromGrayState()
method with multiple recovery strategiesfinishSubTask()
with comprehensive error handling3. UI-Level Validation (
webview-ui/src/components/chat/ChatView.tsx
)4. Comprehensive Testing (
src/tests/grayStateRecovery.test.ts
)Recovery Strategies
Testing
Fixes #5892
Important
Fixes gray state issue by implementing multi-layer recovery mechanisms in
Task.ts
,ClineProvider.ts
, andChatView.tsx
, with comprehensive testing ingrayStateRecovery.test.ts
.Task.ts
andClineProvider.ts
by enhancing error handling inresumePausedTask()
andfinishSubTask()
.recoverFromGrayState()
inClineProvider.ts
to handle task state recovery.ChatView.tsx
and attempts automatic recovery with a 2-second delay.grayStateRecovery.test.ts
to test recovery scenarios, including provider disconnections and API failures.ChatView.tsx
to handle gray state detection and recovery.This description was created by
for 37cac2e. You can customize this summary. It will automatically update as commits are pushed.