Skip to content

fix(eval): surface actionable message on target output key mismatch - #1888

Open
Chibionos wants to merge 1 commit into
mainfrom
fix/eval-target-key-error-message
Open

fix(eval): surface actionable message on target output key mismatch#1888
Chibionos wants to merge 1 commit into
mainfrom
fix/eval-target-key-error-message

Conversation

@Chibionos

Copy link
Copy Markdown
Contributor

Milo hit this in the FUSION-workshop coding-agent authoring path (MST-14878): an LLM judge evaluator had targetOutputKey: reason, but the data point's expectedOutput only had decision and route. Normal authoring miss. The run dumped a raw Python traceback ending in KeyError: 'reason' instead of a readable eval error.

output_evaluator.py already wraps that KeyError in a UiPathEvaluationError with TARGET_OUTPUT_KEY_NOT_FOUND, but str(exc) only returned detail, and detail was f"Error: {e}" plus the full traceback appended. track_evaluation_metrics writes str(e) into the evaluator's details field, so the traceback is exactly what landed in the run results.

I changed str(exc) to return f"{title}: {detail}" and left the traceback on error_info.detail for logs/support. The four TARGET_OUTPUT_KEY_NOT_FOUND messages now name the missing key(s) and list the keys that were actually present, instead of just echoing str(KeyError).

What to look at

__str__ lives on the shared UiPathEvaluationError type, not just this code path. Every evaluation error that used to render as a bare detail (often traceback and all) now renders as title: 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 green
  • Extended test_scalar_key_missing_in_actual_raises and test_scalar_key_missing_in_expected_raises to assert the surfaced message names the missing key and the available keys, and contains no Traceback
  • ruff check ., ruff format --check ., mypy on both changed modules — clean

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.
Copilot AI lite review requested due to automatic review settings September 8, 2026 19:39
@chatgpt-codex-connector

Copy link
Copy Markdown

You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard.

@github-actions github-actions Bot added test:uipath-langchain Triggers tests in the uipath-langchain-python repository test:uipath-integrations labels Sep 8, 2026

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟢 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 UiPathEvaluationError construction so str(exc) is "{title}: {detail}", while preserving tracebacks in error_info.detail for support/logging.
  • Added a helper in output_evaluator.py to 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.

@sonarqubecloud

sonarqubecloud Bot commented Sep 8, 2026

Copy link
Copy Markdown

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

test:uipath-integrations test:uipath-langchain Triggers tests in the uipath-langchain-python repository

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants