Skip to content

Commit 42300d0

Browse files
committed
fix(task_updater): fix potential duplicate artifact_id from default value
Change artifact_id default from str(uuid.uuid4()) to None and generate unique ID within method This prevents using the same default value across multiple calls
1 parent 5e7d418 commit 42300d0

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

src/a2a/server/tasks/task_updater.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,7 @@ async def update_status(
6868
async def add_artifact(
6969
self,
7070
parts: list[Part],
71-
artifact_id: str = str(uuid.uuid4()),
71+
artifact_id: str | None = None,
7272
name: str | None = None,
7373
metadata: dict[str, Any] | None = None,
7474
):
@@ -82,6 +82,9 @@ async def add_artifact(
8282
append: Optional boolean indicating if this chunk appends to a previous one.
8383
last_chunk: Optional boolean indicating if this is the last chunk.
8484
"""
85+
if not artifact_id:
86+
artifact_id = str(uuid.uuid4())
87+
8588
await self.event_queue.enqueue_event(
8689
TaskArtifactUpdateEvent(
8790
taskId=self.task_id,

0 commit comments

Comments
 (0)