Skip to content

fix: do not append newlines for an empty system reminder - #5612

Open
BetterAndBetterII wants to merge 1 commit into
Aider-AI:mainfrom
BetterAndBetterII:fix/empty-system-reminder-newlines
Open

fix: do not append newlines for an empty system reminder#5612
BetterAndBetterII wants to merge 1 commit into
Aider-AI:mainfrom
BetterAndBetterII:fix/empty-system-reminder-newlines

Conversation

@BetterAndBetterII

Copy link
Copy Markdown

Summary

Coder.format_chat_chunks treated a missing max_input_tokens as “always add the reminder” because or binds looser than and. With the help coder’s empty system_reminder and reminder="user", that still concatenated "\n\n" onto the last user message even though there was no reminder text.

Require a non-empty reminder before either placement branch. Keep adding a real reminder when the limit is missing or the prompt is under budget.

Closes #5611

Test plan

  • pytest tests/basic/test_coder.py::TestCoder::test_format_chat_chunks_empty_reminder_preserves_user_message
  • pytest tests/basic/test_coder.py::TestCoder::test_format_chat_chunks_reminder_max_input_tokens_combinations
    • empty reminder, missing max_input_tokens → user text unchanged
    • empty reminder, present max_input_tokens → user text unchanged
    • non-empty reminder, missing max_input_tokens"\n\n" + reminder
    • non-empty reminder, present max_input_tokens"\n\n" + reminder

format_chat_chunks treated a missing max_input_tokens as always adding a user reminder. Combined with an empty help-coder reminder, that still concatenated trailing newlines onto the last user message.
@CLAassistant

CLAassistant commented Aug 23, 2026

Copy link
Copy Markdown

CLA assistant check
All committers have signed the CLA.

@BetterAndBetterII

Copy link
Copy Markdown
Author

I have read the CLA Document and I hereby sign the CLA

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.

BUG: Coder.format_chat_chunks appends two newlines for an empty system reminder

2 participants