test(tui): await reset cancellation before daemon stop release#1536
Merged
Aaronontheweb merged 1 commit intoJul 1, 2026
Merged
Conversation
Aaronontheweb
marked this pull request as ready for review
July 1, 2026 00:02
Aaronontheweb
added a commit
that referenced
this pull request
Jul 3, 2026
…p 3 (#1573) RunResetAsync publishes CurrentProgressStep = 3 ("Purge complete") and then evaluates the Task.Delay(CompletionPause, _timeProvider, ct) that registers the completion-pause timer. Because RunResetAsync runs off the loop, step 3 is the signal observers gate on to know deletion finished — but it fired BEFORE the timer it vouches for existed. On a virtualized clock (FakeTimeProvider in tests, and any consumer advancing the injected TimeProvider) this is a lost wakeup: an Advance that lands between "step 3 published" and "timer registered" is dropped, the delay never fires, and the reset hangs forever awaiting a wakeup that will never come. Fix: create the completion-pause timer before publishing step 3, then await the captured task. This makes "step 3 observed" a happens-before guarantee that the pause timer already exists, so a single clock advance always fires it deterministically. On the real clock this shifts timer registration a few microseconds earlier; the visible "Purge complete" dwell is unchanged. Evidence: hang-dump forensics of CI run 28676578217 (PR #1568, Netclaw.Cli.Tests blame-hang after 300s). Test FullReset_AfterBothConfirmations_DeletesEverything was parked at `await vm.ResetTask!.WaitAsync(ct)`; its CompleteResetAsync helper had exhausted its advance loop (counter i == 10, all virtual-clock advances spent) and FakeTimeProvider was left holding exactly one orphaned waiter — the delay registered after the final Advance. Prior commits 850cf8c (#1525) and eb01b49 (#1536) band-aided the symptom with advance/yield retry loops; this removes the race at the source. The test helper CompleteResetAsync is shared by all three sibling tests (FullReset_AfterBothConfirmations_DeletesEverything, SetupOnlyReset_DeletesConfigButKeepsMemoryAndSessions, DaemonStopFailureResult_ShowsStatusAndContinuesReset); it now waits for step 3 then does exactly one advance, deleting the retry loop that only ever masked the lost wakeup on loaded runners.
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.
Summary
Validation