Skip to content

armgit / letta

Public Imported from GitHub
0

Platform for stateful agents: AI with advanced memory that can learn and self-improve over time.

fix: set task name earlier for logging (#8333)

cthomas485fe9d1b2db
diff --git a/letta/utils.py b/letta/utils.py
index 6b77b5fc0..f360d8f3a 100644
--- a/letta/utils.py
+++ b/letta/utils.py
@@ -1445,11 +1445,12 @@ async def bounded_gather(coros: list[Coroutine], max_concurrency: int = 10) -> l
semaphore = asyncio.Semaphore(max_concurrency)
async def bounded_coro(index: int, coro: Coroutine, coro_name: str):
+ # Set task name for diagnostics before acquiring semaphore
+ task = asyncio.current_task()
+ if task:
+ task.set_name(f"bounded[{coro_name}]")
+
async with semaphore:
- # Set task name for diagnostics
- task = asyncio.current_task()
- if task:
- task.set_name(f"bounded[{coro_name}]")
result = await coro
return (index, result)