auto-sync: 2026-06-01 13:50:21

This commit is contained in:
cfdaily
2026-06-01 13:50:21 +08:00
parent fb8807f5a8
commit 3a9478a22e
2 changed files with 94 additions and 35 deletions
+16 -5
View File
@@ -291,15 +291,24 @@ class Dispatcher:
"status": "dispatched",
"reason": decision["reason"],
}
except AgentBusyError:
except AgentBusyError as e:
# #07: 区分外部占用 vs mozi 内部占用
reason = getattr(e, 'reason', 'busy')
if reason.startswith("session_"):
log_level = logger.info
detail_msg = f"Session busy: {reason}"
else:
log_level = logger.debug
detail_msg = f"Agent busy: {reason}"
log_level("Dispatch skipped %s for task %s: %s", agent_id, task.id, detail_msg)
# on_checks_passed 未执行(check 失败在它之前),working 未标,无需回退
self._record_routing(task, decision, "skipped", "Agent busy", _routing_db)
self._record_routing(task, decision, "skipped", detail_msg, _routing_db)
return {
"level": level.value,
"agent_id": agent_id,
"session_id": None,
"status": "skipped",
"reason": "Agent busy (concurrent limit or cooling down)",
"reason": detail_msg,
}
except Exception as e:
# on_checks_passed 已执行但 subprocess 失败 → 回退 working → pending
@@ -570,10 +579,12 @@ class Dispatcher:
return {"level": level.value, "agent_id": agent_id,
"session_id": session_id, "status": "dispatched",
"reason": decision["reason"]}
except AgentBusyError:
except AgentBusyError as e:
reason = getattr(e, 'reason', 'busy')
detail_msg = f"Session busy: {reason}" if reason.startswith("session_") else f"Agent busy: {reason}"
return {"level": level.value, "agent_id": agent_id,
"session_id": None, "status": "skipped",
"reason": "Agent busy (concurrent limit or cooling down)"}
"reason": detail_msg}
except Exception as e:
return {"level": level.value, "agent_id": agent_id,
"session_id": None, "status": "error",