Dispatch review tasks to reviewer (not assignee)
This commit is contained in:
@@ -137,11 +137,24 @@ def dispatch_task(
|
|||||||
detail="OpenClaw gateway is not configured (set OPENCLAW_GATEWAY_URL/TOKEN)",
|
detail="OpenClaw gateway is not configured (set OPENCLAW_GATEWAY_URL/TOKEN)",
|
||||||
)
|
)
|
||||||
|
|
||||||
# Best-effort: enqueue an agent dispatch. This does not mutate the task.
|
# Best-effort: enqueue a dispatch notification.
|
||||||
background.add_task(
|
# IMPORTANT: if a task is already in review, the reviewer (not the assignee) should be notified.
|
||||||
notify_openclaw,
|
status = (getattr(task, "status", None) or "").lower()
|
||||||
NotifyContext(event="task.assigned", actor_employee_id=actor_employee_id, task_id=task.id),
|
if status in {"review", "ready_for_review"}:
|
||||||
)
|
background.add_task(
|
||||||
|
notify_openclaw,
|
||||||
|
NotifyContext(
|
||||||
|
event="status.changed",
|
||||||
|
actor_employee_id=actor_employee_id,
|
||||||
|
task_id=task.id,
|
||||||
|
changed_fields={"status": {"to": task.status}},
|
||||||
|
),
|
||||||
|
)
|
||||||
|
else:
|
||||||
|
background.add_task(
|
||||||
|
notify_openclaw,
|
||||||
|
NotifyContext(event="task.assigned", actor_employee_id=actor_employee_id, task_id=task.id),
|
||||||
|
)
|
||||||
|
|
||||||
return {"ok": True}
|
return {"ok": True}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user