From 0077ff9758e08c53b6f5f9bf1c2c51bfafd66c7c Mon Sep 17 00:00:00 2001 From: OG T Date: Thu, 16 Apr 2026 22:51:30 +0800 Subject: [PATCH] =?UTF-8?q?fix(solver):=20=E5=82=B3=E9=81=9E=20hypothesis?= =?UTF-8?q?=20=E4=BD=9C=E7=82=BA=20alert=5Fcontext=20=E7=B5=A6=20OPENCLAW?= =?UTF-8?q?=5FNEMO?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 根因:solver 呼叫 openclaw.call(prompt) 不傳 context → nemo fallback 把 prompt[:500](系統說明「軍師 Agent」) 當 signal description → LLM 回傳垃圾方案描述 修復:把 top.description 放進 alert_context.signals 讓 nemo 看到真實根因假設(與 diagnostician 同模式 7eb8375) Co-Authored-By: Claude Sonnet 4.6 --- apps/api/src/agents/solver_agent.py | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/apps/api/src/agents/solver_agent.py b/apps/api/src/agents/solver_agent.py index 3ab91848..e42cca7c 100644 --- a/apps/api/src/agents/solver_agent.py +++ b/apps/api/src/agents/solver_agent.py @@ -111,9 +111,21 @@ class SolverAgent(BaseAgent): "confidence": top.confidence, }) + # 2026-04-16 ogt + Claude Sonnet 4.6: 傳遞 hypothesis 結構化資料給 OPENCLAW_NEMO + # 根因:原本 call(prompt) 不傳 context → nemo fallback 把 prompt[:500](系統說明) + # 當 signal description → LLM 回傳「設計修復方案的軍師 Agent」垃圾 + # 修復:把 top hypothesis description 放進 alert_context.signals 讓 nemo 看到真實診斷 + _hypothesis_text = (top.description or "(待診斷)")[:800] + alert_context = { + "incident_id": diagnosis.evidence_snapshot_id or "UNKNOWN", + "severity": "P3", + "signals": [{"alert_name": "diagnosis_hypothesis", "description": _hypothesis_text}], + "affected_services": [], + } + from src.services.openclaw import get_openclaw openclaw = get_openclaw() - response_text, _provider, success = await openclaw.call(prompt) + response_text, _provider, success = await openclaw.call(prompt, alert_context=alert_context) if not success or not response_text: return self._degraded_plan(diagnosis, 0, "llm_failed")