Skip to content

fix: recover Continue process after unexpected exceptions - #7463

Merged
Patrick-Erichsen merged 1 commit into
mainfrom
exigow/robust-process
Aug 29, 2025
Merged

Patrick-Erichsen merged 1 commit into
mainfrom
exigow/robust-process

Conversation

@exigow

@exigow exigow commented Aug 28, 2025 •

Copy link
Copy Markdown
Contributor

Solves CON-3587
Solves #7018
Solves #7121
Solves #5505
Solves #3981, and possibly other Stream closed-like errors

Main change

Now, if some exception bubbles up at any stage (whether it's read, write, anything else within processScope), we catch it via CoroutineExceptionHandler and we restart the process + back-off. Type of exception is not important / now it's more like black-box approach.

This simplifies things quite a bit, since we now have only single piece of code for process recovery.

Detailed changes

  • The process now recovers from exceptions globally, without specifying the type of exception (more of a black-box approach).
  • Remove CoreMessengerManager, since process recovery is now implemented in ContinueProcessHandler.
  • Add a back-off utility for calculating delays between process recovery retries (just a cleanup).
  • Restore ContinuePluginService.dispose() (because Disposable was accidentally removed during the last changes in the Next Edit - that's not critical, but it was causing exceptions when closing the application/during plugin disposal).
  • Remove the artificial delay between reading messages (from now on, blocking happens directly on readLine).

Manual testing

  • I didn't notice any regressions
  • The Restart Process action works correctly, and the binary restarts immediately
  • Killing the process externally causes the binary to restart
  • Closing the IDE does not orphan the process

@exigow
exigow force-pushed the exigow/robust-process branch from c497db0 to 3451e8d Compare August 29, 2025 14:13
@exigow
exigow marked this pull request as ready for review August 29, 2025 14:29
@exigow
exigow requested a review from a team as a code owner August 29, 2025 14:29
@dosubot dosubot Bot added the size:L This PR changes 100-499 lines, ignoring generated files. label Aug 29, 2025
@exigow

exigow commented Aug 29, 2025 •

Copy link
Copy Markdown
Contributor Author

@Patrick-Erichsen, 🟢 + WIP commits squashed

@github-actions

Copy link
Copy Markdown
Contributor

⚠️ AI review completed but no review output was generated. Check the action logs for details.


💡 To request a new review, comment @continue-general-review

Solves CON-3587
Solves #7018
Solves #7121
Solves #5505
Solves #3981, and possibly other Stream closed-like errors

## Main change

Now, if some exception bubbles up at any stage (whether it's read, write, anything else within `processScope`), we catch it via `CoroutineExceptionHandler` and we restart the process + back-off. Type of exception is not important / now it's more like black-box approach.

This simplifies things quite a bit, since we now have only single piece of code for process recovery.

## Detailed changes

* The process now recovers from exceptions globally, without specifying the type of exception (more of a black-box approach).
* Remove `CoreMessengerManager`, since process recovery is now implemented in `ContinueProcessHandler`.
* Add a back-off utility for calculating delays between process recovery retries (just a cleanup).
* Restore `ContinuePluginService.dispose()` (because `Disposable` was accidentally removed during the last changes in the Next Edit - that's not critical, but it was causing exceptions when closing the application/during plugin disposal).
* Remove the artificial delay between reading messages (from now on, blocking happens directly on `readLine`).

@Patrick-Erichsen Patrick-Erichsen left a comment •

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Great cleanup here! The backoff calculator is a nice touch, and getting rid of all the specific error handling really simplifies things. Hopefully removing the artificial 100ms read delays speeds things up a bit too!

@dosubot dosubot Bot added the lgtm This PR has been approved by a maintainer label Aug 29, 2025
@Patrick-Erichsen
Patrick-Erichsen merged commit 35f2d9d into main Aug 29, 2025
@Patrick-Erichsen
Patrick-Erichsen deleted the exigow/robust-process branch August 29, 2025 22:37
@github-actions github-actions Bot locked and limited conversation to collaborators Aug 29, 2025
@sestinj

sestinj commented Sep 1, 2025

Copy link
Copy Markdown
Contributor

🎉 This PR is included in version 1.12.0 🎉

The release is available on:

Your semantic-release bot 📦🚀

@sestinj

sestinj commented Sep 3, 2025

Copy link
Copy Markdown
Contributor

🎉 This PR is included in version 1.12.0 🎉

The release is available on:

Your semantic-release bot 📦🚀

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

lgtm This PR has been approved by a maintainer released size:L This PR changes 100-499 lines, ignoring generated files.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants