From 1b8548a73f6187cac8a45683a273f7dae59c5929 Mon Sep 17 00:00:00 2001 From: gahusb Date: Sun, 31 May 2026 17:53:01 +0900 Subject: [PATCH] =?UTF-8?q?feat(agent-office):=20LottoAgent=20=EC=9D=BC=20?= =?UTF-8?q?09:00=20sunday=5Freview=20cron?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-Authored-By: Claude Opus 4.8 (1M context) --- agent-office/app/agents/lotto.py | 25 +++++++++++++++++++++++++ agent-office/app/scheduler.py | 6 ++++++ 2 files changed, 31 insertions(+) diff --git a/agent-office/app/agents/lotto.py b/agent-office/app/agents/lotto.py index ae791e8..44cd595 100644 --- a/agent-office/app/agents/lotto.py +++ b/agent-office/app/agents/lotto.py @@ -22,6 +22,8 @@ class LottoAgent(BaseAgent): return await self.run_signal_check(source=source) if action == "daily_digest": return await self.run_daily_digest() + if action == "sunday_review": + return await self.run_sunday_review() return {"ok": False, "message": f"unknown action: {action}"} async def on_approval(self, task_id: str, approved: bool, feedback: str = "") -> None: @@ -155,6 +157,29 @@ class LottoAgent(BaseAgent): add_log("lotto", f"daily_digest 예외: {e}", level="error", task_id=task_id) return {"ok": False, "message": f"{type(e).__name__}: {e}"} + async def run_sunday_review(self) -> dict: + """일 09:00 — 최신 회차 forward+calibration 보장 후 회고 텔레그램.""" + from ..service_proxy import lotto_latest_draw, lotto_backtest_review, lotto_backtest_run_forward + from ..notifiers.telegram_lotto import send_sunday_review + from ..db import create_task, update_task_status, add_log + + task_id = create_task("lotto", "sunday_review", {}) + try: + draw_no = await lotto_latest_draw() + if not draw_no: + update_task_status(task_id, "failed", result_data={"reason": "no_draw"}) + return {"ok": False, "message": "no latest draw"} + # forward는 lotto cron이 이미 돌렸을 수 있으나 멱등이라 안전 — review만 호출 + payload = await lotto_backtest_review(draw_no) + await send_sunday_review(payload) + update_task_status(task_id, "succeeded", result_data={"draw_no": draw_no}) + add_log("lotto", f"sunday_review 발송: #{draw_no}", task_id=task_id) + return {"ok": True, "draw_no": draw_no} + except Exception as e: + update_task_status(task_id, "failed", result_data={"error": str(e)}) + add_log("lotto", f"sunday_review 예외: {e}", level="error", task_id=task_id) + return {"ok": False, "message": f"{type(e).__name__}: {e}"} + async def run_weekly_evolution_report(self) -> dict: """토 22:15 — lotto-lab evaluate-now 트리거 후 텔레그램 리포트. task_id wrap.""" from ..service_proxy import lotto_evolver_evaluate, lotto_evolver_status diff --git a/agent-office/app/scheduler.py b/agent-office/app/scheduler.py index 02a0ddf..abbc00d 100644 --- a/agent-office/app/scheduler.py +++ b/agent-office/app/scheduler.py @@ -68,6 +68,11 @@ async def _run_lotto_sync_evolver_activity(): if agent: await agent.sync_evolver_activity() +async def _run_lotto_sunday_review(): + agent = AGENT_REGISTRY.get("lotto") + if agent: + await agent.run_sunday_review() + async def _run_youtube_research(): agent = AGENT_REGISTRY.get("youtube") if agent: @@ -116,6 +121,7 @@ def init_scheduler(): scheduler.add_job(_run_lotto_deep_check, "cron", day_of_week="sun,wed", hour=21, minute=15, id="lotto_deep_check") scheduler.add_job(_run_lotto_daily_digest, "cron", hour=9, minute=25, id="lotto_digest") scheduler.add_job(_run_lotto_weekly_evolution_report, "cron", day_of_week="sat", hour=22, minute=15, id="lotto_evolution_weekly") + scheduler.add_job(_run_lotto_sunday_review, "cron", day_of_week="sun", hour=9, minute=0, id="lotto_sunday_review") scheduler.add_job( _run_lotto_sync_evolver_activity, "cron", hour=9, minute=30,