Fix: Add blockedBy check in claim_task to prevent LLM bypassing dependencies

This commit is contained in:
chablino
2026-03-23 22:42:24 +08:00
parent 644b0753c9
commit 42fac6af5a

View File

@@ -148,6 +148,8 @@ def claim_task(task_id: int, owner: str) -> str:
if task.get("status") != "pending": if task.get("status") != "pending":
status = task.get("status") status = task.get("status")
return f"Error: Task {task_id} cannot be claimed because its status is '{status}'" return f"Error: Task {task_id} cannot be claimed because its status is '{status}'"
if task.get("blockedBy"):
return f"Error: Task {task_id} is blocked by other task(s) and cannot be claimed yet"
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))