Skip to content

fix: correct /undo prompt to match actual git reset --soft behavior#4928

Open
karesansui-u wants to merge 1 commit intoAider-AI:mainfrom
karesansui-u:fix/undo-prompt-hard-vs-soft
Open

fix: correct /undo prompt to match actual git reset --soft behavior#4928
karesansui-u wants to merge 1 commit intoAider-AI:mainfrom
karesansui-u:fix/undo-prompt-hard-vs-soft

Conversation

@karesansui-u
Copy link
Copy Markdown

Bug description

undo_command_reply in prompts.py tells the LLM that git reset --hard HEAD~1 was executed, but commands.py L644 actually runs git reset --soft HEAD~1.

This causes the LLM to believe all changes were discarded (working tree clean), when they are actually still staged. Subsequent editing decisions are based on an incorrect understanding of the repository state.

Fix

Update the prompt string to accurately describe the --soft reset and mention that changes remain staged.

Steps to reproduce

  1. Start aider and request a code edit
  2. Run /undo
  3. Ask the AI to "improve the previous change"
  4. The AI starts from scratch instead of working with the staged changes, because it believes --hard wiped everything

Affected files

  • aider/prompts.py (L25-29) — 1 line change

The undo_command_reply tells the LLM that `git reset --hard HEAD~1` was
executed, but commands.py actually runs `git reset --soft HEAD~1`. This
causes the LLM to believe all changes were discarded when they are
actually still staged, leading to incorrect editing decisions.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant