fix: handling should continue for non system exceeded exceptions (#9406)

* base

* add log
This commit is contained in:
jnjpng
2026-02-10 12:22:10 -08:00
committed by Caren Thomas
parent 0dde155e9a
commit 6f51fa74be

View File

@@ -1221,6 +1221,14 @@ class LettaAgentV3(LettaAgentV2):
self.logger.warning(f"Error during step processing: {error_detail}")
self.job_update_metadata = {"error": error_detail}
# Stop the agent loop on any exception to prevent wasteful retry loops
# (e.g., if post-step compaction fails, we don't want to keep retrying)
self.should_continue = False
self.logger.warning(
f"Agent loop stopped due to exception (step_progression={step_progression.name}, "
f"exception_type={type(e).__name__}): {error_detail}"
)
# This indicates we failed after we decided to stop stepping, which indicates a bug with our flow.
if not self.stop_reason:
self.stop_reason = LettaStopReason(stop_reason=StopReasonType.error.value)