fix: stale recovery state from crashed run poisons reprompt#572
Merged
Muizzkolapo merged 2 commits intoMay 19, 2026
Merged
Conversation
The original batch path loaded recovery_state from disk and passed it to check_and_submit_reprompt. If a previous run crashed after writing state, the stale reprompt_attempt counter caused the next fresh run to skip reprompt (believing attempts were exhausted). Two fixes: 1. _process_original_batch no longer loads recovery state — in the original batch path, any existing file is stale by definition. 2. _finalize_batch_output now deletes any leftover recovery state file before finalizing, matching the cleanup already done in the recovery path's _finalize_and_cleanup.
test_process_original_batch_ignores_stale_recovery_state already verifies that recovery_state=None is passed and RecoveryStateManager.load is not called. The removed test duplicated this assertion with a fragile side_effect capture pattern.
1b5e19c
into
integration/batch-online-unification
1 check passed
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 subscribe to this conversation on GitHub.
Already have an account?
Sign in.
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
_process_original_batchloadedrecovery_statefrom disk and passed it tocheck_and_submit_reprompt. If a previous run crashed after writing state, the stalereprompt_attemptcounter caused the next fresh run to skip reprompt entirely (believing attempts were exhausted)._finalize_batch_outputnow deletes any leftover recovery state file before finalizing, matching the cleanup already done in the recovery path's_finalize_and_cleanup.Verification
test_process_original_batch_ignores_stale_recovery_stateto assertrecovery_state=None(was asserting buggy behavior)TestStaleRecoveryStatewith 2 regression tests:test_stale_state_does_not_skip_reprompt— stale exhausted state does not prevent fresh reprompttest_finalize_deletes_stale_recovery_state— finalization cleans up leftover state files