fix(tasks): allow lead to set inbox→in_progress when assigning agent

The _lead_apply_status gate was too strict: it only permitted leads to
change task status when the task was already in .  This broke
the assignment-and-start shortcut introduced in the wake-assignee
feature, where a lead assigns a worker and simultaneously sets
 from .

Allow the transition  when the lead is also
supplying an  in the same PATCH.  All other
non-review status changes remain forbidden.

Fixes test_lead_assignment_and_in_progress_wakes_assignee_once.
This commit is contained in:
openclaw-bot
2026-03-19 16:44:20 +00:00
parent d77e426603
commit 48bc1eacc8
+9 -1
View File
@@ -2164,7 +2164,16 @@ async def _lead_apply_status(
lead_agent = update.actor.agent
if "status" not in update.updates:
return
target_status = _required_status_value(update.updates["status"])
# Leads may set `in_progress` when simultaneously assigning an agent to an
# inbox task (assignment-and-start shortcut).
if update.task.status != "review":
assigning_agent = "assigned_agent_id" in update.updates and bool(
_optional_assigned_agent_id(update.updates["assigned_agent_id"])
)
if update.task.status == "inbox" and target_status == "in_progress" and assigning_agent:
update.task.status = target_status
return
raise HTTPException(
status_code=status.HTTP_403_FORBIDDEN,
detail=(
@@ -2172,7 +2181,6 @@ async def _lead_apply_status(
f"task status is `review` (current: `{update.task.status}`)."
),
)
target_status = _required_status_value(update.updates["status"])
if target_status not in {"done", "inbox"}:
raise HTTPException(
status_code=status.HTTP_403_FORBIDDEN,