Skip to content

Automate browser based workflows with AI

fix webhook successful status code range (#2486)

Shuchang Zhengc575ad8bc7b4
diff --git a/skyvern/forge/agent.py b/skyvern/forge/agent.py
index 0472d4e4e..2b2e68e2b 100644
--- a/skyvern/forge/agent.py
+++ b/skyvern/forge/agent.py
@@ -2139,7 +2139,7 @@ class ForgeAgent:
resp = await client.post(
task.webhook_callback_url, data=payload, headers=headers, timeout=httpx.Timeout(30.0)
)
- if resp.status_code == 200:
+ if resp.status_code >= 200 and resp.status_code < 300:
LOG.info(
"Webhook sent successfully",
task_id=task.task_id,
diff --git a/skyvern/forge/sdk/workflow/service.py b/skyvern/forge/sdk/workflow/service.py
index a08ce706a..84386b5a9 100644
--- a/skyvern/forge/sdk/workflow/service.py
+++ b/skyvern/forge/sdk/workflow/service.py
@@ -1268,7 +1268,7 @@ class WorkflowService:
resp = await client.post(
url=workflow_run.webhook_callback_url, data=payload, headers=headers, timeout=httpx.Timeout(30.0)
)
- if resp.status_code == 200:
+ if resp.status_code >= 200 and resp.status_code < 300:
LOG.info(
"Webhook sent successfully",
workflow_id=workflow_id,
diff --git a/skyvern/services/task_v2_service.py b/skyvern/services/task_v2_service.py
index 85960b8cd..06484f187 100644
--- a/skyvern/services/task_v2_service.py
+++ b/skyvern/services/task_v2_service.py
@@ -1678,7 +1678,7 @@ async def send_task_v2_webhook(task_v2: TaskV2) -> None:
resp = await httpx.AsyncClient().post(
task_v2.webhook_callback_url, data=payload, headers=headers, timeout=httpx.Timeout(30.0)
)
- if resp.status_code == 200:
+ if resp.status_code >= 200 and resp.status_code < 300:
LOG.info(
"Task v2 webhook sent successfully",
task_v2_id=task_v2.observer_cruise_id,