From b62ce02930de886127261cfb260ee088eaf9bd8f Mon Sep 17 00:00:00 2001 From: cthomas Date: Fri, 16 Jan 2026 12:28:57 -0800 Subject: [PATCH] fix: run status failed getting overridden (#8834) * fix: run status failed getting overridden * fix method name * missing await --- letta/services/streaming_service.py | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/letta/services/streaming_service.py b/letta/services/streaming_service.py index 313b0d5f..29e54879 100644 --- a/letta/services/streaming_service.py +++ b/letta/services/streaming_service.py @@ -220,7 +220,13 @@ class StreamingService: # update run status to running before returning if settings.track_agent_run and run: - run_status = RunStatus.running + # refetch run since it may have been updated by another service + run = await self.server.run_manager.get_run_by_id(run_id=run.id, actor=actor) + if run.status == RunStatus.created: + run_status = RunStatus.running + else: + # don't override run status if it has already been updated + run_status = None return run, result @@ -235,7 +241,7 @@ class StreamingService: run_status = RunStatus.failed raise finally: - if settings.track_agent_run and run: + if settings.track_agent_run and run and run_status: await self.server.run_manager.update_run_by_id_async( run_id=run.id, conversation_id=conversation_id,