From 0b320316d312213b24d11c6fee8a7e5d22ed3e8c Mon Sep 17 00:00:00 2001 From: Jessica Mulein Date: Wed, 10 Jun 2026 21:07:21 -0700 Subject: [PATCH] fix(commands): transfer abs_fnames back after /agent temp-coder turn _generic_chat_command creates a temporary coder for /agent (and other slash commands with args). Files added by ContextManager during the turn were on the temp coder and got discarded when SwitchCoderSignal switched back to the original. Now transfer abs_fnames and abs_read_only_fnames from the temp coder back to the original before raising SwitchCoderSignal. This ensures files added during /agent turns persist in the session and are visible to subsequent GET /sessions/{id} (files_in_chat). --- cecli/commands/utils/base_command.py | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/cecli/commands/utils/base_command.py b/cecli/commands/utils/base_command.py index d9e0d4c74d2..db6006234a5 100644 --- a/cecli/commands/utils/base_command.py +++ b/cecli/commands/utils/base_command.py @@ -159,6 +159,12 @@ async def _generic_chat_command(cls, io, coder, args, edit_format, placeholder=N await new_coder.generate(user_message=user_msg, preproc=False) coder.coder_commit_hashes = new_coder.coder_commit_hashes + # Transfer files added during the /agent (or other temp-coder) turn back to the original + if new_coder.abs_fnames - original_coder.abs_fnames: + original_coder.abs_fnames.update(new_coder.abs_fnames) + if new_coder.abs_read_only_fnames - original_coder.abs_read_only_fnames: + original_coder.abs_read_only_fnames.update(new_coder.abs_read_only_fnames) + # Clear manager and restore original state ConversationService.get_manager(original_coder).initialize( reset=True,