← 返回首页
fix: warn on missing task dependencies in topo sort · Sibyl-Research-Team/AutoResearch-SibylSystem@be67959 · GitHub
Skip to content

Navigation Menu

Toggle navigation
Sign in
Appearance settings
Search or jump to...

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Include my email address so I can be contacted

Saved searches

Use saved searches to filter your results more quickly

Appearance settings
Resetting focus

Commit be67959

Browse files
fix: warn on missing task dependencies in topo sort
1 parent cce8e3a commit be67959

2 files changed

Lines changed: 41 additions & 0 deletions

File tree

‎sibyl/gpu_scheduler.py‎

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@
2424
"""
2525
import fcntl
2626
import json
27+
import logging
2728
import re
2829
import shlex
2930
import time
@@ -33,6 +34,8 @@
3334

3435
from sibyl._paths import get_system_state_dir
3536

37+
_log = logging.getLogger(__name__)
38+
3639

3740
@contextmanager
3841
def _progress_lock(workspace_root: Path, timeout_sec: float = 30.0):
@@ -296,6 +299,11 @@ def topo_sort_layers(tasks: list[dict]) -> list[list[dict]]:
296299
if dep in task_map:
297300
in_degree[t["id"]] += 1
298301
children[dep].append(t["id"])
302+
else:
303+
_log.warning(
304+
"Task %s depends on non-existent task %s — treating as satisfied",
305+
t["id"], dep,
306+
)
299307

300308
layers = []
301309
queue = deque([tid for tid, deg in in_degree.items() if deg == 0])

‎tests/test_gpu_scheduler.py‎

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1183,6 +1183,39 @@ def test_script_includes_dispatch_logic(self):
11831183
assert "DISPATCH" in script
11841184

11851185

1186+
# ══════════════════════════════════════════════
1187+
# Warn on missing dependencies
1188+
# ══════════════════════════════════════════════
1189+
1190+
def test_topo_sort_warns_on_missing_dependency(caplog):
1191+
"""Should log a warning when a task depends on a non-existent task."""
1192+
import logging
1193+
tasks = [
1194+
{"id": "a", "depends_on": ["ghost"]},
1195+
{"id": "b", "depends_on": []},
1196+
]
1197+
with caplog.at_level(logging.WARNING):
1198+
layers = topo_sort_layers(tasks)
1199+
assert any("ghost" in r.message for r in caplog.records)
1200+
# 'a' should still be included (treat missing dep as satisfied)
1201+
all_ids = {t["id"] for layer in layers for t in layer}
1202+
assert "a" in all_ids
1203+
assert "b" in all_ids
1204+
1205+
1206+
def test_topo_sort_no_warning_for_valid_deps(caplog):
1207+
"""Should not warn when all dependencies exist."""
1208+
import logging
1209+
tasks = [
1210+
{"id": "a", "depends_on": []},
1211+
{"id": "b", "depends_on": ["a"]},
1212+
]
1213+
with caplog.at_level(logging.WARNING):
1214+
layers = topo_sort_layers(tasks)
1215+
assert not any("non-existent" in r.message for r in caplog.records)
1216+
assert len(layers) == 2
1217+
1218+
11861219
# ══════════════════════════════════════════════
11871220
# TTL-based stale lease cleanup
11881221
# ══════════════════════════════════════════════

0 commit comments

Comments
 (0)

Footer

© 2026 GitHub, Inc.