Fix callback cleanup on error in flow controllers#51
Merged
Randomizez merged 2 commits intoApr 28, 2026
Conversation
In SimpleFlowController, if flow_callback raises (genable_allow_errors=False), active_counter was never decremented, causing _generation_worker to spin forever at `while active_counter: time.sleep(1)`. In FullyAsyncFlowController, the same raise path left the genable in running_genables permanently, blocking staleness checks and potentially deadlocking _wait_for_next_weight. Fix: use try/finally (Simple) and try/except+re-raise (FullyAsync) to ensure cleanup always runs. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Add ErrorGenerationController that simulates generation failures. Three tests verify the pipeline doesn't hang when errors occur: - FullyAsync: error with allow_errors continues without hanging - FullyAsync: running_genables cleaned up after error - Simple: active_counter decremented after error Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
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
flow_callbackin bothSimpleFlowControllerandFullyAsyncFlowController: when generation errors occur, cleanup (active_counter -= 1/running_genables.pop()) now always runs, preventing silent deadlocks.ErrorGenerationControllerto verify no hang on generation failure.Test plan
test_fully_async_error_with_allow_errors_does_not_hangtest_fully_async_error_cleans_up_running_genablestest_simple_controller_error_with_allow_errors_does_not_hang🤖 Generated with Claude Code