OG T
bfda353270
fix(ci): 清理 .claude/worktrees 防止 submodule 錯誤
...
問題: Runner 上的 .claude/worktrees 被誤認為 submodule
解決: 在 checkout 前清理 worktrees 目錄
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com >
2026-03-25 21:24:08 +08:00
OG T
75ef8fee0c
feat(api): Phase 16 R3.3 Repository 實作 + CI 修復
...
新增:
- ApprovalDBRepository: Approval CRUD 操作
- IncidentDBRepository: Incident CRUD 操作
- get_approval_repository/get_incident_repository 函數
修復:
- .gitignore 新增 .claude/worktrees/ (防止 CI 失敗)
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com >
2026-03-25 21:22:02 +08:00
OG T
fe76d0b108
feat(api): Phase 16 R3.1-R3.2 Repository 介面定義
...
新增:
- IApprovalRepository Protocol
- IIncidentRepository Protocol
- ITimelineRepository Protocol
設計: DI 友好的 Protocol 介面,Service 層只依賴抽象
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com >
2026-03-25 21:17:51 +08:00
OG T
14dc77e4ad
chore(api): Phase 16 R2 封存舊版代碼
...
封存:
- incident_memory_v1.py (483 行) - 絞殺者模式前版本
- incident_engine_v1.py (657 行) - 絞殺者模式前版本
策略: 90 天後無問題才刪除 (2026-06-24)
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com >
2026-03-25 16:08:49 +08:00
OG T
ef12228cc7
docs: Phase 16 絞殺者模式啟用 - 48hr 驗證開始
...
- USE_NEW_ENGINE=true 已在 Production 啟用
- 驗證期: 2026-03-26 16:04 → 2026-03-27 16:04
- 所有組件 healthy
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com >
2026-03-25 16:06:32 +08:00
OG T
708ea4686e
fix(cd): 修復 Build 跳過時的 ImagePullBackOff 問題
...
問題: 當 Build Web/API 被跳過時,Deploy 仍更新 image tag 到不存在的版本
解決: 根據 build job 結果條件性更新 image
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com >
2026-03-25 16:02:44 +08:00
OG T
485cce8c01
docs: 更新 Phase 16 R1.2-R1.3 完成狀態
...
- LOGBOOK: 記錄絞殺者模式完成 + 架構圖
- 下一步: 部署驗證 → USE_NEW_ENGINE=true → 48hr 監控
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com >
2026-03-25 15:55:48 +08:00
OG T
2637263093
feat(api): Phase 16 R1.3 IncidentEngine 絞殺者模式
...
新增:
- IncidentMemoryAdapter: 實作 IIncidentMemory Protocol
- BlastRadiusAdapter: 實作 IBlastRadiusAnalyzer Protocol
- get_incident_engine() 雙軌切換 (USE_NEW_ENGINE)
絞殺者模式設計:
- 預設 USE_NEW_ENGINE=false (使用內嵌版)
- 設為 true 時使用 lewooogo-brain IncidentEngine
- 回滾: kubectl set env deployment/awoooi-api USE_NEW_ENGINE=false
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com >
2026-03-25 15:47:52 +08:00
OG T
21ecedded2
fix(api): 修復 incident_memory import 排序 (I001)
...
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com >
2026-03-25 15:41:42 +08:00
OG T
b097567819
chore: Runner 穩定性 + 封存目錄結構
...
Runner 穩定性:
- 新增 setup-runner-watchdog.sh (5分鐘 Watchdog)
- 新增 setup-runner-2.sh (第二個 Runner 安裝)
封存策略:
- 建立 _archived/ 目錄結構
- 新增 ARCHIVE_LOG.md 封存紀錄模板
統帥裁示: 不要只是臨時解決,要徹底解決!
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com >
2026-03-25 15:38:29 +08:00
OG T
20984fd354
feat(api): Phase 16 R1.2 完善 PostgreSQL 整合 + 封存策略
...
lewooogo-brain:
- 新增 IIncidentDbAdapter Protocol (DI 模式)
- load_incident 支援 Episodic Memory 回填
- persist_incident 透過 db_adapter 執行
apps/api:
- 新增 IncidentDbAdapter 實現 (SQLAlchemy 操作封裝)
- 絞殺者模式完整整合 lewooogo-brain + PostgreSQL
Skill 06 v1.4:
- 新增「封存而非刪除」策略 (統帥裁示)
- 封存目錄結構 + ARCHIVE_LOG.md 格式
- 90 天保留期 + 48hr 驗證期
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com >
2026-03-25 15:31:03 +08:00
OG T
a202a2693a
feat(api): Phase 16 R1.2 絞殺者模式 (Strangler Fig Pattern)
...
- 新增 USE_NEW_ENGINE 設定開關 (預設 False)
- incident_memory.py 雙軌切換: 內嵌版本 ↔ lewooogo-brain
- 自動降級: lewooogo-brain 不可用時回退內嵌版本
- 回滾指令: kubectl set env deployment/awoooi-api USE_NEW_ENGINE=false
統帥批准 2026-03-26 立即執行
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com >
2026-03-25 15:23:03 +08:00
OG T
cdbd6f0fa6
fix(api): 修復 MCP providers lint 錯誤
...
- interfaces.py: 修正 import 排序
- signoz_provider.py: 移除未使用變數
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com >
2026-03-25 14:44:03 +08:00
OG T
643946e60c
refactor(api): ADR-015 MCP 模組化架構重構
...
## 重構內容
符合 leWOOOgo 積木化原則:
- 新增 interfaces.py: MCPToolProvider ABC 定義
- 新增 registry.py: Provider 註冊中心 (DI 模式)
- 新增 providers/: K8s, SignOz, Database 具體實作
- 重構 mcp_bridge.py: 透過 ProviderRegistry 委派執行
## 修復 Code Review 問題
- 🔴 移除 _execute_stdio logging 敏感 parameters
- 🔴 修復 conversational-view.tsx i18n 硬編碼
## 新增檔案
- apps/api/src/plugins/mcp/interfaces.py
- apps/api/src/plugins/mcp/registry.py
- apps/api/src/plugins/mcp/providers/__init__.py
- apps/api/src/plugins/mcp/providers/k8s_provider.py
- apps/api/src/plugins/mcp/providers/signoz_provider.py
- apps/api/src/plugins/mcp/providers/database_provider.py
- docs/adr/ADR-015-mcp-modular-architecture.md
- .dependency-cruiser.cjs (Phase 14.2 準備)
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com >
2026-03-25 14:31:32 +08:00
OG T
c0ad8f8686
fix(api): 方案 C - Incident 解析相容舊格式 Enum
...
問題: Redis 存有舊 Enum 值 (status='open', severity='critical')
導致 Pydantic 驗證失敗
解法:
- normalize_status(): 'open' → 'investigating'
- normalize_severity(): 'critical' → 'P0' 等
- 應用於 get_from_working_memory, get_active_incidents, _record_to_incident
優點:
- 零資料風險 (不動 Redis)
- 回滾 = git revert (秒級)
- 新舊格式都能讀
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com >
2026-03-25 14:14:58 +08:00
OG T
805d353892
feat(web): Phase 11.3 響應式設計 - Mobile/Tablet 支援
...
ConversationalView 響應式改造:
- Mobile: 全屏詳情面板 + 返回按鈕
- Tablet: 64px 側邊欄 (w-64)
- Desktop: 80px 側邊欄 (w-80)
- i18n: backToList 翻譯
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com >
2026-03-25 13:46:15 +08:00
OG T
7a8f869104
feat(api): Phase 13.2 #81 PostgreSQL MCP Tool 整合
...
整合 Approval/Incident/Timeline 查詢到 MCP Bridge:
- list_approvals: 列出授權請求 (可依狀態篩選)
- get_approval: 取得單一授權詳情
- list_incidents: 列出 Incident (可依狀態篩選)
- list_timeline: 列出最近時間軸事件
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com >
2026-03-25 12:46:52 +08:00
OG T
23b753dbec
feat(api): Phase 13.2 #79 SignOz MCP Tool 整合
...
整合真實 SignOzClient 到 MCP Bridge:
- gold_metrics: RPS + Error Rate + P99 Latency
- trace_url: 動態 Trace URL 生成
- system_metrics: CPU/Disk 系統指標
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com >
2026-03-25 12:44:46 +08:00
OG T
e36dab1aee
fix(ci): add Python and uv setup to Ollama test job
...
The self-hosted runner doesn't have uv pre-installed.
Add setup-python and setup-uv steps before running pytest.
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com >
2026-03-25 12:30:58 +08:00
OG T
d31160f4e1
feat(api): Phase 13.2 #80 Kubernetes MCP Tool real implementation
...
- Integrate real ActionExecutor instead of mock responses
- kubectl_get: Execute real kubectl get with JSON output
- kubectl_delete: Dry-run validation + actual pod deletion
- kubectl_scale: Real kubectl scale command
- kubectl_restart: Deployment rollout restart with validation
- Database query placeholder for #81
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com >
2026-03-25 12:30:13 +08:00
OG T
b8f9cd315c
fix(ci): replace jq with python3 for JSON parsing in Ollama test
...
The self-hosted runner doesn't have jq installed.
Use Python's json module as a portable alternative.
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com >
2026-03-25 12:07:23 +08:00
OG T
e87ac11f4f
feat(web): Phase 11 UX improvements for approval card
...
- Change dashed border buttons to solid filled style for better clickability
- Add signature progress bar with visual indicator
- Add signed users list showing who has already signed
- Convert Blast Radius section to collapsible panel (auto-open for CRITICAL)
- Convert Dry-Run Checks to collapsible panel with pass/fail summary badge
- Add slide-in animations for expanded content
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com >
2026-03-25 11:45:04 +08:00
OG T
bd6d7f5d0a
fix(api): lint errors in test_model_regression and test_prompt_validation
...
- Remove unused asyncio imports
- Fix import sorting (I001)
- Fix f-string without placeholders (F541)
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com >
2026-03-25 11:37:14 +08:00
OG T
9317f64813
feat(ci): Phase 12.3 Prompt 驗證自動化 ( #69 )
...
新增:
- test_prompt_validation.py (5 個 System Prompt 驗證案例)
- CI 加入 Prompt Validation Test 步驟
- AWOOOI_SYSTEM_PROMPT 品質基線 80%
驗證維度: 角色遵循、格式遵循、安全邊界
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com >
2026-03-25 11:29:34 +08:00
OG T
0a1787e934
feat(ci): Phase 12.3 Ollama 自動化測試 (#67-68)
...
新增:
- CI Ollama Model Test job (連線測試 + 冒煙測試)
- test_model_regression.py (4 個回歸案例 + 準確度報告)
- Skills 03 更新模型選擇規則
Phase 12.1-12.2 完成記錄更新
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com >
2026-03-25 11:26:10 +08:00
OG T
c437b0c749
fix(api): import sorting in test_action_parsing.py
...
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com >
2026-03-25 10:52:35 +08:00
OG T
afda3123eb
feat(api): Phase 12.1 Tool Calling 優化 (#60-62)
...
行動解析準確度: 80% → 100%
新增模式:
- 刪除 Pod X (中文)
- restart deployment X (明確區分)
- 重新啟動 deployment X (中英混合)
測試:
- 24 測試案例 (英/中/混合/邊界)
- test_accuracy_report() 自動化基線報告
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com >
2026-03-25 10:48:37 +08:00
OG T
b13b063282
feat(web): Phase 11 對話式 AI UI/UX (#47-59)
...
Phase 11.1 對話式容器:
- ConversationalView 雙欄佈局 (左側列表 + 右側詳情)
- ApprovalThreadItem 風險等級 + 相對時間顯示
- SSE 即時更新整合
Phase 11.2 批次處理:
- BatchModeSelector 組件 (全部接受/逐一審核/CRITICAL Only)
- POST /api/v1/approvals/bulk-approve API 端點
- CRITICAL + DESTRUCTIVE 安全過濾 (禁止批次核准)
Phase 11.4 鍵盤快捷鍵:
- useKeyboardShortcuts hook (Y/N/方向鍵/Esc)
- Y 鍵長按 2 秒核准 + 頂部進度指示器
- 快捷鍵說明 Modal (Y/N 高亮顯示)
i18n: 100% next-intl 覆蓋
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com >
2026-03-25 10:31:35 +08:00
OG T
170102a4ee
feat( #15 ): Approval Polling → SSE 即時更新
...
Phase 15: 將 Approval 輪詢機制改為 Server-Sent Events
後端變更:
- 新增 /api/v1/approvals/stream SSE 端點
- 建立/簽核/拒絕時發布 SSE 事件
- 使用現有 EventPublisher 基礎設施
前端變更:
- 新增 useApprovalSSE hook (自動連線/斷線管理)
- approval.store 新增 connectSSE/disconnectSSE actions
- 更新三個組件使用 SSE 取代 setInterval polling:
- LiveApprovalPanel
- AICommandPanel
- HITLSection
效益:
- 即時推送 (延遲 ~0ms vs polling 5s)
- 減少 API 請求 (僅變更時推送)
- 自動重連 + Fallback to polling
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com >
2026-03-25 09:54:02 +08:00
OG T
749b8bc554
fix(api): 修復時區 import 排序與未使用變數 lint 錯誤
...
- 修正 import 順序 (standard → third-party → local)
- 修復 datetime/timedelta 未定義錯誤
- 移除未使用的 imports
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com >
2026-03-25 09:26:58 +08:00
OG T
5c95b194b9
feat(api): Sentry + OpenClaw + Telegram 整合 (Phase 10)
...
- 新增 Telegram 告警發送 (send_sentry_telegram_alert)
- 新增 Approval 創建 (create_sentry_approval)
- 整合 analyze_and_comment 流程:
1. OpenClaw AI 分析
2. 建立 Approval 記錄
3. 發送 Telegram 告警 (含 Y/n 按鈕)
4. 回寫 Sentry Comment
Memory: project_sentry_openclaw_v2.md
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com >
2026-03-25 09:12:41 +08:00
OG T
2a2dac865a
feat(api): 統一使用台北時區 UTC+8 (禁止 UTC)
...
- 新增 src/utils/timezone.py 時區工具函式
- 修改 11 個後端檔案,全部改用 now_taipei()
- 更新 HARD_RULES.md 加入時區鐵律章節
- 更新 Skills 02/04 加入時區禁令
🔴 HARD RULE: 禁止 datetime.utcnow() / datetime.now(UTC)
✅ 正確做法: from src.utils.timezone import now_taipei
Memory: feedback_timezone_taipei.md
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com >
2026-03-25 09:08:34 +08:00
OG T
5f3271174f
fix(ci): remove ubuntu-latest jobs (HARD RULE compliance)
...
刪除 external-sentinel 和 telegram-connectivity jobs
- 禁止 ubuntu-latest (GitHub Billing 限制)
- 只保留 self-hosted runner jobs
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com >
2026-03-25 02:13:55 +08:00
OG T
ad00eda73b
chore(ci): Disable GitHub-hosted runner jobs (billing limit)
...
- external-sentinel: if: false
- telegram-connectivity: if: false
Reason: GitHub account payment/spending limit restrictions
Only self-hosted runner jobs remain active
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com >
2026-03-25 00:51:23 +08:00
OG T
1ab3f15816
fix(api): Lint fixes for sentry_webhook.py
2026-03-25 00:26:24 +08:00
OG T
8b7a1186ab
feat(web): Professional UX for approval workflow
...
Industry-standard AIOps UX patterns:
- Compact approval list in right panel
- SlidePanel for details (PagerDuty/ServiceNow style)
- Keyboard navigation (←/→ for prev/next, ESC to close)
- Quick access to approve/reject
- Maintains context while reviewing details
Fixes large empty space issue and endless scrolling.
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com >
2026-03-25 00:22:35 +08:00
OG T
5d03a82c7a
fix(api): Add missing datetime import in sync endpoint
2026-03-25 00:15:46 +08:00
OG T
3b8638b350
feat(api): Add sync-from-approvals endpoint for incident backfill
...
Fixes existing approvals created before b645981 that lack
corresponding incidents. Ensures "活躍事件" count matches
"待簽核" count.
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com >
2026-03-25 00:09:44 +08:00
OG T
41bd213a8c
fix(nginx): Route /api/sentry-tunnel to Next.js frontend
...
Sentry Tunnel is a Next.js API Route, not FastAPI endpoint.
Must be handled by frontend server to avoid 404.
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com >
2026-03-25 00:05:51 +08:00
OG T
e3714f19b7
fix(web): ApprovalCard Sticky Footer (簽核按鈕永遠可見)
...
UX 問題: 卡片過長,滾動到底部簽核時看不到頂部內容
修復:
- max-h-[70vh] 限制卡片最大高度
- 內容區域可滾動 (overflow-y-auto)
- Footer sticky 固定在底部
- 簽核按鈕永遠可見
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com >
2026-03-24 23:47:22 +08:00
OG T
38378276f3
fix(web): ApprovalCard UX 優化 - 標題與命令分離
...
問題: action 欄位包含完整 kubectl 命令導致標題過長
[AI: mock_fallback] 前綴干擾閱讀
修復:
- 主標題只顯示 | 前的動作描述
- kubectl 命令獨立顯示在 code block
- 移除描述中的 [AI: xxx] 和 AI 仲裁前綴
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com >
2026-03-24 23:44:51 +08:00
OG T
b6459819e2
fix(api): Incident-Approval 同步 (活躍事件修復)
...
問題: Alertmanager webhook 只創建 Approval,沒有創建對應 Incident
導致「活躍事件」顯示 0 筆,但右側有待簽核卡片
修復:
- 新增 create_incident_for_approval() 函數
- Approval 創建後同步創建 Incident
- 存入 Redis (incident:INC-*) 7 天 TTL
- 支援 LLM 成功路徑和 fallback 路徑
遵循 feedback_incident_approval_sync.md 鐵律
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com >
2026-03-24 23:43:19 +08:00
OG T
2bb76433f1
feat(cd): 改善部署通知格式 (用戶友善)
...
- 顯示版本描述 (commit message 前50字)
- 顯示部署時間 (Asia/Taipei 時區)
- 顯示作者
- 顯示簡短 SHA
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com >
2026-03-24 23:36:08 +08:00
OG T
77c6bf349c
perf(ci): Skip Docker Verify on main push - PR only
...
CI 優化: Docker Verify 改為只在 PR 時執行
- main push 跳過 (CD 會構建)
- 預估省下 10-15 分鐘
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com >
2026-03-24 23:01:46 +08:00
OG T
6f250d8b5f
fix(webhooks): 使用 ApprovalRequestCreate + create_approval_with_fingerprint
...
與 /alerts 端點同步:
- 使用 ApprovalRequestCreate 物件
- 呼叫 create_approval_with_fingerprint()
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com >
2026-03-24 22:23:17 +08:00
OG T
10adce21ad
fix(webhooks): primary_responsibility 已是 str 不需 .value
...
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com >
2026-03-24 22:16:45 +08:00
OG T
09d4e2a373
fix(webhooks): 修正 OpenClawDecision 物件屬性存取
...
原錯誤: 'OpenClawDecision' object has no attribute 'get'
修正: 使用 Pydantic 模型屬性存取 (analysis_result.risk_level.value)
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com >
2026-03-24 22:11:39 +08:00
OG T
ac8fa33354
fix(webhooks): Alertmanager 端點完整流程 (LLM + Telegram)
...
原問題:/alertmanager 只寫 Redis Stream,沒有觸發 Telegram
修正:遵循 phase5_telemetry_architecture.md 原始架構
流程:Alertmanager → Alert Normalizer → Fingerprint → LLM → Telegram
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com >
2026-03-24 19:34:29 +08:00
OG T
22cada563b
fix(config): Share Redis DB 0 with OpenClaw
...
- Change REDIS_URL from DB 10 to DB 0
- AWOOOI and OpenClaw now share the same Redis database
- Incidents created by OpenClaw visible in AWOOOI UI
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com >
2026-03-24 18:44:34 +08:00
OG T
80b06e72a3
feat(api): Add Alertmanager native format webhook endpoint
...
- POST /api/v1/webhooks/alertmanager accepts Prometheus Alertmanager format
- Internal IPs (192.168.x.x, 10.x.x.x) bypass HMAC verification
- Converts Alertmanager alerts to Signal format → Redis Stream
- External IPs must use /signals with HMAC
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com >
2026-03-24 18:43:18 +08:00