fix(orchestration): tolerate raw control characters in model JSON
Deploy Canina / deploy (push) Successful in 36s

This commit is contained in:
devops committed 2026-10-19 14:13:00 +00:00
1 parent 4c3f8de1fb
commit bf53f2e17c
2 files changed
+5 -1

No files matched your search

@@ -37,7 +37,7 @@ def parse_structured_response(text: str) -> dict[str, Any]:
start, end = cleaned.find("{"), cleaned.rfind("}")
if start >= 0 and end > start:
cleaned = cleaned[start : end + 1]
parsed = json.loads(cleaned)
parsed = json.loads(cleaned, strict=False)
if not isinstance(parsed, dict):
raise ValueError("Model response must be a JSON object")
parsed.setdefault("summary", "")
@@ -35,6 +35,10 @@ class OrchestrationWorkerTests(unittest.TestCase):
payload = parse_structured_response('```json\n{"summary":"ok","child_tasks":[]}\n```')
self.assertEqual(payload["summary"], "ok")
def test_parse_json_with_raw_control_character(self):
payload = parse_structured_response('{"summary":"line one\nline two","child_tasks":[]}')
self.assertEqual(payload["summary"], "line one\nline two")
def test_child_task_codes_are_deterministic_and_include_parent(self):
proposal = {
"child_tasks": [