Commit Graph

142 Commits

Author SHA1 Message Date
OoO
4c6e4ca5fb style(ppt): align PPT palette perfectly with MOMO Pro v2 design tokens (Beige, Warm Ink, Caramel Orange) as per frontend upgrade roadmap 2026-05-02 15:01:55 +08:00
OoO
934adc957c style(ppt): redesign ppt layouts, align palette with frontend, and add dedicated MCP RAG slide 2026-05-02 14:59:45 +08:00
OoO
9068d463bb feat(ea): execute Phase 3 C-series architecture fixes to prevent recurrence
All checks were successful
CD Pipeline / deploy (push) Successful in 2m37s
- C1: Removed weekly_strategy and meta_analysis from Elephant Alpha's SAFE_ACTIONS (orchestrator prompt and engine _ACTION_ZH) to prevent autonomous generation of scheduled reports
- C2: Removed hardcoded 0.85 confidence example from orchestrator prompt and implemented bounding validation (0.0~1.0) in _parse_strategic_decision
- C3: Expanded ADR-019 data freshness gate (_ppt_check_data_freshness) to cover /ppt weekly and /ppt strategy routes, proactively warning users of stale data
2026-05-02 14:39:10 +08:00
OoO
9158bbe1a6 fix(ea): execute Phase 2 B-series data quality and gate improvements
All checks were successful
CD Pipeline / deploy (push) Successful in 2m40s
- B1 & B2: Updated SQL column names from 銷售金額 to 總業績 in openclaw_strategist_service.py and chart_generator_service.py
- B3: Removed bare except statements in DB fetchers to raise errors instead of failing silently
- B4: Implemented freshness gate (MAX(snapshot_date) < CURRENT_DATE - 2) in daily_sales_snapshot to prevent generating stale reports and send data stalled alerts
- B5: Replaced hardcoded 45.0 system load percentage with actual psutil CPU metric
2026-05-02 14:34:30 +08:00
OoO
e6df2fad28 fix(ea): remove weekly_strategy/meta_analysis from autonomous engine triggers (Phase 1 stopgap)
All checks were successful
CD Pipeline / deploy (push) Successful in 2m39s
Critic-approved 3-point revision (REVISE → adopted):
1. Disable weekly_insight trigger at definition (line 279-285) — EA no
   longer evaluates the 6h / >=5 ai_insights condition that fired
   _generate_strategy_report without force_tg_alert=True.
2. Remove the openclaw weekly/meta dispatch table branches (line 591-606).
   The 5 actions (generate_strategic_analysis, generate_weekly_strategy,
   generate_market_analysis, generate_pricing_strategy,
   generate_meta_analysis) now fall through to the existing
   `raise ValueError(f"Unrecognized step: ...")` at line 631, which
   _execute_decision's try/except converts into a circuit-breaker failure.
   This is the correct failure semantics critic asked for.
3. Convert _generate_strategy_report / _generate_meta_report into hard
   RuntimeError raisers and drop their imports of
   openclaw_strategist_service. Deep insurance: any future caller crashes
   immediately instead of silently bypassing dedupe.

Evidence: ai_insights logged 35+ duplicate weekly_strategy sends in 7 days
because EA's `_generate_strategy_report` invoked
generate_weekly_strategy_report() without force_tg_alert=True, bypassing
the run_scheduler.py weekly dedupe gate.

Out of scope (per task contract):
- run_scheduler.py:115 Monday 06:00 schedule — preserved (sole owner)
- services/openclaw_strategist_service.py — owned by B-series (SQL)
- Other EA triggers (price_drop_alert / market_opportunity /
  threat_escalation / code_exception / resource_optimization) — preserved
- Other dispatch branches (hermes / nemotron / auto_heal / code_fix /
  price_adjustment review) — preserved
- Did NOT add force_tg_alert=True defensive layer (critic flagged as
  anti-pattern)
- Did NOT touch _TRIGGER_TO_DECISION_TYPE / _ALLOWED_ACTION_TYPES

Not pushed, not deployed. D1 deployment will be issued separately and
must use `docker compose up -d --no-deps --force-recreate momo-scheduler`
(per feedback_compose_restart_vs_up).

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-05-02 13:12:14 +08:00
OoO
477aab3f6f refactor(telegram): migrate edm_notifier text path to EventRouter (ADR-019 Phase 5)
Some checks failed
CD Pipeline / deploy (push) Has been cancelled
services/edm_notifier.py 的 _send_telegram() 處理 EDM 媒體告警,原本 if/else
分流 sendPhoto / sendMessage。

行為變化:
- 純文字分支(無 image_path):改走 services.event_router.dispatch_sync()
  event_type=edm_media_alert, severity=warning
- 含圖片分支(sendPhoto with multipart file upload):依 ADR-019 任務指示
  保留直連 Telegram API(EventRouter 不支援 file upload,列為 known skip)
- caller 行為不變,失敗仍 logger.error 不阻斷主線

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-05-02 13:09:34 +08:00
OoO
3e9d53c98c refactor(telegram): migrate aider_heal_executor sender to EventRouter (ADR-019 Phase 5)
services/aider_heal_executor.py 的 _notify_telegram() 為 ADR-013 AutoHeal 閉環
通知出口(aider 自動修復進度)。原直接 POST sendMessage,timeout=5s(非阻塞)。
改走 services.event_router.dispatch_sync()。

行為變化:
- 失敗仍靜默 pass,caller(execute_code_fix 等)行為完全不變
- severity=warning 會被 EventRouter classify 為 L0 或 L1(無 trace 時 L0),
  輕量分流不會拖慢自動修復流程
- 享 EventRouter 內建 retry + JSONL queue replay;舊版 timeout=5 失敗即丟訊息
  的問題改善(可從 queue 重送)

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-05-02 13:09:34 +08:00
OoO
edfe38e87d refactor(telegram): migrate nemoton_dispatcher sender to EventRouter (ADR-019 Phase 5)
NemoTron Dispatcher 的 _send_telegram() 原本直接 POST Telegram Bot API(含 MarkdownV2
跳脫)+ 透過 self.nm 走 NotificationManager 兩條路。改為統一走 services.event_router.
dispatch_sync(),享 EventRouter 的 retry + 失敗 JSONL queue replay + AI 三層分流。

行為變化:
- 從 _exec_trigger_price_alert / _exec_add_to_recommendation / _exec_flag_for_human_review
  三個工具實作流入 EventRouter,event_type=nemoton_dispatch_alert,severity=alert
- 移除 self.nm._send_telegram_messages() 的 short-circuit;改由 EventRouter 內建
  通道處理 chat_ids/token 解析
- 失敗時保留 logger.error + log fallback,不阻斷主線(同舊行為)

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-05-02 13:09:34 +08:00
OoO
e12e6a8f96 feat(telegram): ADR-019 Phase 6 - daily data freshness probe + cron 09:05
Some checks failed
CD Pipeline / deploy (push) Has been cancelled
ADR-019 Phase 6:每日 09:05 OpenClawBot scheduler 主動巡檢 realtime_sales_monthly
最新資料日期,落後超過閾值時透過 EventRouter 發 Telegram 警告。

新增 services/data_freshness_probe.py:
- gap == 0:靜默不發(資料齊全)
- gap == 1:info(昨日資料齊,正常)
- gap == 2~3:warning
- gap >= 4:alert(P2,ETL 大概率出問題)
- latest_date 取不到:alert(DB 連線異常)

routes/openclaw_bot_routes.py 加 cron job openclaw_data_freshness_probe
(hour=9 minute=5,避開 09:00 的其他既有 job)。

從『用戶月初按按鈕踩坑才發現資料缺口』的被動模式,轉成 agent 主動巡檢通知。
配合 Phase 1(PPT freshness gate)+ Phase 2(agent tool)+ Phase 3(cmd 路徑
agent dispatch)+ Phase 4(對話 state),Telegram Bot 互動層的『rigid default
+ 靜默空白』反模式根除。

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-05-02 13:07:30 +08:00
OoO
14195b65fd feat(telegram): ADR-019 Phase 4 - conversation memory + chat_id propagation
All checks were successful
CD Pipeline / deploy (push) Successful in 2m51s
ADR-019 Phase 4:新增 services/openclaw_session.py 管理 chat_id 級別的多輪
對話歷史與 carry-over slot。In-memory,30 分鐘 TTL,重啟清空(臨時對話 state
不該污染 ai_insights 永久記憶)。

openclaw_answer 簽章加 chat_id=None 可選參數:
- 傳入時 agent 會看到該 chat 最近 5 輪對話歷史,注入 system prompt
- Ollama / Gemini FC 兩條路徑都會在生成成功後 append_turn 寫回 session
- system prompt 加決策規則:「若歷史顯示用戶剛被問參數,優先用該答案接續執行」

Caller 全部更新傳 chat_id:
- routes/openclaw_bot_routes.py:5479 (handle_cmd 不認識指令 fallback)
- routes/openclaw_bot_routes.py:5916 (webhook NL 路徑)
- routes/openclaw_bot_routes.py:_agent_dispatch_cmd (Phase 3 hook)
- services/telegram_bot_service.py:934 (polling NL fallback)

向下相容:chat_id=None 時行為與舊版完全相同(無 multi-turn 記憶)。

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-05-02 13:04:18 +08:00
OoO
1a886d962b fix(telegram): dedupe webhook+polling updates via shared DB guard
All checks were successful
CD Pipeline / deploy (push) Successful in 8m50s
Webhook (Flask) and polling (momo-telegram-bot) consumed the same
Telegram update_id, causing /menu callbacks to fire twice. Add a
shared dedup module backed by telegram_update_dedup table (300s TTL,
60s cleanup) with in-memory fallback, wired into both paths.

Polling launcher now skips startup when webhook is configured to
prevent dual-consumption at the source.

38 tests across webhook, menu keyboards, telegram_api, dedup guard,
and trend bot service.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-05-02 12:01:04 +08:00
OoO
75de76ac12 fix(momo): block EC404 auto-open with end-to-end URL guard
Some checks failed
CD Pipeline / deploy (push) Has been cancelled
- normalize URLs at write time (scheduler crawlers, routes) to drop
  javascript:/EC404/placeholder i_code (momo_/manual_/pchome_)
- add global click+auxclick guard in base.html and ewoooc_base.html
  that intercepts blocked MOMO URLs and redirects to safe i_code URL
- per-page dashboards reuse the same isLikelyMomoIcode validation
- /api/track_momo_link records blocked events for diagnosis
- ship sanitize_momo_urls.py to clean existing polluted DB rows

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-05-02 12:00:34 +08:00
OoO
7d46ff9ba5 feat(competitor): persist match attempts
All checks were successful
CD Pipeline / deploy (push) Successful in 2m9s
2026-05-01 20:56:17 +08:00
OoO
2ac7410d40 fix(dashboard): prewarm cache and expose pick evidence
All checks were successful
CD Pipeline / deploy (push) Successful in 2m20s
2026-05-01 16:34:13 +08:00
OoO
9e2337764b fix(ai): supersede old product picks
All checks were successful
CD Pipeline / deploy (push) Successful in 2m48s
2026-05-01 16:24:15 +08:00
OoO
3920701e1a feat(dashboard): optimize cache and AI pick confidence
All checks were successful
CD Pipeline / deploy (push) Successful in 2m46s
2026-05-01 16:01:52 +08:00
OoO
a5de082437 feat(dashboard): 顯示 50 品 AI 挑品清單
All checks were successful
CD Pipeline / deploy (push) Successful in 3m12s
2026-05-01 15:08:41 +08:00
OoO
ea15aa6437 refactor(vendor): 抽出廠商管理查詢服務
Some checks failed
CD Pipeline / deploy (push) Failing after 8m57s
2026-05-01 14:20:09 +08:00
OoO
fbc85fcedc refactor(vendor): 抽出缺貨 API 查詢服務
All checks were successful
CD Pipeline / deploy (push) Successful in 2m11s
2026-05-01 14:12:56 +08:00
OoO
b5de8d5d61 fix(ai): 價格調整轉人工覆核
All checks were successful
CD Pipeline / deploy (push) Successful in 2m16s
2026-05-01 14:09:54 +08:00
OoO
62f8f1d52d refactor(vendor): 抽出缺貨 V2 查詢服務
Some checks failed
CD Pipeline / deploy (push) Has been cancelled
2026-05-01 14:07:10 +08:00
OoO
8a3d50933b feat(ai): 自動補抓並重算 PChome 挑品
All checks were successful
CD Pipeline / deploy (push) Successful in 2m18s
2026-05-01 14:02:37 +08:00
OoO
043a7dc915 feat(ai): 補抓 PChome 待比對商品
All checks were successful
CD Pipeline / deploy (push) Successful in 2m20s
2026-05-01 13:40:37 +08:00
OoO
9f9e0727e7 fix(ai): 自動偵測挑品銷售欄位
All checks were successful
CD Pipeline / deploy (push) Successful in 1m50s
2026-05-01 10:18:07 +08:00
OoO
70de91f1f6 fix(ai): 修正挑品清單銷售日期查詢
All checks were successful
CD Pipeline / deploy (push) Successful in 2m14s
2026-05-01 10:12:32 +08:00
OoO
20f6b2ded2 fix(feeder): 控制 PChome 多關鍵字搜尋成本
All checks were successful
CD Pipeline / deploy (push) Successful in 2m16s
2026-05-01 10:08:24 +08:00
OoO
82d759d3b1 feat(ai): 建立 PChome 銷售挑品清單
All checks were successful
CD Pipeline / deploy (push) Successful in 2m24s
2026-05-01 10:05:16 +08:00
OoO
55855ef508 feat(frontend): 保存 PChome 競品價格歷史
All checks were successful
CD Pipeline / deploy (push) Successful in 1m39s
2026-05-01 00:53:37 +08:00
OoO
dd35306399 refactor(openclaw): 抽出選單鍵盤 builders
All checks were successful
CD Pipeline / deploy (push) Successful in 1m46s
2026-04-30 23:17:19 +08:00
OoO
d88dcc8f75 fix(devops): 清理舊端口與危險 compose 操作
All checks were successful
CD Pipeline / deploy (push) Successful in 1m45s
2026-04-30 14:24:53 +08:00
OoO
fb9c4ad1b5 refactor(openclaw): 抽出 Telegram API helper
Some checks failed
CD Pipeline / deploy (push) Has been cancelled
2026-04-30 14:24:45 +08:00
OoO
89e7f2ccd2 fix(ai): 擴大 ElephantAlpha 暫時性 fallback
All checks were successful
CD Pipeline / deploy (push) Successful in 1m46s
2026-04-30 13:59:12 +08:00
OoO
72fa166729 fix(ai): 遷移 Ollama embedding 至 api embed
All checks were successful
CD Pipeline / deploy (push) Successful in 1m46s
2026-04-30 10:24:15 +08:00
OoO
91ad98e621 feat(ai): 強化 ElephantAlpha NIM fallback
All checks were successful
CD Pipeline / deploy (push) Successful in 1m48s
2026-04-30 09:33:39 +08:00
OoO
d5f4fd7198 加入 AI Smoke 每日摘要推播
All checks were successful
CD Pipeline / deploy (push) Successful in 1m15s
2026-04-29 23:57:36 +08:00
OoO
10bbd55f5b 補齊 AI Smoke 趨勢管理
All checks were successful
CD Pipeline / deploy (push) Successful in 1m13s
2026-04-29 23:54:23 +08:00
OoO
81159b5b3d 保存 AI Smoke 趨勢紀錄
All checks were successful
CD Pipeline / deploy (push) Successful in 1m14s
2026-04-29 23:50:44 +08:00
OoO
cde8b0cd3e 新增 AI 自動化 Smoke Dashboard
All checks were successful
CD Pipeline / deploy (push) Successful in 1m16s
2026-04-29 23:46:48 +08:00
OoO
e6a1c9d09f 補齊 AI 自動化可觀測性指標
All checks were successful
CD Pipeline / deploy (push) Successful in 1m15s
2026-04-29 23:41:03 +08:00
OoO
162a76b8f9 落地 L2 安全記憶動作
All checks were successful
CD Pipeline / deploy (push) Successful in 1m9s
2026-04-29 23:29:45 +08:00
OoO
5b25f55340 補齊 EventRouter 失敗通知回放
All checks were successful
CD Pipeline / deploy (push) Successful in 1m10s
2026-04-29 23:26:02 +08:00
OoO
d4865983d8 補強 ElephantAlpha 執行與通知閉環
All checks were successful
CD Pipeline / deploy (push) Successful in 1m10s
2026-04-29 23:14:09 +08:00
OoO
78eebfbcfc 加入告警去重與洞察向量回補
All checks were successful
CD Pipeline / deploy (push) Successful in 1m19s
2026-04-29 23:10:27 +08:00
OoO
0c2e9bbced 串接 AI 洞察向量化與漏通知入口
All checks were successful
CD Pipeline / deploy (push) Successful in 1m13s
2026-04-29 23:05:46 +08:00
OoO
f0e044aa48 補齊自癒稽核與 OpenClaw 記憶閉環
All checks were successful
CD Pipeline / deploy (push) Successful in 1m16s
2026-04-29 23:02:06 +08:00
OoO
1c2dc6cd61 補強 AI 自動化閉環與安全降級
All checks were successful
CD Pipeline / deploy (push) Successful in 1m14s
2026-04-29 22:56:00 +08:00
OoO
0875dd8fda 補強 5.5 自癒安全回看
All checks were successful
CD Pipeline / deploy (push) Successful in 1m11s
2026-04-29 22:48:24 +08:00
OoO
779b27f676 修復 P0 告警自癒鏈與測試收集
All checks were successful
CD Pipeline / deploy (push) Successful in 9m39s
2026-04-29 22:37:20 +08:00
OoO
4cbd775c1b fix(aiops): 補齊 Elephant Alpha trigger context
All checks were successful
CD Pipeline / deploy (push) Successful in 1m39s
部署閘門修復:補 autonomous engine 的 confidence/max decision 初始化與 _build_trigger_context,避免 scheduler autonomous monitoring 持續噴 AttributeError。
2026-04-29 21:48:41 +08:00
OoO
4d5a995718 chore: 刪除孤兒 AI service 並補齊 env 範例
ADR-017 Phase 3f-5:刪除未被 runtime 引用的 elephant_alpha_decision_router、telegram_ai_integration、watcher_agent;補 .env.example 的 Aider/AutoHeal/NVIDIA/OpenClaw/backup/report/PG sync 等實際讀取變數。
2026-04-29 21:46:24 +08:00