fix: _parse_llm_response now handles empty/invalid JSON gracefully

test: add gap coverage tests (hina_agent/JCL/quality gate edge cases)
This commit is contained in:
hangshuo652
2026-06-18 17:31:16 +08:00
parent b5e76306c3
commit 63b5284715
2 changed files with 189 additions and 2 deletions
+5 -2
View File
@@ -151,8 +151,11 @@ def _parse_llm_response(raw: str) -> dict:
end = text.index("```", start) if "```" in text[start:] else len(text)
text = text[start:end].strip()
parsed = json.loads(text)
return _validate_result(parsed)
try:
parsed = json.loads(text)
return _validate_result(parsed)
except (json.JSONDecodeError, ValueError):
return _validate_result({})
def _validate_result(parsed: dict) -> dict: