fix(eval): surface actionable message on target output key mismatch - #1888
fix(eval): surface actionable message on target output key mismatch#1888Chibionos wants to merge 1 commit into
Conversation
Output evaluators wrapped a missing/mismatched target_output_key in UiPathEvaluationError, but str(e) returned only the detail (a bare "Error: 'key'" plus an embedded traceback), so the error result users saw in the run output was an unreadable stack trace instead of a readable message. str(e) now returns "title: detail" and the detail itself names the missing key and lists the keys that were actually present.
|
You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard. |
There was a problem hiding this comment.
🟢 Approval recommended
The changes are targeted, consistent with existing error handling patterns, and include test assertions that verify the intended user-facing message improvements.
Pull request overview
This PR improves the UiPath Python SDK evaluation UX by making UiPathEvaluationError render as a concise, actionable message (title + detail) instead of often surfacing raw tracebacks in evaluator result “details”, and enhances TARGET_OUTPUT_KEY_NOT_FOUND errors to explicitly describe missing target output keys and available keys.
Changes:
- Adjusted
UiPathEvaluationErrorconstruction sostr(exc)is"{title}: {detail}", while preserving tracebacks inerror_info.detailfor support/logging. - Added a helper in
output_evaluator.pyto generate actionable “missing key(s) + available keys” detail messages for target output key lookup failures. - Extended evaluator tests to assert the surfaced details include missing/available keys and do not include “Traceback”.
File summaries
| File | Description |
|---|---|
| packages/uipath/src/uipath/eval/models/models.py | Changes UiPathEvaluationError string rendering to include title + detail while keeping traceback in structured error info. |
| packages/uipath/src/uipath/eval/evaluators/output_evaluator.py | Produces clearer TARGET_OUTPUT_KEY_NOT_FOUND details including requested keys and available top-level keys. |
| packages/uipath/tests/evaluators/test_evaluator_methods.py | Adds assertions validating key names appear in error details and that tracebacks are not surfaced. |
Review details
- Files reviewed: 3/3 changed files
- Comments generated: 0
- Review effort level: Lite
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
|



Milo hit this in the FUSION-workshop coding-agent authoring path (MST-14878): an LLM judge evaluator had
targetOutputKey: reason, but the data point'sexpectedOutputonly haddecisionandroute. Normal authoring miss. The run dumped a raw Python traceback ending inKeyError: 'reason'instead of a readable eval error.output_evaluator.pyalready wraps thatKeyErrorin aUiPathEvaluationErrorwithTARGET_OUTPUT_KEY_NOT_FOUND, butstr(exc)only returneddetail, anddetailwasf"Error: {e}"plus the full traceback appended.track_evaluation_metricswritesstr(e)into the evaluator'sdetailsfield, so the traceback is exactly what landed in the run results.I changed
str(exc)to returnf"{title}: {detail}"and left the traceback onerror_info.detailfor logs/support. The fourTARGET_OUTPUT_KEY_NOT_FOUNDmessages now name the missing key(s) and list the keys that were actually present, instead of just echoingstr(KeyError).What to look at
__str__lives on the sharedUiPathEvaluationErrortype, not just this code path. Every evaluation error that used to render as a baredetail(often traceback and all) now renders astitle: detail. I think that's the right default everywhere, but it's a behavior change beyond the one evaluator that reported this.Testing
pytest tests/evaluators/— full suite greentest_scalar_key_missing_in_actual_raisesandtest_scalar_key_missing_in_expected_raisesto assert the surfaced message names the missing key and the available keys, and contains noTracebackruff check .,ruff format --check .,mypyon both changed modules — clean