Add event-driven patch-recovery controller for failed Patch/Edit operations#307
Open
mmprotest wants to merge 1 commit into
Open
Add event-driven patch-recovery controller for failed Patch/Edit operations#307mmprotest wants to merge 1 commit into
mmprotest wants to merge 1 commit into
Conversation
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
runner._patch_recovery_state,runner._patch_recovery_pending_turn,runner._patch_recovery_attempts_by_fileand mission fieldslast_patch_failure,recent_tool_failures, anddirty_temp_files(files:villani_code/state.py,villani_code/mission_state.py).state_runtime: extract target file and failed hunk, match anchor lines in the current file, build a compact context slice (default ~20 lines radius, hard cap ~120 lines), record structured state (target_file,error,failed_hunk,refreshed_context,attempts_for_file,next_required_action) and emit concise events (patch_failure_detected,patch_recovery_context_refreshed,patch_recovery_instruction_injected) (file:villani_code/state_runtime.py).prepare_messages_for_model, and clear recovery state when a subsequent successfulPatch/Edittargets the same file (files:villani_code/state_runtime.py,villani_code/state.py).state_toolingthat blocks or discourages immediate shell-based rewrites of the same target file while patch recovery is active and fewer than two refreshed patch retries have run, while still allowing read-only and test/inspection shell commands (file:villani_code/state_tooling.py).tests/test_patch_recovery_controller.py).Testing
pytest -q tests/test_patch_recovery_controller.py tests/test_state_tooling_mutation_policy.pyand observed all tests passing (12 passed).pytest -q tests/test_loop.py::test_tool_result_followup_is_pure_tool_result_message tests/test_villani_failure_modes.py::test_first_attempt_locked_target_rejects_extra_file_before_verificationand observed both tests passing (2 passed).Codex Task