Skip to content

Add one-time nudge when assistant commits to edit intent without editing files#310

Open
mmprotest wants to merge 2 commits into
mainfrom
mmprotest/improve-runner-reliability-with-follow-up-nudge
Open

Add one-time nudge when assistant commits to edit intent without editing files#310
mmprotest wants to merge 2 commits into
mainfrom
mmprotest/improve-runner-reliability-with-follow-up-nudge

Conversation

@mmprotest

Copy link
Copy Markdown
Owner

Motivation

  • The runner sometimes accepts a final assistant prose turn that explicitly commits to a concrete code change but no file write/patch was performed, causing lost edits and reduced reliability.
  • Provide a minimal, bounded follow-up to let the assistant apply the described minimal edit without changing runner architecture or affecting plan-only flows.

Description

  • Add a conservative heuristic helper response_commits_to_code_edit(text: str) -> bool to detect explicit edit commitment while excluding suggestion/analysis phrasing (e.g., "one possible fix would be", "you could update").
  • In the runner completion path, if the assistant’s final text matches the heuristic and no edit occurred, inject a single generic user nudge: "You described a concrete code change, but no file was modified. Apply the minimal edit now, then verify if possible.", then continue for one more model turn.
  • Gate the behavior behind a one-time-per-run flag self._edit_intent_nudge_used and skip it in planning read-only mode to avoid affecting analysis/plan-only tasks.
  • Emit a lightweight runtime event edit_intent_without_edit_nudged when the nudge is used and add unit tests for the heuristic.

Testing

  • Added tests in tests/test_state_runtime.py covering positive and negative examples for response_commits_to_code_edit and ran pytest -q tests/test_state_runtime.py -k "response_commits_to_code_edit", which passed (2 passed).
  • Ran full pytest -q tests/test_state_runtime.py, which passed (34 passed).
  • Files changed: villani_code/state_runtime.py, villani_code/state.py, and tests/test_state_runtime.py.
  • Commands run during verification: pytest -q tests/test_state_runtime.py -k "response_commits_to_code_edit" and pytest -q tests/test_state_runtime.py, both succeeded.

Codex Task

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