fix(hunt): a malformed tool-loop step ends the loop and the answer is still extracted

DSPy 3.4.1 raises AdapterParseError for an unparseable ReAct step, which is not the ValueError its loop
catches, so one malformed step discarded the whole hunt (7 of 60 hunts in the repeats). The step now ends
the loop like an invalid tool choice. Records carry loop_parse_failed beside parse_failed.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
This commit is contained in:
Marius Ciepluch
2026-10-13 15:30:13 +02:00
co-authored by Claude Opus 5.5
parent e07ab2ac93
commit 455637bea5
3 changed files with 43 additions and 3 deletions
+1
View File
@@ -142,6 +142,7 @@ def hunt_change(
program.bind(root)
prediction = program(**inputs)
record["parse_failed"] = bool(getattr(prediction, "parse_failed", False))
record["loop_parse_failed"] = bool(getattr(prediction, "loop_parse_failed", False))
for finding in prediction.findings:
if finding.get("path") in texts and not finding.get("function") and (span := _function_at(root, finding)):
finding["function"] = span