fix: _extract_skill_json crashes on a truthy non-string teacher response (#1630)

This commit is contained in:
Afonso Coutinho
2026-06-03 00:59:36 +01:00
committed by GitHub
parent 6b2618dab4
commit d818117d4c
2 changed files with 20 additions and 1 deletions

View File

@@ -327,7 +327,7 @@ def _extract_skill_json(teacher_response: str) -> Optional[Dict[str, Any]]:
treated as "teacher declined to write a skill", per the prompt
contract.
"""
if not teacher_response:
if not isinstance(teacher_response, str) or not teacher_response:
return None
import json
m = re.search(r"```(?:json)?\s*\n(\{[\s\S]*?\})\s*\n```", teacher_response)