fix(solver): 傳遞 hypothesis 作為 alert_context 給 OPENCLAW_NEMO
Some checks failed
CD Pipeline / build-and-deploy (push) Has been cancelled

根因: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 <noreply@anthropic.com>
This commit is contained in:
OG T
2026-04-16 22:51:30 +08:00
parent 92b39ab840
commit 0077ff9758

View File

@@ -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")