fix: retain agent challenge parse errors
This commit is contained in:
@@ -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
|
||||
)
|
||||
|
||||
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user