Skip to content

Commit 66a8429

Browse files
author
fumanhua
committed
fix(task-system): sync blocks when adding blockedBy dependencies
1 parent e57ced7 commit 66a8429

1 file changed

Lines changed: 9 additions & 0 deletions

File tree

agents/s07_task_system.py

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -87,6 +87,15 @@ def update(self, task_id: int, status: str = None,
8787
self._clear_dependency(task_id)
8888
if add_blocked_by:
8989
task["blockedBy"] = list(set(task["blockedBy"] + add_blocked_by))
90+
# Bidirectional: also update the blocker tasks' blocks lists
91+
for blocker_id in add_blocked_by:
92+
try:
93+
blocker = self._load(blocker_id)
94+
if task_id not in blocker["blocks"]:
95+
blocker["blocks"].append(task_id)
96+
self._save(blocker)
97+
except ValueError:
98+
pass
9099
if add_blocks:
91100
task["blocks"] = list(set(task["blocks"] + add_blocks))
92101
# Bidirectional: also update the blocked tasks' blockedBy lists

0 commit comments

Comments
 (0)