@@ -68,7 +68,7 @@ def pass_custom_logger_fn(self)->Self:
6868
6969 async def get_repo_tree_from_user_prompt (self , history :list , include_modules :bool = False , expand_paths :Optional [List [str ]]= None )-> str :
7070
71- history_str = "\n \n " .join ([ str ( entry ) for entry in history ] )
71+ history_str = "\n \n " .join (history )
7272 for CMD_PROMPT in [CMD_TRIGGER_PLANNING_STEPS , CMD_WRITE_TESTS_PROMPT , CMD_BRAINSTORM_PROMPT , CMD_CODE_REVIEW_PROMPT ]:
7373 history_str .replace (CMD_PROMPT , "" )
7474
@@ -122,9 +122,16 @@ def get_valid_identifier(autocomplete :AutoComplete, identifier:str)->Optional[s
122122 return result .get ("matching_identifiers" )[0 ]
123123 return None
124124
125+ def _clean_history (self ):
126+ for i in range (len (self .history )):
127+ message = self .history [i ]
128+ if isinstance (message , dict ):
129+ self .history [i ] = message .get ("content" ,"" )
130+
125131 async def agent_loop (self , codeIdentifiers :Optional [List [str ]]= None ):
126132 TODAY = date .today ()
127133 await self .tide .check_for_updates (serialize = True , include_cached_ids = True )
134+ self ._clean_history ()
128135
129136 codeContext = None
130137 if self ._skip_context_retrieval :
@@ -155,7 +162,9 @@ async def agent_loop(self, codeIdentifiers :Optional[List[str]]=None):
155162
156163 # 2. Single LLM call with unified prompt
157164 # Pass accumulated identifiers for context if this isn't the first iteration
158- accumulated_context = "\n " .join (sorted (identifiers_accum | modify_accum )) if (identifiers_accum or modify_accum ) else ""
165+ accumulated_context = "\n " .join (
166+ sorted ((identifiers_accum or set ()) | (modify_accum or set ()))
167+ ) if (identifiers_accum or modify_accum ) else ""
159168
160169 unified_response = await self .llm .acomplete (
161170 self .history ,
0 commit comments