fix: isolate selector VLM exceptions at slot level (no batch crash)

This commit is contained in:
2026-07-14 21:08:00 -04:00
parent 441a0aa6c3
commit b1c1bf7aac
2 changed files with 70 additions and 3 deletions
+6 -3
View File
@@ -404,9 +404,12 @@ async def _apply_grounded_selector(
config=selector_cfg,
session_id=session_id,
)
except (ValueError, FileNotFoundError) as e:
# 异常路径无 outcome/observation 可落,但仍须 mark_item_rejected
# 与 hard-fail 路径落库风格一致(该 attempt 的 item 是死记录,重出新建 item_id)
except (ValueError, FileNotFoundError, OSError, Exception) as e: # noqa: BLE001
# slot 级隔离:selector 会多次调 VLM,任何异常(含 VLM 网络/超时/熔断
# CircuitOpenError/StreamLivenessTimeout 等非 ValueError 类型)都降级为
# selector_error 重出该 slot,绝不穿透 asyncio.gather 崩掉整批生成。
# 与相邻 Phase 2 生成失败的宽捕获口径一致;异常路径无 observation 可落,
# 但仍 mark_item_rejected(该 attempt 的 item 是死记录,重出新建 item_id)。
reason = f"selector_error: {e}"
logger.warning("slot {} selector 异常 (attempt {}): {}", slot_id, attempt, e)
store.mark_item_rejected(item_id, reason)