From ea53008ae7c9397a487221d8dff17dbe12c3c271 Mon Sep 17 00:00:00 2001 From: to7for <31083461+chablino@users.noreply.github.com> Date: Mon, 23 Mar 2026 22:34:46 +0800 Subject: [PATCH] Update agents/s11_autonomous_agents.py Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com> --- agents/s11_autonomous_agents.py | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/agents/s11_autonomous_agents.py b/agents/s11_autonomous_agents.py index 59fe3f7..ac1cd7b 100644 --- a/agents/s11_autonomous_agents.py +++ b/agents/s11_autonomous_agents.py @@ -142,8 +142,12 @@ def claim_task(task_id: int, owner: str) -> str: if not path.exists(): return f"Error: Task {task_id} not found" task = json.loads(path.read_text()) - if task.get("owner") or task.get("status") != "pending": - return f"Error: Task {task_id} has already been claimed by someone else" + if task.get("owner"): + existing_owner = task.get("owner") or "someone else" + return f"Error: Task {task_id} has already been claimed by {existing_owner}" + if task.get("status") != "pending": + status = task.get("status") + return f"Error: Task {task_id} cannot be claimed because its status is '{status}'" task["owner"] = owner task["status"] = "in_progress" path.write_text(json.dumps(task, indent=2))