From 0caaaa1cb47fa5ed7a5049a2b32c3744a37ca5ab Mon Sep 17 00:00:00 2001 From: Abhimanyu Saharan Date: Mon, 2 Feb 2026 20:47:06 +0530 Subject: [PATCH] fix(dispatch): return 503 when OpenClaw gateway env missing --- backend/app/api/work.py | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/backend/app/api/work.py b/backend/app/api/work.py index 817c9b9..f3979d3 100644 --- a/backend/app/api/work.py +++ b/backend/app/api/work.py @@ -9,6 +9,7 @@ from sqlmodel import Session, select from app.api.utils import get_actor_employee_id, log_activity from app.db.session import get_session from app.integrations.notify import NotifyContext, notify_openclaw +from app.integrations.openclaw import OpenClawClient from app.models.org import Employee from app.models.work import Task, TaskComment from app.schemas.work import TaskCommentCreate, TaskCreate, TaskUpdate @@ -118,6 +119,12 @@ def dispatch_task( _validate_task_assignee(session, task.assignee_employee_id) + if OpenClawClient.from_env() is None: + raise HTTPException( + status_code=503, + detail="OpenClaw gateway is not configured (set OPENCLAW_GATEWAY_URL/TOKEN)", + ) + # Best-effort: enqueue an agent dispatch. This does not mutate the task. background.add_task( notify_openclaw,