processes.watch: Drain queued watch events before restarting processes#2735
Merged
domenkozar merged 4 commits intoApr 12, 2026
Merged
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.
DISCLAIMER: Both bug triage, fix and most of this summary is AI Generated (Codex 5.4).
Summary
This fixes a restart storm issue in the native process manager where a single file-save burst could cause multiple back-to-back process restarts.
Before this change, the supervisor restarted as soon as it received one watch event, but it did not drain additional already-queued file watcher events first. In practice, one logical change could generate several filesystem events, so the process could restart repeatedly for what was really just one edit.
No cooldown or arbitrary sleep-based debounce was added. The fix is purely queue draining.
User impact
Users could see:
devenv upbehavior when editors emitted multiple filesystem eventsRoot cause
The file watcher debounced raw events into batches, but it still forwarded matching paths one-by-one. The supervisor treated every received watch event as an independent restart trigger.
That meant a single save operation could look like:
Fix
When the supervisor receives a file watcher event, it now:
This keeps behavior deterministic without introducing timing hacks.
Tests
Relevant watcher and supervisor test suites pass after this change:
cargo test -p devenv-event-sources fs::tests:: -- --nocapturecargo test -p devenv-processes supervisor -- --nocapture