fix: recover orchestrators stuck stopping - #16
Merged
Conversation
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
|
Warning Review limit reachedNext included review available in 59 minutes. View limit detailsLimit details: You’ve used the included review currently available. You've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository. Review configuration: ⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Team Run ID: 📒 Files selected for processing (9)
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 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
An orchestrator could remain indefinitely in Stopping after the Host and owning Node restarted. The persisted session retained
stopRequested=true, but the previous recovery path only reconciled sessions whose state was exactlyoffline. Older Stop intents could therefore be skipped, Resume stayed blocked, and the UI did not explain which Node still owed the acknowledgement.The live affected example was UX E2E Tests. Its lead session belonged to Node Sihan, which had not reconnected after the Host restart. The owned worker sessions were already stopped, while the lead remained offline with a pending Stop request.
Root cause
Stop completion requires authoritative knowledge from the Node that owns the process:
Changes
Reconcile persisted Stop intents
stopRequested=true, except queued launches.Recover from authoritative Node inventory
When the owning Node reconnects:
stopRequested.This preserves Node inventory as the primary source of truth and keeps Stop handling idempotent.
Recover when the Node remains unavailable
Make the pending state explicit
Recovery precedence and safety
The implementation intentionally does not use Host startup's reset
activeSessions=0value as proof that work ended, because that value describes Host connectivity rather than the remote process lifecycle.User-visible result
Orchestrators no longer remain permanently stranded in Stopping after normal reconnect reconciliation. When the owning Node is unavailable, the UI clearly identifies that Node and gives the operator a safe, explicit way to settle known-dead work and Resume the conversation.
Validation
npm run verifysuccessfully, including lint, formatting, type checking, the full test suite, and production Host/Node builds.