fix: retain agent challenge parse errors

This commit is contained in:
lda
2026-06-16 21:42:49 +07:00 Verified
parent 64bf182d7c
commit b62d7e5889
3 changed files with 51 additions and 2 deletions
@@ -3,6 +3,7 @@ from __future__ import annotations
import subprocess
import sys
from pathlib import Path
from typing import Any
# Support direct execution as `python examples/.../run_opencode_trials.py`.
# ruff: noqa: I001 - imports must stay after sys.path.insert
@@ -135,7 +136,7 @@ def run_trial(
*,
index: int,
results_dir: Path,
) -> dict:
) -> dict[str, Any]:
return _generic_run_trial(
config, index=index, results_dir=results_dir, classify_fn=classify_output
)
+8 -1
View File
@@ -139,13 +139,18 @@ def run_trial(
return payload
parsed: dict[str, Any] | None
parse_error: dict[str, str] | None = None
try:
parsed = parse_opencode_output(completed.stdout)
text = result_text(parsed)
classification = classify_fn(text)
except Exception:
except Exception as exc:
parsed = None
classification = "parse_error"
parse_error = {
"type": type(exc).__name__,
"message": str(exc),
}
payload = {
"index": index,
@@ -158,6 +163,8 @@ def run_trial(
"stderr": completed.stderr,
"parsed": parsed,
}
if parse_error is not None:
payload["parse_error"] = parse_error
_write_trial_report(payload)
_write_trial_result(results_dir, config=config, index=index, payload=payload)
return payload