Skip to content

fix: Include user-added files in commit message context#4927

Closed
BillionClaw wants to merge 1 commit intoAider-AI:mainfrom
BillionClaw:fix/commit-message-user-added-context
Closed

fix: Include user-added files in commit message context#4927
BillionClaw wants to merge 1 commit intoAider-AI:mainfrom
BillionClaw:fix/commit-message-user-added-context

Conversation

@BillionClaw
Copy link

Problem

When files are added to the chat via the "/add" command, the commit message generator was not aware of these files because no message was being added to the chat history. The commit message generation uses "get_context_from_history(self.cur_messages)" to gather context, but since the "/add" command didn't add any message to the chat history, the commit messages didn't include information about user-added files.

Solution

Modified "cmd_add()" in "aider/commands.py" to:

  1. Track which files are successfully added to the chat
  2. Return a message in the format "I added these files to the chat: {fnames}" when files are added
  3. This message gets added to "cur_messages" and is included in the commit message context

This follows the same pattern used when files are added via file mentions in "check_for_file_mentions()".

Changes

  • Added "from aider import prompts" import
  • Added "added_fnames" list to track added files
  • Added "added_fnames.append()" calls when files are added (both new files and files promoted from read-only)
  • Added return statement with the formatted message when files are added

Fixes #728

When files are added via /add command, the commit message generator
was not aware of these files because no message was added to the chat
history. This fix returns a message from cmd_add that gets added to
the chat history, which is then included in the context used for
generating commit messages.

Fixes Aider-AI#728
@BillionClaw
Copy link
Author

Closing — unable to complete the CLA process for this organization. Apologies for the noise.

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.

Shouldn't ask to add not existing files to the chat

1 participant