Fix navigation cleanup under all exit paths#41
Draft
pascalzauberzeug wants to merge 2 commits into
Draft
Conversation
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.
Motivation
With rosys#403, the automator now closes the wrapped coroutine on stop, raising
GeneratorExitinsidestart(). Awaitingself.finish()from thefinallyblock was not safe under.Implementation
_is_preparedboolean with_finish_task: Task | Nonethat tracks the actual in-flight cleanup.is_readyproperty combines "no upcoming path" and "no cleanup in flight";start()early-returns with a user-visible warning if called while a previous run is still cleaning up.finallyofstart(), schedulefinish()viarosys.background_tasks.create(...)instead of awaiting it — this sidesteps theGeneratorExitconstraint while keeping cleanup tied to the automation's lifecycle.finish()no longer guards on_is_prepared; it clears_finish_taskat the end and notifies the user that the navigation was cleaned up.Risks / Notes
finish()now runs detached fromstart(), so wheels stop and implement deactivation complete shortly after the automator reports done. Subscribers toAUTOMATION_STOPPED/AUTOMATION_FAILEDthat assumed cleanup had finished must be reviewed.finish()itself raises,_finish_taskis never cleared and the navigation stays in a non-ready state until the process restarts.Progress