Skip to content

Commit a9dabf5

Browse files
authored
Merge pull request #122 from chablino/fix-S07
Fix: Sort task JSON files numerically instead of lexicographically
2 parents a400a5b + 41f18ca commit a9dabf5

1 file changed

Lines changed: 5 additions & 1 deletion

File tree

agents/s07_task_system.py

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -112,7 +112,11 @@ def _clear_dependency(self, completed_id: int):
112112

113113
def list_all(self) -> str:
114114
tasks = []
115-
for f in sorted(self.dir.glob("task_*.json")):
115+
files = sorted(
116+
self.dir.glob("task_*.json"),
117+
key=lambda f: int(f.stem.split("_")[1])
118+
)
119+
for f in files:
116120
tasks.append(json.loads(f.read_text()))
117121
if not tasks:
118122
return "No tasks."

0 commit comments

Comments
 (0)