Skip to content

Lock recovery to active solution file and harden validation commands#284

Merged
mmprotest merged 1 commit into
mmprotest/implement-shell-normalization-for-command-executionfrom
mmprotest/tighten-recovery-behavior-and-validation-checks
Apr 11, 2026
Merged

Lock recovery to active solution file and harden validation commands#284
mmprotest merged 1 commit into
mmprotest/implement-shell-normalization-for-command-executionfrom
mmprotest/tighten-recovery-behavior-and-validation-checks

Conversation

@mmprotest

Copy link
Copy Markdown
Owner

Motivation

  • Prevent recovery-mode escape by pivoting to a different top-level entrypoint file and stop delete-and-regenerate tactics.
  • Make validation/launch steps conservative so shell constructs cannot trivially mask failures.
  • Keep changes minimal and localized to recovery, tooling, and validation handling without large redesigns.

Description

  • Add a compact runner state field ._active_solution_file and initialize/reset it in Runner (villani_code/state.py) to track the active solution path.
  • Seed ._active_solution_file when a focused mutation/verification target is first registered in execute_tool_with_policy (villani_code/state_tooling.py) and from run_verification when appropriate.
  • Anchor recovery protections in small_model_tool_guard (villani_code/state_runtime.py) to the active_solution_file (falling back to failing_file), blocking deletion/full-rewrite of the active solution path while allowing edits to helper modules and returning compact JSON feedback when blocked.
  • Detect suspicious shell masking patterns via _command_has_masking_patterns, classify validation/launch intent with _is_validation_or_launch_command, and extract python entrypoint targets with _extract_command_python_target in state_runtime.py, blocking obvious masked validation/launch commands and preventing run/validate pivots to a different entrypoint during recovery.
  • Exclude masked command records from validation artifacts in collect_validation_artifacts (villani_code/state_execution.py) so masked commands cannot advance verification.
  • Preserve conservative failing/active alignment so helper-module failures do not automatically switch active_solution_file but hard failures on the active file keep both fields aligned; events include active_solution_file where relevant.

Testing

  • Added unit tests and changes in tests/test_state_tooling_mutation_policy.py, tests/test_state_runtime.py, and new tests/test_state_execution.py covering active-solution locking, allowed helper edits, parallel-entrypoint blocking, and masked-command handling.
  • Run: pytest -q tests/test_state_tooling_mutation_policy.py tests/test_state_runtime.py tests/test_state_execution.py produced 53 passed (all targeted tests passed).
  • No unrelated failures observed in this targeted test run.

Codex Task

@mmprotest mmprotest merged commit c56fe23 into mmprotest/implement-shell-normalization-for-command-execution Apr 11, 2026
2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant