4.0 KiB
4.0 KiB
AI 自動化閉環記憶(2026-04-29)
用途:讓新 Codex session 快速掌握 2026-04-29 這輪「AI 自動化」修復後的實況,不必重讀整串對話與所有 commit。
核心結論
- AI 自動化控制面已從三 Agent 擴展為四 Agent:Hermes、NemoTron、OpenClaw、ElephantAlpha。
- EventRouter 是告警與 L2 安全 action 的入口;AI 掛掉時必須降級,不可中斷通知。
- AutoHeal 是自癒副作用入口;
momo-db/momo-postgres受保護,不可自動 restart / stop / recreate。 - OpenClaw learning 是 AI 記憶與 embedding queue 的橋接層;raw
ai_insights寫入者必須 enqueue embedding 或可回補。 - ElephantAlpha 只負責 orchestration / HITL / AutoHeal bridge,不可繞過 ADR-011、ADR-012、ADR-013。
- AI 自動化最小 Prometheus 指標已接入
/metrics,來源為services/ai_automation_metrics.py。 - 線上 smoke dashboard 已接入
/ai_automation_smoke,JSON API 為/api/ai-automation/smoke。 - Smoke API 會保存最近快檢 JSONL 趨勢,dashboard 顯示 OK / Warning / Critical 最近分布。
- Smoke history 已支援 JSONL 匯出、清理與每日摘要;清理只影響 smoke history,不碰 DB 或 EventRouter queue。
已落地範圍
- EventRouter 增加同步 dispatch、AI 失敗降級、Telegram 失敗 file queue、成功後 replay、去重冷卻、靜音檢查、L2 SAFE_ACTIONS 限制。
- NemoTron 在缺 API key、quota、timeout、network/HTTP error、0 tool call 時 fallback 到 Hermes 規則。
- Code review pipeline 預設關閉 auto-fix,高風險只走 HITL/action_plan,內部 webhook token 預設必填。
- AutoHeal 補 incident / heal log / KM 沉澱,DB 不可用時安全降級,SSH_CMD 限 read-only allowlist。
- OpenClaw learning 補 raw insert embedding bridge、stale processing reset、missing embedding backfill、pgvector semantic RAG fallback。
- Scheduler 重要失敗路徑接入 EventRouter,減少裸 exception 漏通知。
- ElephantAlpha 執行引擎補 sync timeout、HITL reply_markup、未知 step fail fast、code/resource action 走 AutoHeal bridge。
- L2
agent_actions.py的flag_for_human_review、route_to_km、mark_for_relearn已從 stub 改為可審計 OpenClaw memory 寫入。 /metrics已匯出 EventRouter dispatch、latency、safe action、Telegram replay、AutoHeal action 與 duration 指標。- Smoke dashboard read-only 檢查 EventRouter queue、AutoHeal protected resources、NemoTron fallback、OpenClaw embedding queue、ElephantAlpha HITL,不做外部網路呼叫。
- Smoke history 只保存精簡紀錄,不保存完整 details,避免長期檔案膨脹與敏感資訊堆積。
- Export API 回傳
application/x-ndjson,clear API 只刪除MOMO_AI_AUTOMATION_SMOKE_HISTORY指向檔案。
驗證紀錄
- 2026-04-29 AI metrics 批次:
26 passed。 - 2026-04-29 AI smoke dashboard 批次:
2 passed(單檔 smoke service),後續核心組需持續納入。 - 2026-04-29 AI smoke trend 批次:
5 passed(smoke + metrics)。 - 2026-04-29 AI smoke management 批次:
7 passed(smoke + metrics)。 - 2026-04-29 L2 安全記憶批次:
24 passed。 - collect-only:
48 tests collected。 git diff --check已通過。
相關 commit
779b27f修復 P0 告警自癒鏈與測試收集0875dd8補強 5.5 自癒安全回看1c2dc6c補強 AI 自動化閉環與安全降級f0e044a補齊自癒稽核與 OpenClaw 記憶閉環0c2e9bb串接 AI 洞察向量化與漏通知入口78eebfb加入告警去重與洞察向量回補d486598補強 ElephantAlpha 執行與通知閉環5b25f55補齊 EventRouter 失敗通知回放162a76b落地 L2 安全記憶動作d58e4d0同步四 Agent AI 自動化治理紀錄
下次進場先看
- ADR-018:四 AI Agent 自動化控制面。
- ADR-012:Action Ladder 與 L2 SAFE_ACTIONS。
- ADR-013:AutoHeal 安全邊界。
docs/AI_INTELLIGENCE_MODULE_SOT.md:目前 AI 架構事實。docs/guides/ai_automation_session_sop.md:AI 自動化 session 執行與收尾 SOP。