auto-sync: 2026-06-02 15:02:25
This commit is contained in:
@@ -474,6 +474,16 @@ curl -X POST http://{self.api_host}:{self.api_port}/api/projects/{project_id}/ta
|
||||
session_id = str(uuid.uuid4())
|
||||
_sid_key = session_id or "main" # counter 用的 key
|
||||
|
||||
# Phase -1: Gateway 存活检查(#08)
|
||||
# Gateway 不可达 → AgentBusyError(reason="gateway_down") → 任务留 pending
|
||||
# → ticker 30s 后自动重试。仅检查 main session spawn(subagent 走 API)。
|
||||
if use_main_session and not skip_counter:
|
||||
gw_alive = await self._probe_gateway()
|
||||
if not gw_alive:
|
||||
logger.warning("Phase -1: Gateway unreachable (%s:%d), deferring %s",
|
||||
self.gateway_host, self.gateway_port, agent_id)
|
||||
raise AgentBusyError(agent_id, reason="gateway_down")
|
||||
|
||||
# Phase 0: Pre-acquire 修复(无锁)
|
||||
# timeout/failed 状态先修复再 acquire。revive 只改 running→idle,幂等安全。
|
||||
# asyncio 协作式并发保证同一时刻只有一个协程在执行,revive 的 sessions.json
|
||||
|
||||
Reference in New Issue
Block a user