execute_task_webhook uses the latest non canceled step (#4007)

This commit is contained in:
Shuchang Zheng
2025-11-16 15:01:40 -08:00
committed by GitHub
parent 3879807fc6
commit 25e375f78f
4 changed files with 7 additions and 9 deletions

View File

@@ -3138,12 +3138,11 @@ class ForgeAgent:
await app.ARTIFACT_MANAGER.wait_for_upload_aiotasks([task.task_id])
if need_call_webhook:
await self.execute_task_webhook(task=task, last_step=last_step, api_key=api_key)
await self.execute_task_webhook(task=task, api_key=api_key)
async def execute_task_webhook(
self,
task: Task,
last_step: Step | None,
api_key: str | None,
) -> None:
if not api_key:
@@ -3159,6 +3158,7 @@ class ForgeAgent:
task_id=task.task_id,
)
return
last_step = await app.DATABASE.get_latest_step(task.task_id, organization_id=task.organization_id)
task_response = await self.build_task_response(task=task, last_step=last_step)
# try to build the new TaskRunResponse for backward compatibility