diff --git a/packages/notte-browser/src/notte_browser/tagging/action/llm_taging/base.py b/packages/notte-browser/src/notte_browser/tagging/action/llm_taging/base.py index 8c011b504..e477147db 100644 --- a/packages/notte-browser/src/notte_browser/tagging/action/llm_taging/base.py +++ b/packages/notte-browser/src/notte_browser/tagging/action/llm_taging/base.py @@ -109,13 +109,28 @@ async def forward_incremental( snapshot: BrowserSnapshot, previous_action_list: list[InteractionAction], ) -> PossibleActionSpace: + errors: list[str] = [] + _last_error: Exception | None = None for _ in range(self.max_tries): try: return await self.pipe.forward_incremental(snapshot, previous_action_list) - except Exception: - pass + except Exception as e: + _last_error = e + errors.append(str(e)) + if self.verbose: + logger.debug( + f"forward_incremental: failed to parse action list but retrying. Start of error msg: {str(e)[:200]}..." + ) if self.verbose: - logger.debug("Failed to get action list after max tries => returning previous action list") + logger.debug( + f"Failed to get incremental action list after {self.max_tries} tries with errors: {errors} => returning previous action list" + ) + self.tracer.trace( + status="failure", + pipe_name=self.pipe.__class__.__name__, + nb_retries=len(errors), + error_msgs=errors, + ) return PossibleActionSpace( # TODO: get description from previous action list description="",