Harden regular-runner context state and false completion guard#305
Open
mmprotest wants to merge 3 commits into
Open
Harden regular-runner context state and false completion guard#305mmprotest wants to merge 3 commits into
mmprotest wants to merge 3 commits into
Conversation
…-for-carry-forward-state Use ExecutionMemento as regular-runner carry-forward memory
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
build_fallback_execution_state_block(runner)tovillani_code/execution_memento.pyto render a compact, structured fallback block containingObjective,Success,Current verification,Next action, andConstraints._inject_execution_state_memoryinvillani_code/state_runtime.pyto prefer a valid saved memento but always inject the fallback block when the memento is missing or incomplete, and to include local evidence when available._trim_regular_turn_messagesto preserve all system messages, the earliest non-tool user message as a task anchor, and the recent tail (keeping tool-use/tool-result atomicity), and added a final invariant_ensure_regular_execution_state_invariantthat guaranteesObjective:,Success:, andNext action:markers appear in prepared messages.should_block_regular_completion_on_generic_replyinstate_runtime.pyand a runner wrapper_should_block_regular_completion_on_generic_reply, and invoked this from the regular loop invillani_code/state.pyto catch obvious generic no-tool replies when verification is still failing and either retry once with a focused continuation prompt or terminate asstalled_context_losson repeat.tests/test_state_runtime.pyandtests/test_loop.pyto validate fallback injection, trimming behavior, memento preference, no-duplicate injection, tool-sequence integrity, and the false-completion guard.Testing
tests/test_state_runtime.py::test_prepare_messages_for_regular_runner_injects_execution_memento,tests/test_state_runtime.py::test_prepare_messages_for_model_does_not_duplicate_memento_injection,tests/test_state_runtime.py::test_prepare_messages_falls_back_when_memento_required_fields_missing,tests/test_state_runtime.py::test_prepare_messages_falls_back_when_memento_missing,tests/test_state_runtime.py::test_regular_trim_keeps_original_task_anchor_and_recent_tail,tests/test_state_runtime.py::test_prepare_messages_uses_saved_memento_over_fallback, andtests/test_loop.py::test_regular_runner_generic_reply_with_failing_verification_is_not_success, which all passed.tests/test_state_runtime.py::test_prepare_messages_for_model_regular_trim_keeps_tool_sequence_integrity,tests/test_state_runtime.py::test_prepare_messages_for_model_repeated_calls_do_not_duplicate_injection) and loop tool-result behavior (tests/test_loop.py::test_loop_appends_tool_result_with_matching_id), which also passed.villani_code/execution_memento.py,villani_code/state_runtime.py,villani_code/state.py, and the localized tests mentioned above.Codex Task