Skip to content

fix: preserve chat history when switching with /code - #5892

Open
emme1t wants to merge 1 commit into
Aider-AI:mainfrom
emme1t:fix-code-mode-preserve-history-20261022
Open

emme1t wants to merge 1 commit into
Aider-AI:mainfrom
emme1t:fix-code-mode-preserve-history-20261022

Conversation

@emme1t

@emme1t emme1t commented Oct 22, 2026

Copy link
Copy Markdown

Switching from ask mode with an empty /code command currently passes the model's edit format directly to cmd_chat_mode, which enables summarization and replaces the completed chat history. Route empty and whitespace-only /code commands through the existing code mode so they preserve the full history, matching /chat-mode code.

Add regression coverage for whole, diff, and udiff, including completed and current messages, empty and whitespace-only input, and /code with a prompt.

Validation:

  • The six history-preservation cases fail on the original implementation and pass with this change.
  • pytest tests/basic/test_commands.py tests/basic/test_coder.py -q: 114 passed, 38 subtests passed on Python 3.12.
  • Pinned isort, Black, flake8, and codespell checks passed for both changed files.

Fixes #5878.

@CLAassistant

CLAassistant commented Oct 22, 2026 •

Copy link
Copy Markdown

CLA assistant check
All committers have signed the CLA.

This branch has not been deployed

No deployments
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: /code without arguments summarizes and replaces the chat history, unlike /chat-mode code

2 participants