Skip to content

Commit ea53008

Browse files
chablinoCopilot
andauthored
Update agents/s11_autonomous_agents.py
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
1 parent 0618ec8 commit ea53008

1 file changed

Lines changed: 6 additions & 2 deletions

File tree

agents/s11_autonomous_agents.py

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -142,8 +142,12 @@ def claim_task(task_id: int, owner: str) -> str:
142142
if not path.exists():
143143
return f"Error: Task {task_id} not found"
144144
task = json.loads(path.read_text())
145-
if task.get("owner") or task.get("status") != "pending":
146-
return f"Error: Task {task_id} has already been claimed by someone else"
145+
if task.get("owner"):
146+
existing_owner = task.get("owner") or "someone else"
147+
return f"Error: Task {task_id} has already been claimed by {existing_owner}"
148+
if task.get("status") != "pending":
149+
status = task.get("status")
150+
return f"Error: Task {task_id} cannot be claimed because its status is '{status}'"
147151
task["owner"] = owner
148152
task["status"] = "in_progress"
149153
path.write_text(json.dumps(task, indent=2))

0 commit comments

Comments
 (0)