diff --git a/agent-office/app/agents/lotto.py b/agent-office/app/agents/lotto.py index 2301fc1..7d50db5 100644 --- a/agent-office/app/agents/lotto.py +++ b/agent-office/app/agents/lotto.py @@ -41,14 +41,19 @@ class LottoAgent(BaseAgent): try: curate_result = None - current_draw_no = None + + # 회차 단위 메트릭(drift/confidence) 가드를 위해 항상 최신 회차 가져옴 + from ..service_proxy import lotto_latest_draw + current_draw_no = await lotto_latest_draw() if source == "deep": from ..curator.pipeline import curate_weekly cw = await curate_weekly(source="signal_deep") # curate_weekly returns {"ok", "draw_no", "confidence", "tokens", "payload"} curate_result = {"confidence": cw.get("confidence")} - current_draw_no = cw.get("draw_no") + # deep_check 시 curate_weekly가 반환하는 draw_no를 우선 사용 (직접 수집) + if cw.get("draw_no"): + current_draw_no = cw.get("draw_no") outcome = await run_signal_check( source=source, diff --git a/agent-office/app/service_proxy.py b/agent-office/app/service_proxy.py index ae8afae..597a416 100644 --- a/agent-office/app/service_proxy.py +++ b/agent-office/app/service_proxy.py @@ -360,3 +360,20 @@ async def lotto_strategy_weights() -> Dict[str, float]: if isinstance(weights, list): return {item["strategy"]: float(item["weight"]) for item in weights} return {k: float(v) for k, v in (weights or {}).items()} + + +async def lotto_latest_draw() -> Optional[int]: + """GET /api/lotto/latest — 최신 회차 번호만 반환.""" + from .config import LOTTO_BACKEND_URL + try: + resp = await _client.get(f"{LOTTO_BACKEND_URL}/api/lotto/latest") + resp.raise_for_status() + data = resp.json() + # /api/lotto/latest 응답 키: {"drawNo": N, ...} + # 하위 호환을 위해 drawNo, draw_no, drwNo, draw 순서로 시도 + for key in ("drawNo", "draw_no", "drwNo", "draw"): + if isinstance(data, dict) and data.get(key): + return int(data[key]) + return None + except Exception: + return None