fix: Fix 'Restart Workspace from Local Devfile' for empty workspace use case#746
fix: Fix 'Restart Workspace from Local Devfile' for empty workspace use case#746RomanNikitenko wants to merge 3 commits into
Conversation
|
Pull Request images published ✨ Editor amd64: quay.io/che-incubator-pull-requests/che-code:pr-746-amd64 |
|
Hi! I'm che-ai-assistant — I help with your pull requests. Available commands:
|
Signed-off-by: Roman Nikitenko <rnikiten@redhat.com> Assisted-by: Cursor AI
1f574dd to
da5028b
Compare
|
Pull Request images published ✨ Editor amd64: quay.io/che-incubator-pull-requests/che-code:pr-746-amd64 |
…r restarts a workspace Signed-off-by: Roman Nikitenko <rnikiten@redhat.com> Assisted-by: Cursor AI
|
Pull Request images published ✨ Editor amd64: quay.io/che-incubator-pull-requests/che-code:pr-746-amd64 |
|
Warning Review limit reached
Next review available in: 40 minutes Enable usage-based reviews in Billing to review now. Otherwise, wait until the next included review is available. How can I continue?After more reviews become available, a review can be triggered using the To avoid repeated limits, reduce automatic review volume by pausing incremental auto-reviews earlier, using label-based review opt-in, excluding WIP or generated PR titles, or requesting reviews manually when the PR is ready. If your team needs uninterrupted high-volume reviews, an organization admin can enable usage-based reviews. How do review limits work?CodeRabbit enforces per-developer PR review limits for each organization. Most developers receive the normal plan review availability. For paid Pro and Pro+ PR reviews, CodeRabbit uses adaptive limits for sustained high-volume activity. When a developer's recent PR review activity reaches the 95th percentile or higher among CodeRabbit users, additional reviews become available more gradually as earlier reviews age out of the rolling window. Please refer docs for additional details. Review details⚙️ Run configurationConfiguration used: Path: .coderabbit.yaml Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (1)
📝 WalkthroughWalkthroughDevWorkspaceAssistant is updated to stop and restart the dev workspace using the Che Dashboard browser-side PATCH API instead of a remote command with client-side polling. New polling constants and an Estimated code review effort: 3 (Moderate) | ~25 minutes Sequence Diagram(s)sequenceDiagram
participant CheDisconnectionHandler
participant DevWorkspaceAssistant
participant DashboardApi
CheDisconnectionHandler->>DevWorkspaceAssistant: stopWorkspaceAndRedirectToDashboard()
DevWorkspaceAssistant->>DevWorkspaceAssistant: set _isStopping = true
DevWorkspaceAssistant->>DashboardApi: PATCH /spec/started=false
DevWorkspaceAssistant->>DevWorkspaceAssistant: redirect to dashboard
Note over CheDisconnectionHandler: subsequent handle() calls
CheDisconnectionHandler->>DevWorkspaceAssistant: check isStopping
DevWorkspaceAssistant-->>CheDisconnectionHandler: true (skip further handling)
Alterations to the declarations of exported or public entities
Suggested labels: che, remote, bug Suggested reviewers: che-incubator maintainers familiar with remote workbench and dev workspace lifecycle Poem: Important Pre-merge checks failedPlease resolve all errors before merging. Addressing warnings is optional. ❌ Failed checks (1 error)
✅ Passed checks (4 passed)
✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
Actionable comments posted: 3
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@code/src/vs/workbench/contrib/remote/browser/che/devWorkspaceAssistant.ts`:
- Around line 150-155: The timeout handling in waitForStopped() currently
resolves after STOP_TIMEOUT_MS for every caller, which allows the flow around
the start/navigation path to continue while the workspace is still stopping.
Update the stop-wait logic in DevWorkspaceAssistant.waitForStopped and the
caller near the navigation/start sequence so that a timeout does not trigger a
restart or proceed to start; instead, only continue once the stopped state is
actually observed, or fail/abort the flow when the stop timeout is reached.
- Around line 196-205: The restart/stop flow leaves _isStopping stuck true when
stopWorkspaceViaDashboardApi or waitForStopped rejects, which keeps
CheDisconnectionHandler.handle() from recovering. Update doRestart and
stopWorkspaceAndRedirectToDashboard to reset _isStopping on failure, preferably
by wrapping the stop/poll sequence in try/finally or equivalent error handling
so the flag is cleared whenever the operation does not complete successfully.
- Around line 136-143: The stop request in devWorkspaceAssistant should fail
fast when the PATCH does not succeed, because requestService.request may resolve
with a non-2xx response context and the flow can continue incorrectly. Update
the request handling in the stop path around requestService.request in
devWorkspaceAssistant to inspect context.res.statusCode after the PATCH, and
throw an error before any redirect or restart logic continues when the status
indicates failure.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Path: .coderabbit.yaml
Review profile: CHILL
Plan: Pro
Run ID: 90df71f6-afa8-459a-8103-fc849729b915
📒 Files selected for processing (2)
code/src/vs/workbench/contrib/remote/browser/che/devWorkspaceAssistant.tscode/src/vs/workbench/contrib/remote/browser/che/remote.ts
Signed-off-by: Roman Nikitenko <rnikiten@redhat.com> Assisted-by: Cursor AI
|
Pull Request images published ✨ Editor amd64: quay.io/che-incubator-pull-requests/che-code:pr-746-amd64 |
What does this PR do?
Restart Workspace from Local Devfilecommand hangs when used in workspaces without a pre-cloned git repo. TherestartWorkspace()method callsstopWorkspacevia the extension host, but the extension host dies when the workspace stops, leaving theawaithanging forever — the browser never redirects.What issues does this PR fix?
https://redhat.atlassian.net/browse/CRW-9559
How to test this PR?
Restart Workspace from Local Devfileuse casequay.io/che-incubator-pull-requests/che-code:pr-746-amd64in theEditor ImagefieldEmpty WorkspaceClone Repositoryin theExplorerwhen the workspace startshttps://github.com/RomanNikitenko/web-nodejs-sample.git=>Clone from URL=>Select as Repository Destination:/projects=>Add to WorkspaceF1=>Restart Workspace from Local DevfileExpected result:
Cannot reconnect. Please reload the window.dialog is not displayed.Stop Workspacecommand use caseStop Workspacecommand is also affected by the current PR changesquay.io/che-incubator-pull-requests/che-code:pr-746-amd64in theEditor ImagefieldF1=>Stop Workspacewhen the workspace is ready to useExpected result:
Does this PR contain changes that override default upstream Code-OSS behavior?
git rebasewere added to the .rebase folderSummary by CodeRabbit
New Features
Bug Fixes