复审整改补漏(PR #26):修正 assess_swarm_health 残留的过时 docstring

第 3 点整改时改了函数体(不再 emit swarm.health、改存 run.metadata),
但函数 docstring 仍写「emits an internal swarm.health event」——与代码及
紧邻注释自相矛盾,正是 Fasthei 指出的同类「文档/代码冲突」。改为如实描述:
存 run.metadata["health"] + 内部 health_log,INTERNAL only,不发 Manager 事件。

仅注释/文档串改动,无逻辑变更;test-swarm-guard 仍全绿。

Refs #6

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
Songhaoz666
2026-06-10 16:58:22 +08:00
co-authored by Claude Opus 4.8
parent f2662e4268
commit e1292ca6fd
+4 -3
View File
@@ -393,9 +393,10 @@ async def assess_swarm_health(run, *, connected_agent_ids=None):
"""P-guard: diagnose whether the swarm can make progress on a run, and why not.
Assembles a snapshot (tasks + connected agents' capabilities + budget) and runs the pure
guard. Stores the report on run.metadata["health"]; emits an internal `swarm.health` event when
unhealthy so the stall is visible. Advisory only — it does not change the run. Returns the
HealthReport.
guard. Stores the report on run.metadata["health"], and appends unhealthy reports to a bounded
internal run.metadata["health_log"], so a stall is visible to an operator/Manager pulling the
run. INTERNAL only — does NOT emit a Manager event (see the comment below) and does not change
the run. Returns the HealthReport.
"""
tasks = [await task_queue.get_task(tid) for tid in run.task_ids]
tasks = [t for t in tasks if t]