Skip to content

fix: preserve architect context when file-add dialog triggers#4953

Open
ameenalkhaldi wants to merge 1 commit intoAider-AI:mainfrom
ameenalkhaldi:fix/architect-context-loss-on-file-add
Open

fix: preserve architect context when file-add dialog triggers#4953
ameenalkhaldi wants to merge 1 commit intoAider-AI:mainfrom
ameenalkhaldi:fix/architect-context-loss-on-file-add

Conversation

@ameenalkhaldi
Copy link
Copy Markdown

When the architect's response mentions a file not in the chat, check_for_file_mentions triggers a reflection loop. It sets reflected_message and returns before reply_completed runs. The architect gets called again with the reflection message, but only that second (shorter) response reaches the editor via partial_response_content. The original response containing the actual code changes is in cur_messages but never forwarded.

This causes the editor to work with incomplete context, as shown in #3033 where token counts drop from 6.6k to 3.4k after a file-add dialog.

The fix collects all assistant messages from cur_messages in reply_completed so the editor receives the full architect output. Falls back to partial_response_content for the normal (no reflection) path.

Fixes #3033

When the architect's response mentions a file not in the chat,
check_for_file_mentions triggers and sets reflected_message, returning
before reply_completed runs. The architect gets called again with
the reflection, but only that second (shorter) response reaches the
editor. The original response with the actual code changes is lost.

Now reply_completed collects all assistant messages from cur_messages
so the editor receives the full architect output including the original
response that triggered the file-add.

Fixes Aider-AI#3033
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.

If architect triggers the "add file" dialog, the editor doesn't get the architect's response?

1 participant