Skip to content

Commit 9b539e6

Browse files
committed
fix: use MySQL compatible ordering for listing tasks
1 parent 686668c commit 9b539e6

1 file changed

Lines changed: 3 additions & 1 deletion

File tree

src/a2a/server/tasks/database_task_store.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -189,8 +189,10 @@ async def list(
189189
count_stmt = select(func.count()).select_from(base_stmt.alias())
190190
total_count = (await session.execute(count_stmt)).scalar_one()
191191

192+
# Use coalesce to treat NULL timestamps as empty strings,
193+
# which sort last in descending order
192194
stmt = base_stmt.order_by(
193-
timestamp_col.desc().nulls_last(),
195+
func.coalesce(timestamp_col, '').desc(),
194196
self.task_model.id.desc(),
195197
)
196198

0 commit comments

Comments
 (0)