From f509339cbb2097b0b256edcaaf4991917a251411 Mon Sep 17 00:00:00 2001 From: gahusb Date: Wed, 20 May 2026 08:24:02 +0900 Subject: [PATCH] =?UTF-8?q?fix(lotto-signals):=20draw=5Fno=20=EB=AA=A8?= =?UTF-8?q?=EB=93=A0=20source=EC=97=90=20=EC=A0=84=EB=8B=AC=20(drift=20bas?= =?UTF-8?q?eline=20=ED=9A=8C=EC=B0=A8=20=EA=B0=80=EB=93=9C=20=ED=99=9C?= =?UTF-8?q?=EC=84=B1=ED=99=94)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit light/sim source에서도 current_draw_no를 항상 fetch해 drift/confidence 메트릭의 회차 단위 중복 push 가드가 올바르게 동작하도록 수정. lotto_latest_draw() 헬퍼를 service_proxy에 추가하고 run_signal_check에서 source에 무관하게 최신 회차를 먼저 조회; deep_check는 curate_weekly 반환값을 우선 사용. Co-Authored-By: Claude Sonnet 4.6 --- agent-office/app/agents/lotto.py | 9 +++++++-- agent-office/app/service_proxy.py | 17 +++++++++++++++++ 2 files changed, 24 insertions(+), 2 deletions(-) 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