feat(aiops): enable read-only agent loop canary
This commit is contained in:
@@ -6,6 +6,23 @@
|
||||
|
||||
---
|
||||
|
||||
## 2026-05-01 | Agent Loop P1 canary + CD Argo revision gate + SSH MCP 四節點閉環
|
||||
|
||||
承接 ADR-105 地基與 production 驗證後的待辦:CD 會在 push deploy commit 後誤判上一個 Argo revision 已 Synced/Healthy;SSH MCP key 尚未授權 120/121;Agent Loop 仍只停在 provider capability,尚未有 production canary。
|
||||
|
||||
### 完成
|
||||
- Gitea CD `Deploy to K8s (ArgoCD GitOps)` 在 push `chore(cd): deploy ... [skip ci]` 後,會記錄 `DEPLOY_REVISION`,先 annotate `argocd.argoproj.io/refresh=hard`,再等待 `.status.sync.revision == DEPLOY_REVISION` 且 Synced/Healthy;超時直接 fail,不再讓舊 revision rollout 假成功。
|
||||
- `ssh-mcp-key` public key 已以一次性 privileged pod 追加到 `mon(192.168.0.120)` 與 `mon1(192.168.0.121)` 的 `wooo/.ssh/authorized_keys`;臨時 pod 已刪除。
|
||||
- API pod 內使用 `/run/secrets/ssh_mcp_key` + `/etc/ssh-mcp/known_hosts` 驗證 `wooo@192.168.0.120`、`wooo@192.168.0.121` 均回 `OK`。
|
||||
- 新增 `ENABLE_OPENCLAW_AGENT_LOOP_SHADOW` / `OPENCLAW_AGENT_LOOP_MAX_ITERATIONS`;production configmap 開啟 read-only canary,最多 2 輪,本地 Ollama tool_use,不改主決策。
|
||||
- `OpenClawService.generate_incident_proposal_with_tools()` 在原 proposal 成功後執行 read-only Agent Loop shadow investigation,只給 Kubernetes/Prometheus/SignOz/Database/RAG/Grafana 的 read-only MCP tools,結果附加 `agent_loop_shadow` metadata。
|
||||
- Agent Loop shadow 失敗只 log warning,不阻塞原本 PreDecision/Nemotron/Playbook 路徑。
|
||||
|
||||
### 驗證
|
||||
- `python3 -m py_compile apps/api/src/core/config.py apps/api/src/services/openclaw.py apps/api/src/services/ai_providers/permissions.py` 通過。
|
||||
- `cd apps/api && pytest tests/test_agent_loop_foundation.py tests/test_openclaw_cache_key.py -q` → 8 passed。
|
||||
- Production 前置檢查:最新 image `b6cf6167` 健康;ArgoCD `Synced Healthy 33a71489`;四節點 SSH MCP key 驗證完成。
|
||||
|
||||
## 2026-05-01 | LLM 鬼循環治理 — in-flight lock + stable cache + no-retry 2xx
|
||||
|
||||
Claude Code 成本評估指出真正瓶頸不是外部 AI 費用,而是同一告警 0 秒重入、20 秒週期反覆呼叫 LLM、以及 HTTP 500 讓 Alertmanager 立即重試。結論:先修飛輪,再談 Gemini/Groq/Claude 訂閱;健康狀態下外部 provider 只應作為 capped fallback。
|
||||
|
||||
@@ -64,6 +64,18 @@ Alert -> Agent Loop -> LLM tool_use -> MCP tool_result -> Final Decision
|
||||
3. P2: OpenClaw/NemoTron/Hermes/ElephantAlpha 逐一接線,先 read-only / diagnose,再開執行類工具。
|
||||
4. P3: Langfuse spans、Grafana MCP dashboard、audit replay。
|
||||
|
||||
## 2026-05-01 P1 Canary
|
||||
|
||||
OpenClaw 先接 read-only shadow investigation,而不是直接替換主決策:
|
||||
|
||||
- Feature flag:`ENABLE_OPENCLAW_AGENT_LOOP_SHADOW`
|
||||
- 輪數上限:`OPENCLAW_AGENT_LOOP_MAX_ITERATIONS`(prod canary 設 2)
|
||||
- 觸發點:`OpenClawService.generate_incident_proposal_with_tools()` 原 proposal 成功後
|
||||
- 允許工具:Kubernetes / Prometheus / SignOz / Database / RAG / Grafana 的 read-only tools
|
||||
- Provider:本地 Ollama 優先,不新增 Gemini/Claude 付費呼叫
|
||||
- 影響面:只附加 `agent_loop_shadow` metadata,不覆蓋 `action`、`risk_level`、`confidence` 或 Nemotron tool result
|
||||
- 失敗策略:log warning 後回到既有 proposal / Nemotron / Playbook 路徑
|
||||
|
||||
## 驗收
|
||||
|
||||
- `mcp_audit_log` 24h call count > 0。
|
||||
|
||||
Reference in New Issue
Block a user