Bounded recovery loop for hard verification failures#283
Merged
mmprotest merged 1 commit intoApr 11, 2026
Conversation
c436588
into
mmprotest/implement-shell-normalization-for-command-execution
2 checks 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 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.
Motivation
Description
_recovery_mode,_failing_file,_failing_error_summary,_failing_command,_file_was_read_since_failure) and initialize/reset it at run start inRunner(villani_code/state.py).run_verificationinvillani_code/state_runtime.pyvia_detect_hard_failure(...)and when found: forceVerificationStatus.FAIL, reduce confidence, capturefailing_file/error_summary/failing_command, and activaterecovery_mode; clear recovery only after a successful verification pass or repaired state.small_model_tool_guard(...)invillani_code/state_runtime.pyto: block edits that are not targeted at the active failing file, block edits to the failing file until it has been read since the failure, block delete/regenerate (patch delete or emptyWrite) and large rewrites of the failing file, and return compact JSON feedback via_recovery_blocked_feedback(...).execute_tool_with_policy(...)(villani_code/state_tooling.py) so recovery checks run regardless of small-model/benchmark flags, and mark the failing-file read flag (_file_was_read_since_failure) on successfulReadtool results in bothstate_tooling.execute_tool_with_lifecycleand the runner tool loop (villani_code/state.py).villani_code/state_runtime.py(hard-failure detection, helpers, guard extension),villani_code/state.py(runner fields, tool-loop read/flag handling, reset),villani_code/state_tooling.py(apply guard earlier, mark read), and tests updated/added intests/test_state_runtime.pyandtests/test_state_tooling_mutation_policy.py.Testing
test_syntax_error_does_not_mark_verification_pass,test_name_error_does_not_mark_verification_pass,test_hard_failure_sets_recovery_mode_state,test_successful_rerun_clears_recovery_mode,test_recovery_mode_blocks_delete_of_active_failing_file,test_recovery_mode_blocks_edit_without_read_first, andtest_read_failing_file_flips_recovery_read_flagin the two modified test files.pytest -q tests/test_state_runtime.py tests/test_state_tooling_mutation_policy.pyand observed all tests passing:47 passed.Codex Task