Repository navigation
Let a Stop() during a pending RestartAsync() win [patch] - #63
Merged
matt-edmondson merged 1 commit intoSep 28, 2026
Merged
Conversation
RestartCoreAsync set ShouldPoll = true after its awaits regardless of what happened meanwhile, so a Stop() that arrived while a restart was waiting for the old loop was overwritten and the action kept running. Stop() now bumps a generation counter; a restart records it when it is requested and ends without starting a loop if a Stop() has happened since. The restart's own internal stop no longer goes through Stop(), so it does not cancel itself. Fixes #57 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01P1dENrzXtWG4vP7thSjyof
|
matt-edmondson
deleted the
claude/intervalaction-57-stop-during-restart
branch
September 28, 2026 01:35
This was referenced Sep 28, 2026
This was referenced Oct 5, 2026
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.



Fixes #57
Problem
RestartCoreAsyncsetShouldPoll = trueonce its awaits finished, whatever had happened while it waited. AStop()that arrived while a restart was still waiting on the old loop was overwritten, and the action kept running. The repro isRestartAsync(); Stop(); await r;.Change
All in
IntervalAction/IntervalAction.cs:Stop()now increments aStopGenerationcounter underLock.RestartAsync()records the counter when the restart is requested. After its awaits, the restart only re-enables polling and starts a loop if the counter hasn't changed; otherwise it ends without starting one.ShouldPolldirectly instead of callingStop(), so the restart doesn't cancel itself.Stop()resumes polling as before.Tests
StopDuringAPendingRestartKeepsTheActionStopped. It stops while the restart is waiting on the old loop's delay, then checks that the loop ends, that the action doesn't run over the next 500 ms, and that a laterRestartAsync()still resumes polling. The wait on the loop is bounded so the test fails rather than hangs if the bug comes back.Related
#61 (Stop() then Restart() leaving an orphaned loop) is already fixed on
mainand covered byRestartRightAfterStopLeavesOnlyOnePollingLoop, so this PR doesn't touch it.🤖 Generated with Claude Code
https://claude.ai/code/session_01P1dENrzXtWG4vP7thSjyof
Generated by Claude Code