mirror of
https://github.com/shareAI-lab/analysis_claude_code.git
synced 2026-05-06 16:26:16 +08:00
Update agents/s11_autonomous_agents.py
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
This commit is contained in:
@@ -142,8 +142,12 @@ def claim_task(task_id: int, owner: str) -> str:
|
|||||||
if not path.exists():
|
if not path.exists():
|
||||||
return f"Error: Task {task_id} not found"
|
return f"Error: Task {task_id} not found"
|
||||||
task = json.loads(path.read_text())
|
task = json.loads(path.read_text())
|
||||||
if task.get("owner") or task.get("status") != "pending":
|
if task.get("owner"):
|
||||||
return f"Error: Task {task_id} has already been claimed by someone else"
|
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["owner"] = owner
|
||||||
task["status"] = "in_progress"
|
task["status"] = "in_progress"
|
||||||
path.write_text(json.dumps(task, indent=2))
|
path.write_text(json.dumps(task, indent=2))
|
||||||
|
|||||||
Reference in New Issue
Block a user