fix(hunt): lines read through a tool count as shown; an unparseable answer is an empty answer

The answer check counted only the rendered function text as shown, so 7 of
8 baseline suspicions citing lines the model had read with read_file were
marked unknown (baseline 1/12 against the pilot hunter's 6/12). Tools now
record the lines they return. A DSPy parse failure scores as zero findings
with a flag instead of a broken run. The per-run response cache now takes
effect through dspy.configure_cache.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
This commit is contained in:
Marius Ciepluch
2026-10-13 13:10:40 +02:00
co-authored by Claude Opus 5.5
parent c5bf52f47d
commit 602ec23e03
8 changed files with 174 additions and 62 deletions
+3 -4
View File
@@ -138,11 +138,10 @@ def hunt_change(
record["rows"] = len(rows)
inputs = render(change, rows, texts, mask=mask)
record["inputs_present"] = sorted(inputs)
if tools_for is not None:
program.hunt.tools = (
{tool.name: tool for tool in tools_for(root)} if hasattr(program.hunt, "tools") else program.hunt.tools
)
if tools_for is not None and hasattr(program, "bind"):
program.bind(root)
prediction = program(**inputs)
record["parse_failed"] = bool(getattr(prediction, "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