Skip to content

fix: preserve chat history when background summarization fails - #5689

Open
gary23w wants to merge 1 commit into
Aider-AI:mainfrom
gary23w:codex/preserve-history-on-summary-failure
Open

fix: preserve chat history when background summarization fails#5689
gary23w wants to merge 1 commit into
Aider-AI:mainfrom
gary23w:codex/preserve-history-on-summary-failure

Conversation

@gary23w

@gary23w gary23w commented Sep 8, 2026

Copy link
Copy Markdown

Summary

When background chat summarization raises ValueError, the worker reports a warning but leaves summarized_done_messages empty. On joining the worker, summarize_end() then replaces unchanged, intact chat history with that empty list.

Retain the original snapshot as the fallback on failure. The existing comparison still prevents replacement if history changed during summarization, and a later successful summary can still replace matching history. No changes to summarization prompts, model selection, or retry policy.

Verification

  • The new regression exercises the real background-thread/start/join lifecycle with a stub summarizer: a failure preserves the original messages and warns; a subsequent success replaces them with the summary.
  • The regression fails on the original source because history becomes [].
  • python -m pytest tests/basic/test_coder.py tests/basic/test_history.py -q: 49 passed, 29 subtests passed on Windows. Temporary Git fixture commits used process-local commit.gpgsign=false; no user Git configuration was changed.
  • Black, isort, flake8, and git diff --check pass.
  • No live model completion calls.

AI assistance: Codex helped identify and reproduce the defect, implement the one-line fallback, independently review the diff, and run tests/checks.

@CLAassistant

Copy link
Copy Markdown

CLA assistant check
Thank you for your submission! We really appreciate it. Like many open source projects, we ask that you sign our Contributor License Agreement before we can accept your contribution.
You have signed the CLA already but the status is still pending? Let us recheck it.

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.

2 participants