Commit Graph

240 Commits

Author SHA1 Message Date
OoO
bd6310365e 停用 CICD 舊叢集副作用
Some checks failed
CD Pipeline / deploy (push) Has been cancelled
2026-05-13 19:19:15 +08:00
OoO
0bdb993914 補 OpenClaw 報表資料解析診斷
All checks were successful
CD Pipeline / deploy (push) Successful in 55s
2026-05-13 12:53:57 +08:00
OoO
bff8c4941c 補 Code Review 失敗通知診斷
Some checks failed
CD Pipeline / deploy (push) Has been cancelled
2026-05-13 12:53:01 +08:00
OoO
f4883b487c 保留 PPT Vision 主機標記失敗診斷
All checks were successful
CD Pipeline / deploy (push) Successful in 56s
2026-05-13 12:51:44 +08:00
OoO
c227bb4078 補競品 Feeder 搜尋詞 fallback 診斷
All checks were successful
CD Pipeline / deploy (push) Successful in 56s
2026-05-13 12:49:03 +08:00
OoO
28c95558ab 修正挑品 Agent SQLite fallback
All checks were successful
CD Pipeline / deploy (push) Successful in 56s
2026-05-13 12:28:38 +08:00
OoO
9ec7713e6f 補 AiderHeal 靜默失敗診斷
All checks were successful
CD Pipeline / deploy (push) Successful in 56s
2026-05-13 12:25:35 +08:00
OoO
d8c7f6f19c 快取當日業績頁面 context
Some checks failed
CD Pipeline / deploy (push) Has been cancelled
2026-05-13 12:19:11 +08:00
OoO
f8b9b1abf7 共用業績分析頁面快取
All checks were successful
CD Pipeline / deploy (push) Successful in 57s
2026-05-13 12:15:27 +08:00
OoO
b65a319cb8 固化 Ollama 三主機路由紅線
Some checks failed
CD Pipeline / deploy (push) Has been cancelled
2026-05-13 12:09:40 +08:00
OoO
2130c4f54b 守住 AI provider Ollama-first
All checks were successful
CD Pipeline / deploy (push) Successful in 56s
2026-05-13 12:07:33 +08:00
OoO
0c9f9278f1 啟用 Market Intel seed writer CLI gate
All checks were successful
CD Pipeline / deploy (push) Successful in 57s
2026-05-13 12:06:02 +08:00
OoO
6313fdd293 對齊 Ollama-first flag 語義
All checks were successful
CD Pipeline / deploy (push) Successful in 56s
2026-05-13 12:00:21 +08:00
OoO
ce208921af 限制 Ollama host 只能走核准節點
All checks were successful
CD Pipeline / deploy (push) Successful in 58s
2026-05-13 11:58:45 +08:00
OoO
d02b712439 標明 cache service 相容角色
All checks were successful
CD Pipeline / deploy (push) Successful in 57s
2026-05-13 11:54:46 +08:00
OoO
1aeb4a4b8e 移除 AI logger 未用 stack 推斷
Some checks failed
CD Pipeline / deploy (push) Has been cancelled
2026-05-13 11:54:16 +08:00
OoO
5b52af9e2f 補強 cache best-effort 診斷
All checks were successful
CD Pipeline / deploy (push) Successful in 56s
2026-05-13 11:04:34 +08:00
OoO
8a36856171 補強 Telegram callback 診斷
Some checks failed
CD Pipeline / deploy (push) Has been cancelled
2026-05-13 11:03:37 +08:00
OoO
f44c429a56 補強 AI logger best-effort 診斷
Some checks failed
CD Pipeline / deploy (push) Has been cancelled
2026-05-13 11:02:38 +08:00
OoO
4e6e9bfe5d 綁定自動匯入日期查詢參數 2026-05-13 10:28:48 +08:00
OoO
5625032a8d 記錄 AI caller registry 匯入失敗
All checks were successful
CD Pipeline / deploy (push) Successful in 57s
2026-05-13 10:04:45 +08:00
OoO
0a75d11a28 記錄 Claude 成本節流檢查失敗
All checks were successful
CD Pipeline / deploy (push) Successful in 59s
2026-05-13 10:03:13 +08:00
OoO
f49413e78a 記錄 EA short-circuit 遙測失敗
All checks were successful
CD Pipeline / deploy (push) Successful in 56s
2026-05-13 10:01:46 +08:00
OoO
c300e496c5 記錄 ROI 月報反饋區塊失敗
All checks were successful
CD Pipeline / deploy (push) Successful in 55s
2026-05-13 10:00:04 +08:00
OoO
ba8510eac7 補齊 MCP 早退狀態
All checks were successful
CD Pipeline / deploy (push) Successful in 57s
2026-05-13 09:40:55 +08:00
OoO
d15b2215f1 細分 MCP 呼叫遙測狀態
Some checks failed
CD Pipeline / deploy (push) Has been cancelled
2026-05-13 09:35:27 +08:00
OoO
2068a3719d 修正 Telegram 分類按鈕預設 callback
All checks were successful
CD Pipeline / deploy (push) Successful in 55s
2026-05-13 09:27:34 +08:00
OoO
44eb36992e 補上 MCP filesystem 唯讀白名單
All checks were successful
CD Pipeline / deploy (push) Successful in 55s
2026-05-13 09:26:12 +08:00
OoO
36d0e5d5f3 標記 RAG 命中節省 LLM 呼叫
All checks were successful
CD Pipeline / deploy (push) Successful in 56s
2026-05-13 09:21:50 +08:00
OoO
f2b91beb61 記錄 RAG 人工審核者 hash
All checks were successful
CD Pipeline / deploy (push) Successful in 58s
2026-05-13 09:13:29 +08:00
OoO
8087d13e31 補上 MCP DB writer 失敗診斷
All checks were successful
CD Pipeline / deploy (push) Successful in 57s
2026-05-13 09:10:28 +08:00
OoO
4f62480bdb 串接 AutoHeal 共用 SSH helper
All checks were successful
CD Pipeline / deploy (push) Successful in 56s
2026-05-12 23:53:32 +08:00
OoO
c4d39cf544 串接 AiderHeal 共用 SSH helper
Some checks failed
CD Pipeline / deploy (push) Has been cancelled
2026-05-12 23:52:28 +08:00
OoO
83e7e0cceb 移除誤入 UI commit 的非前端檔案
Some checks failed
CD Pipeline / deploy (push) Has been cancelled
2026-05-12 23:52:25 +08:00
OoO
eb9cac0d19 改善活動看板手機導覽排版
All checks were successful
CD Pipeline / deploy (push) Successful in 57s
2026-05-12 23:50:18 +08:00
OoO
caa6263872 同步 incidents 相容欄位寫入
All checks were successful
CD Pipeline / deploy (push) Successful in 56s
2026-05-12 23:31:33 +08:00
OoO
14c5349b69 補齊 AI 觀測表 ORM 與 embedding 簽名
All checks were successful
CD Pipeline / deploy (push) Successful in 56s
2026-05-12 23:13:20 +08:00
OoO
fccc80858d 修復 Wave 0 阻塞與 market intel 入庫 2026-05-12 22:49:56 +08:00
OoO
30a173cf69 統一全站暖色視覺與市場情報骨架
All checks were successful
CD Pipeline / deploy (push) Successful in 58s
2026-05-06 20:24:46 +08:00
OoO
153e4c9734 fix(observability): revert unrelated quick review commit files
All checks were successful
CD Pipeline / deploy (push) Successful in 58s
2026-05-06 19:50:52 +08:00
OoO
308efdce25 chore(observability): clarify quick review completion copy
All checks were successful
CD Pipeline / deploy (push) Successful in 1m4s
2026-05-06 19:49:28 +08:00
OG T
0904a60237 fix(scheduler): quiet cold-start noise gates
All checks were successful
CD Pipeline / deploy (push) Successful in 1m29s
2026-05-06 00:31:30 +08:00
OG T
f6a2a05e3f fix(aiops): treat openclaw strategy actions as advisory
Some checks failed
CD Pipeline / deploy (push) Has been cancelled
2026-05-05 13:49:36 +08:00
OoO
7a10d27d61 feat(p53): K8s Nginx Proxy 支援 — host_label/provider_tag 補完
Some checks failed
CD Pipeline / deploy (push) Has been cancelled
問題:
K8s 內網無法直連 GCP 公網 11434,所以 110 跳板架了 Nginx Proxy
轉發 11435/11436 到 GCP-A/GCP-B。但 services/ollama_service.py 的
get_host_label() 只看 IP substring(34.143.170.20 / 34.21.145.224),
K8s 環境會 fallback 到「未知」造成觀測台主機標籤錯亂。

修補:
- services/ollama_service.py::get_host_label
  新增:
    192.168.0.110:11435 → "GCP-SSD(via Nginx 110)"
    192.168.0.110:11436 → "GCP-SSD-2(via Nginx 110)"
  保留:直連 GCP / 111 / 188 / localhost 既有判斷

- services/ollama_service.py::get_provider_tag(新函式)
  統一 provider 標籤判斷(之前散落 code_review_pipeline 等多處重寫):
    GCP 直連 + Nginx 11435 → 'gcp_ollama'
    GCP-B 直連 + Nginx 11436 → 'ollama_secondary'
    111 → 'ollama_111'
    其他 → 'ollama_other'
  跨環境統一:ai_calls.provider 在 docker-compose / K8s 都記同一 tag,
  跨環境統計不分裂。

- services/code_review_pipeline_service.py:233
  改用統一 get_provider_tag(),移除原本 hardcode 的 if/else IP 判斷。

- k8s/02-configmap.yaml(user 已改)
  OLLAMA_HOST_PRIMARY = http://192.168.0.110:11435 (Nginx → GCP-A)
  OLLAMA_HOST_SECONDARY = http://192.168.0.110:11436 (Nginx → GCP-B)
  OLLAMA_HOST_FALLBACK = http://192.168.0.111:11434 (內網)

driver test:
  http://34.143.170.20:11434 → GCP-SSD / gcp_ollama
  http://192.168.0.110:11435 → GCP-SSD(via Nginx 110)/ gcp_ollama
  http://192.168.0.111:11434 → 111 備援 / ollama_111

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-05-05 01:09:56 +08:00
OoO
822789c810 feat(p49): Telegram 補完 9 頁對應 + daily summary 加商業面未跟進警示
All checks were successful
CD Pipeline / deploy (push) Successful in 2m58s
M-B: Telegram 對應從 6/9 → 9/9
新增 3 個 cmd handler,對應 Phase 45-48 的 3 個新觀測頁:
- cmd:obs_overview — 一頁式總覽(三主機 24h + AI 呼叫 + 月成本 + 待審 episode)
- cmd:obs_orchestration — Agent 編排矩陣(4 Agent × Models 24h 數字)
  本地 Ollama % / RAG 命中 % / 錯誤率 + cost
- cmd:obs_business — 商業面 × AI(價格決策 7d by strategy
  + 未跟進機會 + Outcomes verdict 30d)

services/openclaw_bot/menu_keyboards.py::_submenu_observability 升級為 9 項

M-C: daily summary(每日 09:30)加商業面警示
- 從 ai_price_recommendations × action_plans 跨表 JOIN
  偵測 high-confidence (≥0.7) 卻無對應 action_plan 的「機會流失」
- 7d 內若有未跟進,daily summary 自動標 ⚠️ 警示
- 對應 Phase 48 business_intel 頁同個邏輯,閉環推送

inline keyboard 升級:日報附 6 個入口(總覽/編排/商業面/主機/AI/預算),
不再只有 4 個

Phase 38→49 累計 14 commits。觀測台戰役完整收官:
- 9 頁全部對應 Telegram cmd
- DB 22/22 = 100% 全覆蓋
- 6 個 L2 一鍵 + 3 種主動推送(即時/異常/日常)
- 日報含商業面警示

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-05-04 20:00:15 +08:00
OoO
5935a6512c feat(p38): Telegram 補 4 個 AI 觀測台命令(B-3 完成)
All checks were successful
CD Pipeline / deploy (push) Successful in 2m31s
統帥盤點要求:6 個觀測頁是否都有 Telegram 對應?
盤點結果:promotion_review 已有 (pg_ok/pg_no inline button),剩 4 個缺。

新增 4 個 cmd handler 對應 4 個觀測頁面:
1. cmd:obs_ai_calls — AI 呼叫總覽(24h)
   - 總呼叫 / Token / cost / errors / RAG 命中 / cache 命中
   - Top 5 provider 分組
2. cmd:obs_health — 主機健康監控
   - 三主機 GCP-A / GCP-B / 111 即時 HTTP probe
   - 過去 24h uptime % + 平均 response_ms(讀 host_health_probes)
3. cmd:obs_budget — 預算控管
   - 當月 spent vs budget 各 provider
   - 超 alert_pct 自動標記 ⚠️ / 超 100% 標記 🚨
4. cmd:obs_quality — Caller 反饋趨勢
   - 過去 30 日 avg_score 最低 8 名
   - 含 thumbs_up/down + trend 圖示
   - 含 智能建議(feedback_quality_tracker)

UI/UX:
- main_menu_keyboard 加「🛰 AI 觀測台」入口
- 新 _submenu_observability() 在 menu_keyboards.py
- _SUBMENUS 註冊 'observability' key
- titles 映射加 observability 標題
- 4 個命令 cross-link(彼此互通 + 返回主選單)

Telegram 6/6 對應達成:
- promotion_review: pg_ok/pg_no inline button (既有)
- ai_calls: cmd:obs_ai_calls (新增)
- host_health: cmd:obs_health (新增)
- budget: cmd:obs_budget (新增)
- quality_trend: cmd:obs_quality (新增)
- ppt_audit: 既有「有 issues 才推 Telegram」推送行為(不需查詢命令)

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-05-04 18:58:30 +08:00
OoO
0b13055466 feat(p38): host_health + ppt_audit DB 持久化(B-1 + B-2)
統帥要求:
1. 所有 6 個觀測頁的功能和數據都要完整寫入資料庫儲存
2. Ollama 切 GCP 順序 GCP-A → GCP-B → 111

盤點結果:
- 4/6 頁面已有 DB 表(ai_calls / learning_episodes / rag_query_log / ai_call_budgets)
- 2/6 頁面是即時查詢無歷史:host_health(HTTP probe)、ppt_audit(os.listdir)
- Ollama 99% 已合規,僅 1 處過時註解

修補(B-1):
- services/code_review_pipeline_service.py:207 註解更新
  「直呼內網 Ollama (192.168.0.188)」→ 「走 resolve_ollama_host 三主機級聯 ADR-027」

新增(B-2):
- migrations/029_create_host_health_probes.sql
  - 三主機健康歷史表(label/url/healthy/response_ms/error_msg)
  - 索引:probed_at / (host_label, probed_at)
  - 30 天保留(cron 清理)
- migrations/030_create_ppt_audit_results.sql
  - PPT 視覺審核結果表(status/issues_count/issues_found JSONB/confidence)
  - 索引:audited_at / pptx_filename / failed-only partial
- routes/admin_observability_routes.py:host_health_dashboard
  - 每次 probe 寫入 host_health_probes(失敗安全)
  - 新增 24h 健康趨勢卡片(uptime % / 平均 ms)
- routes/admin_observability_routes.py:ppt_audit_history
  - 從 ppt_audit_results 讀過去 7 日 audit 紀錄
  - 顯示審核時間/檔名/結果/問題數/信心度/耗時
- services/ppt_vision_service.py:check_ppt_file
  - 新增 _persist_audit_result() 跑完寫入 DB(status/issues/confidence/duration)
  - 失敗安全:DB 寫入失敗只 log warning,不擋主流程
- templates/admin/host_health.html + ppt_audit_history.html
  - 新增「24h 健康趨勢」card(host_health)
  - 新增「視覺審核歷史紀錄」card(ppt_audit)

DoD:
- 程式碼語法 ✓
- Jinja 平衡 ✓
- 失敗安全(DB 寫入或讀取失敗都不擋頁面渲染)✓

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-05-04 18:55:39 +08:00
OoO
72a7c385d5 feat(p26): PPT 視覺審核 daily 22:00 cron — minicpm-v 自動掃當天新生 .pptx
All checks were successful
CD Pipeline / deploy (push) Successful in 2m54s
Operation Ollama-First v5.0 / Phase 26 — PPT 自我審視整合

services/ppt_vision_service.py 擴充:
- check_ppt_file(pptx_path, max_slides=5) — 整檔視覺檢查
  • LibreOffice headless 轉每張 slide 為 png
  • 對前 N 張跑 check_image
  • 彙總 issues + 平均 confidence
  • fail-safe:LibreOffice 不在 / 轉檔失敗 → 回 skip 不阻擋
- audit_recent_ppts(reports_dir, hours=24, max_files=10)
  • 掃 reports/ 過去 24h 新生 .pptx(getmtime filter)
  • 對每個檔跑 check_ppt_file
  • 彙總總 issues
- push_ppt_audit_to_telegram(summary)
  • 有 issues 才推 Telegram(避免「無問題」洗版)
  • 每檔最多 3 張 slide / 每張 2 個 issue 列出

run_scheduler.py — 每日 22:00 cron
- run_ppt_vision_audit task wrapper
- PPT_VISION_ENABLED=false 時 service 內部 skip(不打 LLM)

設計哲學:
不動既有 5 個 prs.save() 呼叫點(risk 高)→ 改寫獨立 daily cron 集中處理
零侵入 PPT 生成主流程 / 零 risk regression / feature flag OFF 預設

部署需求:
LibreOffice headless(apt install libreoffice)— 不在則 cron task 自動 skip + log

tests/test_ppt_vision_audit.py (9 tests 全綠)
- flag OFF skip / 目錄不存在 / 無 .pptx
- 舊檔(>hours)filter / LibreOffice 不在 fail-safe
- check_ppt_file flag/missing 容錯
- Telegram 推播:無 issues 不推 / 有 issues 推

regression: ppt_vision_service 既有 6 tests 全綠

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-05-04 11:16:11 +08:00
OoO
bd32e04dad feat(p25): 反饋環深化 — caller-level quality 趨勢追蹤 + ROI 月報整合
All checks were successful
CD Pipeline / deploy (push) Successful in 3m2s
Operation Ollama-First v5.0 / Phase 25 — 反饋環自主學習深化

services/feedback_quality_tracker.py (180+ 行)
- 純 SQL 統計,零 LLM 成本
- 4 個閾值常數(demote 👎×5/avg<2.5 / promote 👍×10/avg>=4.5)
- compute_caller_quality_trend(days=7) — 取近 N 日各 caller 反饋
- get_caller_recommendations() — 給 token 日報/ROI 月報用
  • 規則 1: 👎 ≥ 5 次 → review
  • 規則 2: avg < 2.5 + 樣本足 → review
  • 規則 3: 👍 ≥ 10 + avg ≥ 4.5 → promote(建議關閉 Gemini fallback)
- should_demote_caller(caller) — 自動降權判斷(戰役預設不啟用)
- render_quality_summary() — 給訊息用 emoji 摘要

ROI 月報整合(services/roi_report_service.py):
- 加 Section 「💬 Caller 反饋趨勢(30 日)」TOP 10 by 最低 avg
- 加 Section 「🔮 智能建議」最多 3 條(review / promote)
- 失敗 swallow 不影響月報主流程

訊息範例:
  💬 Caller 反饋趨勢(30 日)
    ⚠️ openclaw_qa: avg 1.85/5 (👍2 👎8 n=12)
     hermes_analyst: avg 3.10/5 (👍5 👎3 n=10)
     ppt_gemini: avg 4.75/5 (👍12 👎0 n=15)
  🔮 智能建議
    ⚠️ openclaw_qa: 近 30 日 👎 反饋 8 次 (avg 1.85/5) — 建議統帥檢視 prompt 或切換 model
     ppt_gemini: 近 30 日 👍 反饋 12 次 — 可考慮關閉 Gemini fallback 純走 Ollama

tests/test_feedback_quality_tracker.py (10 tests 全綠)
- 4 閾值常數 / DB fail 安全 / 空 trends 容錯
- demote 規則(👎 多次)/ promote 規則(👍 多次)/ neutral 不觸發
- should_demote_caller 樣本不足保護
- trend 分類(positive/negative/neutral/no_data)正確

依 ADR-032 RAG 自主學習迴圈 + ADR-033 護欄 #1
不直接改 caller 行為(避循環自動修正失控),只產出建議給統帥審視。

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-05-04 11:12:52 +08:00
OoO
0476d3ae4e feat(p24): ROI 月報生成器 — 每月 1 日 09:00 推 Telegram
All checks were successful
CD Pipeline / deploy (push) Successful in 2m49s
Operation Ollama-First v5.0 / Phase 24 — 戰役 ROI 自動量化

services/roi_report_service.py (200+ 行)
- BASELINE 戰前估算(gemini 50M/$20、nim 5.8M、ollama 30M、total $25/月)
- query_last_month_stats() — SQL 查上月 ai_calls + mcp_calls + rag_query_log
- render_roi_report(stats) — HTML 訊息(含 5 區塊:成本攔截/provider 分布/RAG/MCP+Cache/KPI)
- generate_and_send_roi_report() — 主入口,推 Telegram + 寫 ai_insights 長期記錄
- 達標標記:Gemini -23.5%  / RAG 命中 ≥25% 

Telegram 訊息範例:
  📊 ROI 月報 2026年04月
  💰 成本攔截
    Gemini: 35,000,000 tokens / $14.00
    vs 戰前: 50,000,000 / $20.00
     攔截: 15,000,000 tokens / $6.00 (30.0%)
  🤖 Provider 分布
  🧠 RAG 自主學習(含 saved_call / 反饋分數)
  🔧 MCP + Cache
  📈 戰役 v5.0 KPI  達標

run_scheduler.py — 每日 09:00 跑(內部判斷月初第 1 日才送)
- run_roi_monthly_report_if_new_month task wrapper
- 失敗 swallow log,不影響其他排程

tests/test_roi_report_service.py (7 tests 全綠)
- BASELINE 必要欄位 / 月份範圍計算 (1月→去年12月)
- 達標訊息含  + 攔截數字
- 未達標訊息含 ⚠️
- 空 stats 容錯 / DB fail 回空 dict 不 raise

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-05-04 11:04:14 +08:00